From 03aa2dd25a9d4b5f4c3a289e72035db4f11fbcd7 Mon Sep 17 00:00:00 2001 From: WaiHou Ng Date: Mon, 9 Feb 2026 11:17:31 +0800 Subject: [PATCH] fix(bug): Fix ollama configuration --- src/kota_code/agent/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/kota_code/agent/mod.rs b/src/kota_code/agent/mod.rs index c52f820..4f338ed 100644 --- a/src/kota_code/agent/mod.rs +++ b/src/kota_code/agent/mod.rs @@ -1,7 +1,7 @@ -use anyhow::Result; +use anyhow::{Ok, Result}; use rig::{ agent::Agent, - client::CompletionClient, + client::{CompletionClient, ProviderClient}, providers::{ anthropic, cohere, deepseek::{self, DEEPSEEK_CHAT}, @@ -409,7 +409,7 @@ impl AgentBuilder { Provider::Ollama => { build_agent!( ollama::Client::new(rig::client::Nothing), - &self.model_name, + self.model_name.strip_prefix("ollama-").unwrap(), preamble, self.tool_registry.take_all(), Ollama @@ -459,7 +459,9 @@ impl AgentBuilder { // DeepSeek models name if name.starts_with("deepseek-") => Ok(Provider::DeepSeek), - "ollama" | "local" => Ok(Provider::Ollama), + + // Models by ollama + name if name.starts_with("ollama-") => Ok(Provider::Ollama), _ => Err(anyhow::anyhow!( "Unknown model: {}. Please specify a supported model.",