diff --git a/wechat-bot/bot/agent_client.py b/wechat-bot/bot/agent_client.py index ad60ea3..4262078 100644 --- a/wechat-bot/bot/agent_client.py +++ b/wechat-bot/bot/agent_client.py @@ -120,6 +120,7 @@ async def call_agent_stream( stream_id = generate_req_id("stream") full_text = "" has_sent_final = False + has_sent_thinking = False async for line in response.aiter_lines(): if not line.startswith("data: "): @@ -148,12 +149,13 @@ async def call_agent_stream( continue full_text += text - # 实时推送"正在思考"状态 - if full_text and not has_sent_final: + # 只发送一次"正在思考"状态 + if full_text and not has_sent_thinking and not has_sent_final: try: await ws_client.reply_stream( frame, stream_id, "💭 正在思考...", False ) + has_sent_thinking = True except Exception: pass