diff --git a/prompt/system_prompt.md b/prompt/system_prompt.md index d740313..d98dbed 100644 --- a/prompt/system_prompt.md +++ b/prompt/system_prompt.md @@ -21,7 +21,7 @@ The filesystem backend is currently operating in: `{agent_dir_path}` - **Tools** (e.g., `rag_retrieve`, `read_file`, `bash`): Directly callable via tool_call interface with structured parameters. - **Skills** (e.g., `baidu-search`, `pdf`, `xlsx`): Multi-step workflows executed by: (1) reading SKILL.md, (2) extracting the command, (3) running it via the `bash` tool. -❌ WRONG: Generating a tool_call with `{"name": "baidu-search", "arguments": {...}}` +❌ WRONG: Generating a tool_call with `{{"name": "baidu-search", "arguments": {{...}}}}` ✅ CORRECT: Using `read_file` to read SKILL.md, then using `bash` to execute the script If you see a skill name in the "Available Skills" list, it is NEVER a tool you can call directly. diff --git a/prompt/system_prompt_deep_agent.md b/prompt/system_prompt_deep_agent.md index ecca407..01a2575 100644 --- a/prompt/system_prompt_deep_agent.md +++ b/prompt/system_prompt_deep_agent.md @@ -90,7 +90,7 @@ The todo list is a planning tool - use it judiciously to avoid overwhelming the - **Tools** (e.g., `rag_retrieve`, `read_file`, `bash`): Directly callable via tool_call interface with structured parameters. - **Skills** (e.g., `baidu-search`, `pdf`, `xlsx`): Multi-step workflows executed by: (1) reading SKILL.md, (2) extracting the command, (3) running it via the `bash` tool. -❌ WRONG: Generating a tool_call with `{"name": "baidu-search", "arguments": {...}}` +❌ WRONG: Generating a tool_call with `{{"name": "baidu-search", "arguments": {{...}}}}` ✅ CORRECT: Using `read_file` to read SKILL.md, then using `bash` to execute the script If you see a skill name in the "Available Skills" list, it is NEVER a tool you can call directly. diff --git a/routes/chat.py b/routes/chat.py index 0be1aaa..c280054 100644 --- a/routes/chat.py +++ b/routes/chat.py @@ -102,10 +102,12 @@ async def enhanced_generate_stream_response( message_tag = "TOOL_CALL" if config.tool_response: for tool_call_chunk in msg.tool_call_chunks: - if tool_call_chunk["name"]: - new_content = f"[{message_tag}] {tool_call_chunk['name']}\n" - if tool_call_chunk['args']: - new_content += tool_call_chunk['args'] + chunk_name = tool_call_chunk.get("name") if isinstance(tool_call_chunk, dict) else getattr(tool_call_chunk, "name", None) + chunk_args = tool_call_chunk.get("args") if isinstance(tool_call_chunk, dict) else getattr(tool_call_chunk, "args", None) + if chunk_name: + new_content = f"[{message_tag}] {chunk_name}\n" + if chunk_args: + new_content += chunk_args # 处理文本内容 elif msg.content: preamble_completed.set()