Add analysis feature
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
/api/webrtc/ice-servers WebRTC STUN/TURN 配置
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
|
||||
# NLTK 3.9+ blocks dependency imports when .venv lives under cwd (local dev layout).
|
||||
@@ -24,6 +25,7 @@ import settings
|
||||
import uvicorn
|
||||
from db.session import sync_default_tools, sync_interface_definitions
|
||||
from services.knowledge import recover_interrupted_documents
|
||||
from services.post_call.worker import recover_interrupted_analyses, run_analysis_worker
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
@@ -48,9 +50,15 @@ async def lifespan(_app: FastAPI):
|
||||
await sync_interface_definitions()
|
||||
await sync_default_tools()
|
||||
await recover_interrupted_documents()
|
||||
await recover_interrupted_analyses()
|
||||
analysis_worker = asyncio.create_task(
|
||||
run_analysis_worker(), name="post-call-analysis-worker"
|
||||
)
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
analysis_worker.cancel()
|
||||
await asyncio.gather(analysis_worker, return_exceptions=True)
|
||||
await voice_webrtc.shutdown_active_sessions()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user