diff --git a/web_server.py b/web_server.py index 8704d21..45a8e7e 100644 --- a/web_server.py +++ b/web_server.py @@ -3090,12 +3090,6 @@ async def handle_task_with_sender(terminal: WebTerminal, message, sender, client 'content': f'⚠️ 修改操作存在未完成的内容:{error_message}' }) - text_streaming = False - text_started = False - text_has_content = False - full_response = "" - - # 保存思考内容(如果这是第一次迭代且有思考) if web_terminal.thinking_mode and web_terminal.api_client.current_task_first_call: web_terminal.api_client.current_task_thinking = current_thinking or "" @@ -3158,6 +3152,12 @@ async def handle_task_with_sender(terminal: WebTerminal, message, sender, client reasoning_content=current_thinking or None ) + # 为下一轮迭代重置流状态标志,但保留 full_response 供上面保存使用 + text_streaming = False + text_started = False + text_has_content = False + full_response = "" + if append_result["handled"] and append_result.get("tool_content"): tool_call_id = append_result.get("tool_call_id") or f"append_{int(time.time() * 1000)}" system_notice = format_tool_result_notice("append_to_file", tool_call_id, append_result["tool_content"])