添加测试、添加总结、全量、rag(todo)3种历史记录保存方式,流式实现
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user