Update backend/routes/websocket.py
Browse files- backend/routes/websocket.py +13 -0
backend/routes/websocket.py
CHANGED
|
@@ -380,6 +380,9 @@ async def send_to_client(websocket: WebSocket, gemini: GeminiConnection, client_
|
|
| 380 |
gemini_text = msg.get("gemini_text")
|
| 381 |
audio = msg.get("audio")
|
| 382 |
mime_type = msg.get("mime_type", "audio/pcm")
|
|
|
|
|
|
|
|
|
|
| 383 |
|
| 384 |
if user_text:
|
| 385 |
print(f"[DEBUG][{client_id}] ๐๏ธ User: {user_text[:100]}")
|
|
@@ -398,6 +401,16 @@ async def send_to_client(websocket: WebSocket, gemini: GeminiConnection, client_
|
|
| 398 |
}
|
| 399 |
)
|
| 400 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
except RuntimeError as e:
|
| 402 |
if "websocket.send" in str(e):
|
| 403 |
print(f"[DEBUG][{client_id}] ๐ WebSocket closed, stopping send loop")
|
|
|
|
| 380 |
gemini_text = msg.get("gemini_text")
|
| 381 |
audio = msg.get("audio")
|
| 382 |
mime_type = msg.get("mime_type", "audio/pcm")
|
| 383 |
+
interrupted = msg.get("interrupted")
|
| 384 |
+
turn_complete = msg.get("turn_complete")
|
| 385 |
+
generation_complete = msg.get("generation_complete")
|
| 386 |
|
| 387 |
if user_text:
|
| 388 |
print(f"[DEBUG][{client_id}] ๐๏ธ User: {user_text[:100]}")
|
|
|
|
| 401 |
}
|
| 402 |
)
|
| 403 |
|
| 404 |
+
if interrupted:
|
| 405 |
+
print(f"[DEBUG][{client_id}] โ ๏ธ Generation interrupted")
|
| 406 |
+
await websocket.send_json({"type": "interrupted"})
|
| 407 |
+
if turn_complete:
|
| 408 |
+
print(f"[DEBUG][{client_id}] ๐ Turn complete")
|
| 409 |
+
await websocket.send_json({"type": "turn_complete"})
|
| 410 |
+
if generation_complete:
|
| 411 |
+
print(f"[DEBUG][{client_id}] โ
Generation complete")
|
| 412 |
+
await websocket.send_json({"type": "generation_complete"})
|
| 413 |
+
|
| 414 |
except RuntimeError as e:
|
| 415 |
if "websocket.send" in str(e):
|
| 416 |
print(f"[DEBUG][{client_id}] ๐ WebSocket closed, stopping send loop")
|