Spaces:
Building
Building
Update websocket_handler.py
Browse files- websocket_handler.py +9 -10
websocket_handler.py
CHANGED
@@ -641,15 +641,13 @@ async def process_user_input(websocket: WebSocket, session: RealtimeSession):
|
|
641 |
|
642 |
user_text = session.current_transcription
|
643 |
if not user_text:
|
644 |
-
log_warning(f"⚠️ Empty transcription,
|
645 |
-
|
646 |
-
await session.change_state(ConversationState.
|
647 |
return
|
648 |
|
649 |
log_info(f"🎯 Processing user input", text=user_text, session_id=session.session.session_id)
|
650 |
|
651 |
-
# State zaten PROCESSING_STT olarak set edildi, direkt devam et
|
652 |
-
|
653 |
# Send final transcription
|
654 |
if session.is_websocket_active:
|
655 |
await websocket.send_json({
|
@@ -716,14 +714,14 @@ async def process_user_input(websocket: WebSocket, session: RealtimeSession):
|
|
716 |
except asyncio.CancelledError:
|
717 |
log_info("⚡ TTS cancelled due to barge-in", session_id=session.session.session_id)
|
718 |
else:
|
719 |
-
log_info(f"⚠️ No TTS provider or WebSocket inactive
|
720 |
-
# No TTS, go back to
|
721 |
-
await session.change_state(ConversationState.
|
722 |
if session.is_websocket_active:
|
723 |
await websocket.send_json({
|
724 |
"type": "state_change",
|
725 |
"from": "processing_llm",
|
726 |
-
"to": "
|
727 |
})
|
728 |
|
729 |
except Exception as e:
|
@@ -739,7 +737,8 @@ async def process_user_input(websocket: WebSocket, session: RealtimeSession):
|
|
739 |
"message": f"Processing error: {str(e)}"
|
740 |
})
|
741 |
await session.reset_for_new_utterance()
|
742 |
-
|
|
|
743 |
|
744 |
async def generate_and_stream_tts(
|
745 |
websocket: WebSocket,
|
|
|
641 |
|
642 |
user_text = session.current_transcription
|
643 |
if not user_text:
|
644 |
+
log_warning(f"⚠️ Empty transcription, continuing listening", session_id=session.session.session_id)
|
645 |
+
# Boş transcription'da bile listening'de kal
|
646 |
+
await session.change_state(ConversationState.LISTENING)
|
647 |
return
|
648 |
|
649 |
log_info(f"🎯 Processing user input", text=user_text, session_id=session.session.session_id)
|
650 |
|
|
|
|
|
651 |
# Send final transcription
|
652 |
if session.is_websocket_active:
|
653 |
await websocket.send_json({
|
|
|
714 |
except asyncio.CancelledError:
|
715 |
log_info("⚡ TTS cancelled due to barge-in", session_id=session.session.session_id)
|
716 |
else:
|
717 |
+
log_info(f"⚠️ No TTS provider or WebSocket inactive", session_id=session.session.session_id)
|
718 |
+
# No TTS, go back to listening
|
719 |
+
await session.change_state(ConversationState.LISTENING)
|
720 |
if session.is_websocket_active:
|
721 |
await websocket.send_json({
|
722 |
"type": "state_change",
|
723 |
"from": "processing_llm",
|
724 |
+
"to": "listening"
|
725 |
})
|
726 |
|
727 |
except Exception as e:
|
|
|
737 |
"message": f"Processing error: {str(e)}"
|
738 |
})
|
739 |
await session.reset_for_new_utterance()
|
740 |
+
# Hata durumunda bile listening'e dön
|
741 |
+
await session.change_state(ConversationState.LISTENING)
|
742 |
|
743 |
async def generate_and_stream_tts(
|
744 |
websocket: WebSocket,
|