mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-13 02:54:48 +08:00
refactor(项目): 尝试 Python 语音识别和内容发送
This commit is contained in:
@@ -11,10 +11,6 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Received: {\"message\":\"Electron Initialized\"}\n",
|
||||
"Received: {\"command\":\"process_data\",\"payload\":{\"some\":\"data\"}}\n",
|
||||
"Client disconnected\n",
|
||||
"Received: {\"message\":\"Electron Initialized\"}\n",
|
||||
"Received: {\"command\":\"process_data\",\"payload\":{\"some\":\"data\"}}\n",
|
||||
"Client disconnected\n"
|
||||
]
|
||||
}
|
||||
@@ -23,6 +19,7 @@
|
||||
"import asyncio\n",
|
||||
"import websockets\n",
|
||||
"import nest_asyncio\n",
|
||||
"import json\n",
|
||||
"\n",
|
||||
"# 应用补丁,允许在 Jupyter 中运行嵌套事件循环\n",
|
||||
"nest_asyncio.apply()\n",
|
||||
@@ -31,7 +28,7 @@
|
||||
" try:\n",
|
||||
" async for message in websocket:\n",
|
||||
" print(f\"Received: {message}\")\n",
|
||||
" await websocket.send(f\"Echo: {message}\")\n",
|
||||
" await websocket.send(json.dumps({\"message\": \"Hello from server!\"}))\n",
|
||||
" except websockets.exceptions.ConnectionClosed:\n",
|
||||
" print(\"Client disconnected\")\n",
|
||||
"\n",
|
||||
|
||||
Reference in New Issue
Block a user