Skip to content

Commit d438760

Browse files
Merge pull request #99 from evalstate/feature/audio-rendering
Render Audio Player if Tool Result resource mime type is audio.
2 parents 1d4e888 + d0ad677 commit d438760

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

client/src/components/ToolsTab.tsx

+14-5
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,20 @@ const ToolsTab = ({
8787
className="max-w-full h-auto"
8888
/>
8989
)}
90-
{item.type === "resource" && (
91-
<pre className="bg-gray-50 dark:bg-gray-800 dark:text-gray-100 whitespace-pre-wrap break-words p-4 rounded text-sm overflow-auto max-h-64">
92-
{JSON.stringify(item.resource, null, 2)}
93-
</pre>
94-
)}
90+
{item.type === "resource" &&
91+
(item.resource?.mimeType?.startsWith("audio/") ? (
92+
<audio
93+
controls
94+
src={`data:${item.resource.mimeType};base64,${item.resource.blob}`}
95+
className="w-full"
96+
>
97+
<p>Your browser does not support audio playback</p>
98+
</audio>
99+
) : (
100+
<pre className="bg-gray-50 dark:bg-gray-800 dark:text-gray-100 whitespace-pre-wrap break-words p-4 rounded text-sm overflow-auto max-h-64">
101+
{JSON.stringify(item.resource, null, 2)}
102+
</pre>
103+
))}
95104
</div>
96105
))}
97106
</>

0 commit comments

Comments
 (0)