Skip to content

Commit c5304bc

Browse files
committed
Add audioBaseUri state to ChatViewComponent for dynamic audio URL generation
1 parent a2e094f commit c5304bc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
6161
{ isHidden, showAnnouncement, hideAnnouncement },
6262
ref,
6363
) => {
64+
const [audioBaseUri] = useState(() => {
65+
const w = window as any
66+
return w.AUDIO_BASE_URI || ""
67+
})
6468
const { t } = useAppTranslation()
6569
const modeShortcutText = `${isMac ? "⌘" : "Ctrl"} + . ${t("chat:forNextMode")}`
6670
const {
@@ -148,11 +152,8 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
148152
soundEnabled,
149153
}
150154

151-
// Helper function to get audio URLs that works in both development and Jest environments
152155
const getAudioUrl = (path: string) => {
153-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
154-
// @ts-ignore
155-
return `${window.AUDIO_BASE_URI}/${path}`
156+
return `${audioBaseUri}/${path}`
156157
}
157158

158159
// Use the getAudioUrl helper function

0 commit comments

Comments
 (0)