feat: stream dual-agent answers over sse

This commit is contained in:
gqt
2026-07-13 11:43:23 +08:00
parent 321cf13c16
commit 84e6f1f51a
6 changed files with 269 additions and 2 deletions
+3
View File
@@ -7,6 +7,7 @@ from fastapi import FastAPI
from pymilvus import MilvusClient
from kbqa.config import get_settings
from kbqa.chat.service import ChatService
from kbqa.database import Database
from kbqa.documents.service import DocumentService
from kbqa.indexing.worker import IndexWorker
@@ -53,6 +54,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
vector_store,
vector_mutation_lock,
)
chat_service = ChatService(settings, database.session_factory, retriever)
app.state.settings = settings
app.state.database = database
app.state.milvus_client = milvus_client
@@ -61,6 +63,7 @@ async def lifespan(app: FastAPI) -> AsyncIterator[None]:
app.state.retriever = retriever
app.state.index_worker = worker
app.state.document_service = document_service
app.state.chat_service = chat_service
await worker.start()
await document_service.recover_deletions()
try: