Spaces:
Building
Building
Update websocket_handler.py
Browse files- websocket_handler.py +9 -0
websocket_handler.py
CHANGED
@@ -624,6 +624,8 @@ async def websocket_endpoint(websocket: WebSocket, session_id: str):
|
|
624 |
if msg.get('role') == 'assistant':
|
625 |
welcome_text = msg.get('content', '')
|
626 |
log_info(f"📢 Found welcome message: {welcome_text[:50]}...", session_id=session_id)
|
|
|
|
|
627 |
|
628 |
# Send text first
|
629 |
try:
|
@@ -641,6 +643,13 @@ async def websocket_endpoint(websocket: WebSocket, session_id: str):
|
|
641 |
if tts_provider:
|
642 |
try:
|
643 |
log_info(f"🎤 Generating welcome TTS...", session_id=session_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
644 |
|
645 |
# TTS preprocessor kullan
|
646 |
from tts_preprocessor import TTSPreprocessor
|
|
|
624 |
if msg.get('role') == 'assistant':
|
625 |
welcome_text = msg.get('content', '')
|
626 |
log_info(f"📢 Found welcome message: {welcome_text[:50]}...", session_id=session_id)
|
627 |
+
|
628 |
+
await realtime_session.change_state(ConversationState.PLAYING_AUDIO)
|
629 |
|
630 |
# Send text first
|
631 |
try:
|
|
|
643 |
if tts_provider:
|
644 |
try:
|
645 |
log_info(f"🎤 Generating welcome TTS...", session_id=session_id)
|
646 |
+
|
647 |
+
# State change bildirimi gönder
|
648 |
+
await websocket.send_json({
|
649 |
+
"type": "state_change",
|
650 |
+
"from": "idle",
|
651 |
+
"to": "playing_audio"
|
652 |
+
})
|
653 |
|
654 |
# TTS preprocessor kullan
|
655 |
from tts_preprocessor import TTSPreprocessor
|