🔧 Fix tool calling + capability awareness

Three fixes:
1. OllamaProvider now sends tools[] in native /api/chat requests
2. OllamaProvider parses tool_calls from response (OpenAI-compatible
   format with function.name, function.arguments)
3. System prompt now lists available tools so LLM knows it can use
   bash, curl, read/write files — stops saying "I cannot do that"
This commit is contained in:
2026-06-11 22:55:19 +05:30
parent 5eb86e066b
commit 59ef28ffab
2 changed files with 20 additions and 3 deletions

View File

@@ -196,7 +196,7 @@ impl AgentLoop {
let mut system_prompt = self.config.system_prompt.clone();
if !agent_name.is_empty() {
system_prompt = format!(
"{}\n\n## Your Identity\n- Name: {}\n- Role: {}\n- You are speaking to: {} ({})\n\n## Memory\nYou have a verbatim dialogue log with your user. Use everything from past conversations as context when answering.",
"{}\n\n## Your Identity\n- Name: {}\n- Role: {}\n- You are speaking to: {} ({})\n\n## Your Capabilities\nYou have access to tools that let you:\n- Read, write, and edit files\n- Execute shell commands (bash) — use this for curl, git, package managers\n- Search files and directories\n- Use `bash` to run curl for web requests when needed\n\nWhen a user asks you to do something that requires external data, use your tools. Do NOT say you can't do something if you have a tool that can do it.\n\n## Memory\nYou have a verbatim dialogue log with your user. Use everything from past conversations as context when answering.",
system_prompt,
agent_name,
if agent_role.is_empty() { "AI Assistant" } else { &agent_role },