Forward bot playback acknowledgements to SSE status stream.
Handle ttsPlaybackAck websocket messages and emit ttsDeliveryStatus updates with playback_* states for UI diagnostics. Made-with: Cursor
This commit is contained in:
parent
25854edb4d
commit
1c00ab6024
1 changed files with 17 additions and 0 deletions
|
|
@ -348,6 +348,23 @@ class TeamsbotService:
|
|||
elif msgType == "ping":
|
||||
await websocket.send_text(json.dumps({"type": "pong"}))
|
||||
|
||||
elif msgType == "ttsPlaybackAck":
|
||||
playback = message.get("playback", {}) or {}
|
||||
status = playback.get("status", "unknown")
|
||||
ackMessage = playback.get("message") or "Bot playback status update"
|
||||
logger.info(
|
||||
f"[WS] TTS playback ack: status={status}, format={playback.get('format')}, "
|
||||
f"bytesBase64={playback.get('bytesBase64')}"
|
||||
)
|
||||
await _emitSessionEvent(sessionId, "ttsDeliveryStatus", {
|
||||
"status": f"playback_{status}",
|
||||
"hasWebSocket": True,
|
||||
"message": ackMessage,
|
||||
"timestamp": playback.get("timestamp") or getIsoTimestamp(),
|
||||
"format": playback.get("format"),
|
||||
"bytesBase64": playback.get("bytesBase64"),
|
||||
})
|
||||
|
||||
except Exception as e:
|
||||
if "disconnect" not in str(e).lower():
|
||||
logger.error(f"[WS] Error for session {sessionId}: {type(e).__name__}: {e}")
|
||||
|
|
|
|||
Loading…
Reference in a new issue