fix(dashboard): show Gemini and Grok models in provider views
Some checks failed
CI / Check (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Formatting (push) Has been cancelled
CI / Test (push) Has been cancelled
CI / Release Build (push) Has been cancelled

This commit is contained in:
2026-03-03 10:45:14 -05:00
parent 96b49c96a5
commit b0446ad52c

View File

@@ -92,8 +92,15 @@ pub(super) async fn handle_get_providers(State(state): State<DashboardState>) ->
} }
// Find models for this provider in registry // Find models for this provider in registry
// NOTE: registry provider IDs differ from internal IDs for some providers.
let registry_key = match id {
"gemini" => "google",
"grok" => "xai",
_ => id,
};
let mut models = Vec::new(); let mut models = Vec::new();
if let Some(p_info) = registry.providers.get(id) { if let Some(p_info) = registry.providers.get(registry_key) {
models = p_info.models.keys().cloned().collect(); models = p_info.models.keys().cloned().collect();
} else if id == "ollama" { } else if id == "ollama" {
models = config.providers.ollama.models.clone(); models = config.providers.ollama.models.clone();
@@ -197,8 +204,15 @@ pub(super) async fn handle_get_provider(
} }
// Find models for this provider // Find models for this provider
// NOTE: registry provider IDs differ from internal IDs for some providers.
let registry_key = match name.as_str() {
"gemini" => "google",
"grok" => "xai",
_ => name.as_str(),
};
let mut models = Vec::new(); let mut models = Vec::new();
if let Some(p_info) = registry.providers.get(name.as_str()) { if let Some(p_info) = registry.providers.get(registry_key) {
models = p_info.models.keys().cloned().collect(); models = p_info.models.keys().cloned().collect();
} else if name == "ollama" { } else if name == "ollama" {
models = config.providers.ollama.models.clone(); models = config.providers.ollama.models.clone();
@@ -316,11 +330,18 @@ pub(super) async fn handle_test_provider(
}; };
// Pick a real model for this provider from the registry // Pick a real model for this provider from the registry
// NOTE: registry provider IDs differ from internal IDs for some providers.
let registry_key = match name.as_str() {
"gemini" => "google",
"grok" => "xai",
_ => name.as_str(),
};
let test_model = state let test_model = state
.app_state .app_state
.model_registry .model_registry
.providers .providers
.get(&name) .get(registry_key)
.and_then(|p| p.models.keys().next().cloned()) .and_then(|p| p.models.keys().next().cloned())
.unwrap_or_else(|| name.clone()); .unwrap_or_else(|| name.clone());