Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/src/ai/llms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub fn is_using_api_key_for_provider(provider: &LLMProvider, app: &AppContext) -
LLMProvider::OpenAI => api_keys.is_some_and(|keys| keys.openai.is_some()),
LLMProvider::Anthropic => api_keys.is_some_and(|keys| keys.anthropic.is_some()),
LLMProvider::Google => api_keys.is_some_and(|keys| keys.google.is_some()),
LLMProvider::Ollama => api_keys.is_some_and(|keys| keys.ollama_url.is_some()),
_ => false,
}
}
Expand Down Expand Up @@ -89,6 +90,7 @@ pub enum LLMProvider {
Anthropic,
Google,
Xai,
Ollama,
Unknown,
}

Expand All @@ -100,6 +102,7 @@ impl LLMProvider {
LLMProvider::Anthropic => Some(Icon::ClaudeLogo),
LLMProvider::Google => Some(Icon::GeminiLogo),
LLMProvider::Xai => None,
LLMProvider::Ollama => None, // TODO: Add Ollama icon
LLMProvider::Unknown => None,
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/ai/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ derivative.workspace = true
warp_core.workspace = true
warp_terminal.workspace = true
warp_util.workspace = true
reqwest.workspace = true
chrono.workspace = true
persistence.workspace = true
priority-queue = "2.3.1"
Expand Down
11 changes: 11 additions & 0 deletions crates/ai/src/api_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub struct ApiKeys {
pub anthropic: Option<String>,
pub openai: Option<String>,
pub open_router: Option<String>,
/// Ollama URL (e.g., "http://localhost:11434"). No API key needed.
pub ollama_url: Option<String>,
}

impl ApiKeys {
Expand All @@ -30,6 +32,7 @@ impl ApiKeys {
|| self.anthropic.is_some()
|| self.google.is_some()
|| self.open_router.is_some()
|| self.ollama_url.is_some()
}
}

Expand Down Expand Up @@ -93,6 +96,12 @@ impl ApiKeyManager {
self.write_keys_to_secure_storage(ctx);
}

pub fn set_ollama_url(&mut self, url: Option<String>, ctx: &mut ModelContext<Self>) {
self.keys.ollama_url = url;
ctx.emit(ApiKeyManagerEvent::KeysUpdated);
self.write_keys_to_secure_storage(ctx);
}

pub fn set_aws_credentials_state(
&mut self,
state: AwsCredentialsState,
Expand Down Expand Up @@ -138,6 +147,8 @@ impl ApiKeyManager {
.then(|| self.keys.open_router.clone())
.flatten()
.unwrap_or_default();
// NOTE: ollama_url is NOT included here because it's a local endpoint
// and should never be sent through remote request settings.
// Also include credentials when running with OIDC-managed Bedrock inference, regardless
// of the per-user setting flag (which only applies to the local credential chain path).
let include_aws = include_aws_bedrock_credentials
Expand Down
1 change: 1 addition & 0 deletions crates/ai/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pub mod agent;
pub mod api_keys;
pub mod aws_credentials;
pub mod llm_id;
pub mod ollama_client;

pub use llm_id::LLMId;
pub mod diff_validation;
Expand Down
Loading