添加测试、添加总结、全量、rag(todo)3种历史记录保存方式,流式实现

This commit is contained in:
2026-05-05 03:01:20 +08:00
parent 2050a30a52
commit adb59da06d
46 changed files with 4484 additions and 882 deletions

View File

@@ -266,9 +266,11 @@ async def _handle_stream_chat(
# ✅ 发送激活的世界书条目信息在LLM调用前
if active_entries:
print(f"[StreamChat] 📤 发送世界书激活信息: {len(active_entries)} 个条目")
# 将 Pydantic 模型转换为字典
entries_dict = [entry.model_dump() for entry in active_entries]
await websocket.send_json({
"type": "worldbook_active",
"entries": active_entries
"entries": entries_dict
})
# ✅ TODO: RAG检索暂时为空待实现
@@ -310,7 +312,7 @@ async def _handle_stream_chat(
})
# ✅ 第3步调用LLM流式生成
chunk_count = 0
chunk_count = [0] # 使用列表以便在闭包中修改
result = await workflow_service.process_chat_request_stream(
request_data,
on_chunk=lambda chunk: asyncio.create_task(