Fix orchestration provider labels and checkbox theme colors
This commit is contained in:
@@ -28,6 +28,7 @@ use crate::ai::execution_profiles::{
|
|||||||
};
|
};
|
||||||
use crate::ai::llms::{
|
use crate::ai::llms::{
|
||||||
DisableReason, LLMContextWindow, LLMId, LLMInfo, LLMPreferences, LLMPreferencesEvent,
|
DisableReason, LLMContextWindow, LLMId, LLMInfo, LLMPreferences, LLMPreferencesEvent,
|
||||||
|
LLMProvider,
|
||||||
};
|
};
|
||||||
use crate::cloud_object::model::generic_string_model::StringModel;
|
use crate::cloud_object::model::generic_string_model::StringModel;
|
||||||
use crate::editor::{
|
use crate::editor::{
|
||||||
@@ -556,7 +557,10 @@ impl ExecutionProfileEditorView {
|
|||||||
self.command_allowlist_mouse_state_handles = current_permissions.command_allowlist.iter().map(|_| Default::default()).collect();
|
self.command_allowlist_mouse_state_handles = current_permissions.command_allowlist.iter().map(|_| Default::default()).collect();
|
||||||
let mut names: Vec<_> = LLMPreferences::as_ref(app).get_base_llm_choices_for_agent_mode(app)
|
let mut names: Vec<_> = LLMPreferences::as_ref(app).get_base_llm_choices_for_agent_mode(app)
|
||||||
.filter(|model| !matches!(model.id.as_str(), "none" | "placeholder") && !crate::ai::custom_model_routers::is_custom_router_id(model.id.as_str()))
|
.filter(|model| !matches!(model.id.as_str(), "none" | "placeholder") && !crate::ai::custom_model_routers::is_custom_router_id(model.id.as_str()))
|
||||||
.filter_map(|model| model.description.clone()).collect();
|
// Cloud catalog descriptions name vendors, not configured connections.
|
||||||
|
// Direct registry models already carry the user's connection name.
|
||||||
|
.filter(|model| matches!(model.provider, LLMProvider::LiteLLM | LLMProvider::Bedrock | LLMProvider::Acp))
|
||||||
|
.map(|model| LLMPreferences::as_ref(app).orchestration_provider_name(model).to_string()).collect();
|
||||||
names.extend(AISettings::as_ref(app).openai_providers.value().iter().map(|provider| provider.name.clone()));
|
names.extend(AISettings::as_ref(app).openai_providers.value().iter().map(|provider| provider.name.clone()));
|
||||||
names.retain(|name| !name.trim().is_empty());
|
names.retain(|name| !name.trim().is_empty());
|
||||||
names.sort(); names.dedup();
|
names.sort(); names.dedup();
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ fn render_orchestration_providers(
|
|||||||
let checkbox = appearance.ui_builder()
|
let checkbox = appearance.ui_builder()
|
||||||
.checkbox(view.all_providers_checkbox.clone(), Some(14.))
|
.checkbox(view.all_providers_checkbox.clone(), Some(14.))
|
||||||
.with_label(Span::new("All providers", Default::default()))
|
.with_label(Span::new("All providers", Default::default()))
|
||||||
.with_style(UiComponentStyles { foreground: Some(appearance.theme().active_ui_text_color().into()), ..Default::default() })
|
.with_label_style(UiComponentStyles { font_color: Some(appearance.theme().active_ui_text_color()), ..Default::default() })
|
||||||
.check(all)
|
.check(all)
|
||||||
.build()
|
.build()
|
||||||
.on_click(move |ctx, _, _| {
|
.on_click(move |ctx, _, _| {
|
||||||
@@ -671,7 +671,7 @@ fn render_orchestration_providers(
|
|||||||
let checkbox = appearance.ui_builder()
|
let checkbox = appearance.ui_builder()
|
||||||
.checkbox(state.clone(), Some(14.))
|
.checkbox(state.clone(), Some(14.))
|
||||||
.with_label(Span::new(name.clone(), Default::default()))
|
.with_label(Span::new(name.clone(), Default::default()))
|
||||||
.with_style(UiComponentStyles { foreground: Some(appearance.theme().active_ui_text_color().into()), ..Default::default() })
|
.with_label_style(UiComponentStyles { font_color: Some(appearance.theme().active_ui_text_color()), ..Default::default() })
|
||||||
.check(included)
|
.check(included)
|
||||||
.build()
|
.build()
|
||||||
.on_click(move |ctx, _, _| {
|
.on_click(move |ctx, _, _| {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ pub struct Checkbox {
|
|||||||
|
|
||||||
/// Optional, clickable text rendered to the right of the checkbox
|
/// Optional, clickable text rendered to the right of the checkbox
|
||||||
label: Option<Span>,
|
label: Option<Span>,
|
||||||
|
label_styles: UiComponentStyles,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UiComponent for Checkbox {
|
impl UiComponent for Checkbox {
|
||||||
@@ -46,7 +47,12 @@ impl UiComponent for Checkbox {
|
|||||||
.with_cross_axis_alignment(crate::elements::CrossAxisAlignment::Center)
|
.with_cross_axis_alignment(crate::elements::CrossAxisAlignment::Center)
|
||||||
.with_child(checkbox)
|
.with_child(checkbox)
|
||||||
.with_child(
|
.with_child(
|
||||||
Container::new(label.with_style(self.styles(state)).build().finish())
|
Container::new(
|
||||||
|
label
|
||||||
|
.with_style(self.styles(state).merge(self.label_styles))
|
||||||
|
.build()
|
||||||
|
.finish(),
|
||||||
|
)
|
||||||
.with_margin_left(LABEL_LEFT_MARGIN)
|
.with_margin_left(LABEL_LEFT_MARGIN)
|
||||||
.finish(),
|
.finish(),
|
||||||
)
|
)
|
||||||
@@ -102,6 +108,7 @@ impl Checkbox {
|
|||||||
disabled: false,
|
disabled: false,
|
||||||
checked: false,
|
checked: false,
|
||||||
label: None,
|
label: None,
|
||||||
|
label_styles: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,6 +127,12 @@ impl Checkbox {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Styles the label independently of the checkbox and its checkmark.
|
||||||
|
pub fn with_label_style(mut self, styles: UiComponentStyles) -> Self {
|
||||||
|
self.label_styles = styles;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
fn styles(&self, state: &MouseState) -> UiComponentStyles {
|
fn styles(&self, state: &MouseState) -> UiComponentStyles {
|
||||||
let styles = if self.disabled {
|
let styles = if self.disabled {
|
||||||
self.disabled_styles
|
self.disabled_styles
|
||||||
|
|||||||
Reference in New Issue
Block a user