Spaces:
Running
Running
Commit
·
9f04277
1
Parent(s):
b0d8d63
修復 app.py 中的額外問題
Browse files
app.py
CHANGED
|
@@ -1272,6 +1272,13 @@ async def websocket_endpoint_with_jwt(websocket: WebSocket, token: str = Query(N
|
|
| 1272 |
"message": str(response),
|
| 1273 |
"timestamp": time.time()
|
| 1274 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1275 |
|
| 1276 |
except json.JSONDecodeError:
|
| 1277 |
await manager.send_message("消息格式錯誤,無法解析", user_id, "error")
|
|
|
|
| 1272 |
"message": str(response),
|
| 1273 |
"timestamp": time.time()
|
| 1274 |
})
|
| 1275 |
+
|
| 1276 |
+
except Exception as e:
|
| 1277 |
+
logger.error(f"語音對話流程失敗: {e}")
|
| 1278 |
+
await websocket.send_json({
|
| 1279 |
+
"type": "error",
|
| 1280 |
+
"message": f"語音對話處理失敗: {str(e)}"
|
| 1281 |
+
})
|
| 1282 |
|
| 1283 |
except json.JSONDecodeError:
|
| 1284 |
await manager.send_message("消息格式錯誤,無法解析", user_id, "error")
|