feat: 站点 JSON、语音终端 WebSocket 指派与客户端联调

- 用 OR_SITE_CONFIG_JSON_FILE 统一术间配置(video_rtsp_urls + voice_or_room_bindings)
- VoiceTerminalHub:assignment、WS 推送与 HTTP 查询;开录/停录后 notify
- 一键联调 orchestrate-and-start 与 /client/surgeries/start 共用指派逻辑,修复 demo 路径不发 WS
- 语音桌面端:SIGINT 退出、shutdown 清理、仅 WS 指派、固定 pending 轮询间隔、界面仅保留录音时长
- 新增/调整契约与绑定测试,文档与示例配置同步

Made-with: Cursor
This commit is contained in:
Kevin
2026-04-27 11:21:16 +08:00
parent 4c3f9a367b
commit 6b3adb4ad8
36 changed files with 1194 additions and 162 deletions

View File

@@ -6,7 +6,6 @@ process is gone — reconnect or re-orchestrate for another playthrough.
from __future__ import annotations
import json
import os
import shutil
import socket
@@ -222,25 +221,3 @@ class SyntheticRtspManager:
self._active = run
return run, url_map
def write_rtsp_url_json_file(
path: Path,
url_map: dict[str, str],
*,
replace_host: str,
) -> None:
"""Write JSON map; replace 127.0.0.1 in values with `replace_host` (e.g. host.docker.internal)."""
if replace_host in ("", "127.0.0.1"):
out = url_map
else:
out = {
k: v.replace("127.0.0.1", replace_host, 1)
for k, v in url_map.items()
}
path.parent.mkdir(parents=True, exist_ok=True)
text = json.dumps(out, ensure_ascii=False, indent=2, sort_keys=True) + "\n"
temp = path.with_name(path.name + ".tmp")
temp.write_text(text, encoding="utf-8")
temp.replace(path)
logger.info("Wrote RTSP map to {}", path)