diff --git a/app/components/chat.tsx b/app/components/chat.tsx index c9e302e2584..324fc74c873 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -370,7 +370,7 @@ export function ChatAction(props: { text: string; icon: JSX.Element; onClick: () => void; - isListening: boolean; + isListening?: boolean; }) { const iconRef = useRef(null); const textRef = useRef(null); @@ -574,7 +574,15 @@ export function ChatActions(props: { ); }, []); + function playSound(fileName: string) { + const audio = new Audio(fileName); + audio.play().catch((error) => { + console.error("error:", error); + }); + } + const startListening = async () => { + playSound("/Recordingstart.mp3"); showToast(Locale.Chat.StartSpeak); if (speechApi) { await speechApi.start(); @@ -590,6 +598,7 @@ export function ChatActions(props: { await speechApi.stop(); setIsListening(false); } + playSound("/Recordingdone.mp3"); document.getElementById("chat-input")?.focus(); }; const onRecognitionEnd = (finalTranscript: string) => { diff --git a/public/Recordingdone.mp3 b/public/Recordingdone.mp3 new file mode 100644 index 00000000000..71d80c709e4 Binary files /dev/null and b/public/Recordingdone.mp3 differ diff --git a/public/Recordingstart.mp3 b/public/Recordingstart.mp3 new file mode 100644 index 00000000000..dedc4d152a2 Binary files /dev/null and b/public/Recordingstart.mp3 differ