Add Rig native model providers

This commit is contained in:
2026-08-06 15:03:00 -05:00
parent 634ce7ba00
commit 3fda5d414b
34 changed files with 2134 additions and 452 deletions
+9 -120
View File
@@ -1,17 +1,13 @@
use galaxy_core::features::FeatureFlag;
use galaxy_core::report_if_error;
use galaxy_core::settings::ToggleableSetting as _;
use galaxyui::fonts::Weight;
use galaxyui::keymap::ContextPredicate;
use galaxyui::ui_components::button::ButtonVariant;
use galaxyui::ui_components::components::{Coords, UiComponent, UiComponentStyles};
use galaxyui::ui_components::components::UiComponent;
use galaxyui::ui_components::switch::SwitchStateHandle;
use galaxyui::{
id, Action, AppContext, Entity, SingletonEntity, TypedActionView, View, ViewContext, ViewHandle,
};
use warpui::elements::{
Container, Element, Flex, MouseStateHandle, ParentElement, Shrinkable, Text,
};
use warpui::elements::{Element, MouseStateHandle};
use super::settings_page::{
render_body_item, AdditionalInfo, MatchData, PageType, SettingsPageMeta,
@@ -22,13 +18,11 @@ use super::{
SettingsAction, SettingsSection, ToggleSettingActionPair, ToggleState,
};
use crate::appearance::Appearance;
use crate::auth::AuthStateProvider;
use crate::drive::settings::WarpDriveSettings;
#[derive(Debug, Clone)]
pub enum WarpDriveSettingsPageAction {
ToggleShowWarpDrive,
SignUp,
OpenUrl(String),
}
@@ -44,8 +38,8 @@ pub fn init_actions_from_parent_view<T: Action + Clone>(
WarpDriveSettingsPageAction::ToggleShowWarpDrive,
)),
SettingActionPairContexts::new(
context.clone() & !id!(flags::ENABLE_WARP_DRIVE) & !id!("IsAnonymousUser"),
context.clone() & id!(flags::ENABLE_WARP_DRIVE) & !id!("IsAnonymousUser"),
context.clone() & !id!(flags::ENABLE_WARP_DRIVE),
context.clone() & id!(flags::ENABLE_WARP_DRIVE),
),
None,
)
@@ -54,10 +48,6 @@ pub fn init_actions_from_parent_view<T: Action + Clone>(
);
}
pub enum WarpDriveSettingsPageEvent {
SignUp,
}
pub struct WarpDriveSettingsPageView {
page: PageType<Self>,
}
@@ -66,10 +56,7 @@ impl WarpDriveSettingsPageView {
pub fn new(_ctx: &mut ViewContext<Self>) -> Self {
Self {
page: PageType::new_uncategorized(
vec![
Box::new(WarpDriveHeaderWidget::default()),
Box::new(WarpDriveToggleWidget::default()),
],
vec![Box::new(WarpDriveToggleWidget::default())],
None,
),
}
@@ -77,7 +64,7 @@ impl WarpDriveSettingsPageView {
}
impl Entity for WarpDriveSettingsPageView {
type Event = WarpDriveSettingsPageEvent;
type Event = ();
}
impl TypedActionView for WarpDriveSettingsPageView {
@@ -91,9 +78,6 @@ impl TypedActionView for WarpDriveSettingsPageView {
});
ctx.notify();
}
WarpDriveSettingsPageAction::SignUp => {
ctx.emit(WarpDriveSettingsPageEvent::SignUp);
}
WarpDriveSettingsPageAction::OpenUrl(url) => {
ctx.open_url(url.as_str());
}
@@ -139,88 +123,6 @@ impl From<ViewHandle<WarpDriveSettingsPageView>> for SettingsPageViewHandle {
}
}
#[derive(Default)]
struct WarpDriveHeaderWidget {
sign_up_button: MouseStateHandle,
}
impl SettingsWidget for WarpDriveHeaderWidget {
type View = WarpDriveSettingsPageView;
fn search_terms(&self) -> &str {
"warp drive sign up"
}
fn should_render(&self, app: &AppContext) -> bool {
FeatureFlag::SkipFirebaseAnonymousUser.is_enabled()
&& AuthStateProvider::as_ref(app)
.get()
.is_anonymous_or_logged_out()
}
fn render(
&self,
_view: &Self::View,
appearance: &Appearance,
_app: &AppContext,
) -> Box<dyn Element> {
let ui_builder = appearance.ui_builder();
let message = Container::new(
Text::new_inline(
"To use Galaxy Drive, please create an account.".to_string(),
appearance.ui_font_family(),
14.,
)
.with_color(
appearance
.theme()
.sub_text_color(appearance.theme().surface_2())
.into_solid(),
)
.finish(),
)
.with_margin_right(16.)
.finish();
let button = Container::new(
ui_builder
.button(ButtonVariant::Accent, self.sign_up_button.clone())
.with_style(UiComponentStyles {
font_size: Some(14.),
font_weight: Some(Weight::Semibold),
border_radius: Some(galaxyui::elements::CornerRadius::with_all(
galaxyui::elements::Radius::Pixels(4.),
)),
padding: Some(Coords {
top: 8.,
bottom: 8.,
left: 24.,
right: 24.,
}),
..Default::default()
})
.with_text_label("Sign up".to_owned())
.build()
.on_click(move |ctx, _, _| {
ctx.dispatch_typed_action(WarpDriveSettingsPageAction::SignUp);
})
.finish(),
)
.finish();
Container::new(
Flex::row()
.with_cross_axis_alignment(galaxyui::elements::CrossAxisAlignment::Center)
.with_child(Shrinkable::new(1., message).finish())
.with_child(button)
.finish(),
)
.with_padding_bottom(15.)
.finish()
}
}
#[derive(Default)]
struct WarpDriveToggleWidget {
switch_state: SwitchStateHandle,
@@ -241,10 +143,6 @@ impl SettingsWidget for WarpDriveToggleWidget {
app: &AppContext,
) -> Box<dyn Element> {
let settings = WarpDriveSettings::as_ref(app);
let is_anonymous_or_logged_out = FeatureFlag::SkipFirebaseAnonymousUser.is_enabled()
&& AuthStateProvider::as_ref(app)
.get()
.is_anonymous_or_logged_out();
render_body_item::<WarpDriveSettingsPageAction>(
"Galaxy Drive".into(),
@@ -257,24 +155,15 @@ impl SettingsWidget for WarpDriveToggleWidget {
tooltip_override_text: None,
}),
LocalOnlyIconState::Hidden,
if is_anonymous_or_logged_out {
ToggleState::Disabled
} else {
ToggleState::Enabled
},
ToggleState::Enabled,
appearance,
appearance
.ui_builder()
.switch(self.switch_state.clone())
.check(*settings.enable_warp_drive && !is_anonymous_or_logged_out)
.with_disabled(is_anonymous_or_logged_out)
.check(*settings.enable_warp_drive)
.build()
.on_click(move |ctx, _, _| {
if !is_anonymous_or_logged_out {
ctx.dispatch_typed_action(
WarpDriveSettingsPageAction::ToggleShowWarpDrive,
);
}
ctx.dispatch_typed_action(WarpDriveSettingsPageAction::ToggleShowWarpDrive);
})
.finish(),
Some("Galaxy Drive is a workspace in your terminal where you can save Workflows, Notebooks, Prompts, and Environment Variables for personal use or to share with a team.".into()),