feat: 优化后的流式方案:双协程 + 结束哨兵 + turn/phase 元数据
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m26s
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Failing after 6m26s
This commit is contained in:
9
backend/app/agent/stream_context.py
Normal file
9
backend/app/agent/stream_context.py
Normal file
@@ -0,0 +1,9 @@
|
||||
"""流式上下文,用于在 LangGraph 节点和 agent_service 之间传递 token 队列"""
|
||||
import contextvars
|
||||
import asyncio
|
||||
from typing import Optional, Any
|
||||
|
||||
# 上下文变量:存储当前的 token 队列
|
||||
token_queue_var: contextvars.ContextVar[Optional[asyncio.Queue]] = contextvars.ContextVar(
|
||||
"token_queue", default=None
|
||||
)
|
||||
Reference in New Issue
Block a user