fix: provider routing uses provider_type, Active badge, fmt
Some checks failed
Auto Tag / auto-tag (push) Successful in 3s
Test / rust-fmt-check (push) Successful in 58s
Release / build-macos-arm64 (push) Successful in 4m13s
Test / rust-clippy (push) Successful in 7m25s
Release / build-linux-amd64 (push) Has been cancelled
Release / build-windows-amd64 (push) Has been cancelled
Release / build-linux-arm64 (push) Has been cancelled
Test / rust-tests (push) Successful in 8m11s
Test / frontend-typecheck (push) Successful in 1m33s
Test / frontend-tests (push) Successful in 1m16s
Some checks failed
Auto Tag / auto-tag (push) Successful in 3s
Test / rust-fmt-check (push) Successful in 58s
Release / build-macos-arm64 (push) Successful in 4m13s
Test / rust-clippy (push) Successful in 7m25s
Release / build-linux-amd64 (push) Has been cancelled
Release / build-windows-amd64 (push) Has been cancelled
Release / build-linux-arm64 (push) Has been cancelled
Test / rust-tests (push) Successful in 8m11s
Test / frontend-typecheck (push) Successful in 1m33s
Test / frontend-tests (push) Successful in 1m16s
This commit is contained in:
parent
652418017c
commit
74afb47eac
@ -15,7 +15,13 @@ pub trait Provider: Send + Sync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn create_provider(config: &ProviderConfig) -> Box<dyn Provider> {
|
pub fn create_provider(config: &ProviderConfig) -> Box<dyn Provider> {
|
||||||
match config.name.as_str() {
|
// Match on provider_type (the kind), falling back to name for legacy configs
|
||||||
|
let kind = if config.provider_type.is_empty() {
|
||||||
|
config.name.as_str()
|
||||||
|
} else {
|
||||||
|
config.provider_type.as_str()
|
||||||
|
};
|
||||||
|
match kind {
|
||||||
"anthropic" => Box::new(crate::ai::anthropic::AnthropicProvider),
|
"anthropic" => Box::new(crate::ai::anthropic::AnthropicProvider),
|
||||||
"gemini" => Box::new(crate::ai::gemini::GeminiProvider),
|
"gemini" => Box::new(crate::ai::gemini::GeminiProvider),
|
||||||
"mistral" => Box::new(crate::ai::mistral::MistralProvider),
|
"mistral" => Box::new(crate::ai::mistral::MistralProvider),
|
||||||
|
|||||||
@ -11,7 +11,11 @@ pub async fn check_ollama() -> anyhow::Result<OllamaStatus> {
|
|||||||
let which_result = std::process::Command::new(which_cmd).arg("ollama").output();
|
let which_result = std::process::Command::new(which_cmd).arg("ollama").output();
|
||||||
|
|
||||||
// Check common install paths explicitly — Tauri's process PATH may omit /usr/local/bin
|
// Check common install paths explicitly — Tauri's process PATH may omit /usr/local/bin
|
||||||
let in_common_path = ["/usr/local/bin/ollama", "/opt/homebrew/bin/ollama", "/usr/bin/ollama"]
|
let in_common_path = [
|
||||||
|
"/usr/local/bin/ollama",
|
||||||
|
"/opt/homebrew/bin/ollama",
|
||||||
|
"/usr/bin/ollama",
|
||||||
|
]
|
||||||
.iter()
|
.iter()
|
||||||
.any(|p| std::path::Path::new(p).exists());
|
.any(|p| std::path::Path::new(p).exists());
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,8 @@ use std::sync::{Arc, Mutex};
|
|||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct ProviderConfig {
|
pub struct ProviderConfig {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
#[serde(default)]
|
||||||
|
pub provider_type: String,
|
||||||
pub api_url: String,
|
pub api_url: String,
|
||||||
pub api_key: String,
|
pub api_key: String,
|
||||||
pub model: String,
|
pub model: String,
|
||||||
|
|||||||
@ -136,7 +136,7 @@ export default function AIProviders() {
|
|||||||
<span className="text-sm font-medium">{provider.name}</span>
|
<span className="text-sm font-medium">{provider.name}</span>
|
||||||
<Badge variant="secondary">{provider.provider_type}</Badge>
|
<Badge variant="secondary">{provider.provider_type}</Badge>
|
||||||
{active_provider === provider.name && (
|
{active_provider === provider.name && (
|
||||||
<Badge className="bg-green-600 text-white">Active</Badge>
|
<Badge variant="success">Active</Badge>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-muted-foreground">
|
<p className="text-xs text-muted-foreground">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user