Fix cursor focus and selection in input box, add AWS env var warning box, and remove AWS Bedrock login banner
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::{anyhow, bail, Result};
|
||||
use regex::Regex;
|
||||
use galaxy_graphql::billing::{
|
||||
AiAutonomyPolicy as GqlAiAutonomyPolicy, AmbientAgentsPolicy as GqlAmbientAgentsPolicy,
|
||||
BillingCycleUsageHistory as GqlBillingCycleUsageHistory, BillingMetadata as GqlBillingMetadata,
|
||||
@@ -39,6 +38,7 @@ use galaxy_graphql::workspace::{
|
||||
WorkspaceSettings as GqlWorkspaceSettings,
|
||||
WriteToPtyAutonomyValue as GqlWriteToPtyAutonomyValue,
|
||||
};
|
||||
use regex::Regex;
|
||||
|
||||
use super::team::{DiscoverableTeam, MembershipRole, Team, TeamMember};
|
||||
use super::user_workspaces::WorkspacesMetadataResponse;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use chrono::Utc;
|
||||
use cloud_object_client::MockObjectClient;
|
||||
use galaxyui::App;
|
||||
use itertools::Itertools;
|
||||
|
||||
use super::*;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Result;
|
||||
use regex::Regex;
|
||||
use galaxy_core::features::FeatureFlag;
|
||||
use galaxy_core::settings::{ChangeEventReason, Setting};
|
||||
use galaxy_graphql::workspace::FeatureModelChoice;
|
||||
use galaxyui::{AppContext, Entity, ModelContext, SingletonEntity, Tracked};
|
||||
use regex::Regex;
|
||||
|
||||
use super::team::{DiscoverableTeam, MembershipRole, Team};
|
||||
#[cfg(test)]
|
||||
@@ -16,7 +16,7 @@ use super::workspace::{
|
||||
};
|
||||
use crate::ai::llms::LLMModelHost;
|
||||
use crate::auth::{AuthStateProvider, UserUid};
|
||||
use crate::channel::ChannelState;
|
||||
use crate::channel::{Channel, ChannelState};
|
||||
use crate::cloud_object::model::persistence::CloudModel;
|
||||
use crate::cloud_object::{CloudObjectEventEntrypoint, ObjectType, Owner, Space};
|
||||
use crate::pricing::PricingInfoModel;
|
||||
@@ -544,6 +544,14 @@ impl UserWorkspaces {
|
||||
}
|
||||
|
||||
pub fn is_bedrock_enabled(&self, app: &AppContext) -> bool {
|
||||
// In local/dev/oss builds, allow using local Bedrock credentials even if there's no active workspace.
|
||||
if self.current_workspace().is_none() {
|
||||
let channel = ChannelState::channel();
|
||||
if channel == Channel::Oss || channel == Channel::Local || channel == Channel::Dev {
|
||||
return *AISettings::as_ref(app).bedrock_enabled.value();
|
||||
}
|
||||
}
|
||||
|
||||
// i.e. did the admin go and toggle on aws bedrock in the admin panel?
|
||||
if !self.is_aws_bedrock_available_from_workspace() {
|
||||
return false;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use galaxyui_extras::user_preferences;
|
||||
use mockall::Sequence;
|
||||
use settings::{PrivatePreferences, PublicPreferences};
|
||||
use warpui::{AddSingletonModel, App};
|
||||
use galaxyui_extras::user_preferences;
|
||||
|
||||
use super::*;
|
||||
use crate::ai::llms::LLMModelHost;
|
||||
@@ -247,7 +247,7 @@ fn team_for_test() -> Team {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_aws_bedrock_credentials_default_off_when_admin_respects_user_setting() {
|
||||
fn test_aws_bedrock_credentials_default_on_when_admin_respects_user_setting() {
|
||||
let team = team_for_test();
|
||||
let mut workspace = workspace_for_test(&team);
|
||||
workspace.settings.llm_settings.enabled = true;
|
||||
@@ -259,6 +259,19 @@ fn test_aws_bedrock_credentials_default_off_when_admin_respects_user_setting() {
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
let mut team_client = MockTeamClient::new();
|
||||
let workspace_for_poll = workspace.clone();
|
||||
team_client.expect_workspaces_metadata().returning(move || {
|
||||
Ok(WorkspacesMetadataWithPricing {
|
||||
metadata: WorkspacesMetadataResponse {
|
||||
workspaces: vec![workspace_for_poll.clone()],
|
||||
joinable_teams: vec![],
|
||||
experiments: None,
|
||||
feature_model_choices: None,
|
||||
},
|
||||
pricing_info: None,
|
||||
})
|
||||
});
|
||||
|
||||
App::test((), |mut app| async move {
|
||||
initialize_app(
|
||||
@@ -266,14 +279,14 @@ fn test_aws_bedrock_credentials_default_off_when_admin_respects_user_setting() {
|
||||
CachedResources {
|
||||
workspaces: vec![workspace],
|
||||
},
|
||||
Arc::new(MockTeamClient::new()),
|
||||
Arc::new(team_client),
|
||||
Arc::new(MockWorkspaceClient::new()),
|
||||
);
|
||||
|
||||
app.read(|ctx| {
|
||||
assert!(
|
||||
!UserWorkspaces::as_ref(ctx).is_bedrock_enabled(ctx),
|
||||
"respect-user-setting should default the local Bedrock credentials toggle to off"
|
||||
UserWorkspaces::as_ref(ctx).is_bedrock_enabled(ctx),
|
||||
"respect-user-setting should default the local Bedrock credentials toggle to on"
|
||||
);
|
||||
assert!(
|
||||
UserWorkspaces::as_ref(ctx).is_aws_bedrock_credentials_toggleable(),
|
||||
|
||||
Reference in New Issue
Block a user