feat(park): 子应用 lifespan 接入 s2s 实时语音栈(S2S_ENABLED=1 时后台起 :8765)
导入 .s2s_bridge.start_s2s_backend 并以 stop 事件控制;依赖 speech_to_speech (vendor/s2s-cloud),启用前需 uv pip install -e app/park/vendor/s2s-cloud。
This commit is contained in:
@@ -33,6 +33,15 @@ async def lifespan(app: FastAPI):
|
||||
|
||||
stop = threading.Event()
|
||||
|
||||
# s2s 实时语音栈(可选):后台线程起 RealtimeServer(:8765),仅 S2S_ENABLED=1
|
||||
# 依赖 speech_to_speech(vendor/s2s-cloud,需先 `uv pip install -e app/park/vendor/s2s-cloud`)
|
||||
if settings.S2S_ENABLED:
|
||||
try:
|
||||
from .s2s_bridge import start_s2s_backend
|
||||
start_s2s_backend(stop)
|
||||
except Exception as e: # noqa: BLE001
|
||||
log.warning("s2s 语音栈启动失败(S2S_ENABLED=1 但依赖未装?): %s", e)
|
||||
|
||||
def tick_loop():
|
||||
while not stop.is_set():
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user