feat: 实现真正的 LLM 流式 token 发送
Some checks failed
构建并部署 AI Agent 服务 / deploy (push) Has been cancelled

This commit is contained in:
2026-05-07 02:05:23 +08:00
parent 6332e30d2f
commit 6d7f8758d2
3 changed files with 176 additions and 69 deletions

View 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
)