Skip to content
Closed
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ tracing = "0.1.44"
tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
tree-sitter = "0.26.9"
tree-sitter-c = "0.24.2"
uuid = "1.23.4"
23 changes: 23 additions & 0 deletions src/ai/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ pub fn classify_ai_error(error: &anyhow::Error) -> AiErrorClass {
if let Some(e) = error.downcast_ref::<crate::worker::prompts::ReviewError>() {
return e.ai_error_class();
}
if let Some(e) = error.downcast_ref::<ollama::OllamaError>() {
return e.ai_error_class();
}
AiErrorClass::Fatal
}

Expand Down Expand Up @@ -472,6 +475,25 @@ pub fn create_provider_from_ai(ai: &AiSettings) -> Result<Arc<dyn AiProvider>> {

Ok(Arc::new(provider))
}
"ollama" => {
let model = ai.model.clone();
let base_url = ai
.ollama
.as_ref()
.and_then(|c| c.base_url.clone())
.unwrap_or_else(ollama::OllamaClient::default_base_url);
let context_window = ai.ollama.as_ref().and_then(|c| c.context_window_size).unwrap_or_else(|| ollama::OllamaClient::default_context_window_for_model(&model));
let max_tokens = ai.ollama.as_ref().and_then(|c| c.max_tokens).unwrap_or(4096);
let think_mode = ai.ollama.as_ref().and_then(|c| c.think.clone());
Ok(Arc::new(ollama::OllamaClient::new(
base_url,
model,
context_window,
max_tokens,
ai.api_timeout_secs,
think_mode,
)?))
}
"claude-cli" => {
let cfg = ai.claude_cli.as_ref();
Ok(Arc::new(claude_cli::ClaudeCliProvider {
Expand Down Expand Up @@ -556,6 +578,7 @@ pub mod devin_cli;
pub mod gemini;
pub mod kiro_cli;
pub mod openai;
pub mod ollama;
pub mod proxy;
pub mod quota;
pub mod session;
Expand Down
Loading
Loading