Skip to content

Commit 55a9adf

Browse files
improvement(voice): interrupt UI + mute mic while agent is talking (#705)
* improvement(voice): interrupt UI + live transcription * cleanup logs * remove cross
1 parent bdfe7e9 commit 55a9adf

File tree

2 files changed

+339
-252
lines changed

2 files changed

+339
-252
lines changed

apps/sim/app/chat/[subdomain]/chat-client.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ export default function ChatClient({ subdomain }: { subdomain: string }) {
269269
const messageToSend = messageParam ?? inputValue
270270
if (!messageToSend.trim() || isLoading) return
271271

272+
logger.info('Sending message:', { messageToSend, isVoiceInput, conversationId })
273+
272274
// Reset userHasScrolled when sending a new message
273275
setUserHasScrolled(false)
274276

@@ -305,6 +307,8 @@ export default function ChatClient({ subdomain }: { subdomain: string }) {
305307
conversationId,
306308
}
307309

310+
logger.info('API payload:', payload)
311+
308312
const response = await fetch(`/api/chat/${subdomain}`, {
309313
method: 'POST',
310314
headers: {
@@ -321,6 +325,7 @@ export default function ChatClient({ subdomain }: { subdomain: string }) {
321325

322326
if (!response.ok) {
323327
const errorData = await response.json()
328+
logger.error('API error response:', errorData)
324329
throw new Error(errorData.error || 'Failed to get response')
325330
}
326331

@@ -334,6 +339,8 @@ export default function ChatClient({ subdomain }: { subdomain: string }) {
334339
? createAudioStreamHandler(streamTextToAudio, DEFAULT_VOICE_SETTINGS.voiceId)
335340
: undefined
336341

342+
logger.info('Starting to handle streamed response:', { shouldPlayAudio })
343+
337344
await handleStreamedResponse(
338345
response,
339346
setMessages,
@@ -405,6 +412,7 @@ export default function ChatClient({ subdomain }: { subdomain: string }) {
405412
// Handle voice transcript from voice-first interface
406413
const handleVoiceTranscript = useCallback(
407414
(transcript: string) => {
415+
logger.info('Received voice transcript:', transcript)
408416
handleSendMessage(transcript, true)
409417
},
410418
[handleSendMessage]

0 commit comments

Comments
 (0)