Skip to content

Commit 66b1b73

Browse files
committed
Render HTML5 Audio Player if Tool Result resource mimetype is audio.
1 parent 9452991 commit 66b1b73

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

client/src/components/ToolsTab.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,19 @@ const ToolsTab = ({
8383
/>
8484
)}
8585
{item.type === "resource" && (
86-
<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">
87-
{JSON.stringify(item.resource, null, 2)}
88-
</pre>
86+
item.resource?.mimeType?.startsWith("audio/") ? (
87+
<audio
88+
controls
89+
src={`data:${item.resource.mimeType};base64,${item.resource.blob}`}
90+
className="w-full"
91+
>
92+
<p>Your browser does not support audio playback</p>
93+
</audio>
94+
) : (
95+
<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">
96+
{JSON.stringify(item.resource, null, 2)}
97+
</pre>
98+
)
8999
)}
90100
</div>
91101
))}

0 commit comments

Comments
 (0)