Rebasing, going about this another way
This commit is contained in:
@@ -318,16 +318,16 @@ impl Input {
|
||||
|
||||
// Handle the slash command action based on its kind
|
||||
match command.name {
|
||||
add_mcp if command.name == commands::ADD_MCP.name => {
|
||||
_add_mcp if command.name == commands::ADD_MCP.name => {
|
||||
ctx.dispatch_typed_action(&TerminalAction::OpenAddMCPPane);
|
||||
}
|
||||
add_prompt if command.name == commands::ADD_PROMPT.name => {
|
||||
_add_prompt if command.name == commands::ADD_PROMPT.name => {
|
||||
ctx.dispatch_typed_action(&TerminalAction::OpenAddPromptPane);
|
||||
}
|
||||
add_rule if command.name == commands::ADD_RULE.name => {
|
||||
_add_rule if command.name == commands::ADD_RULE.name => {
|
||||
ctx.dispatch_typed_action(&TerminalAction::OpenAddRulePane);
|
||||
}
|
||||
agent_or_new
|
||||
_agent_or_new
|
||||
if command.name == commands::NEW.name || command.name == commands::AGENT.name =>
|
||||
{
|
||||
if !self
|
||||
@@ -382,7 +382,7 @@ impl Input {
|
||||
origin: AgentViewEntryOrigin::SlashCommand { trigger },
|
||||
});
|
||||
}
|
||||
cloud_agent if command.name == commands::CLOUD_AGENT.name => {
|
||||
_cloud_agent if command.name == commands::CLOUD_AGENT.name => {
|
||||
let prompt = argument.and_then(|argument| {
|
||||
let trimmed = argument.trim();
|
||||
if trimmed.is_empty() {
|
||||
@@ -396,17 +396,17 @@ impl Input {
|
||||
initial_prompt: prompt,
|
||||
});
|
||||
}
|
||||
create_docker_sandbox if command.name == commands::CREATE_DOCKER_SANDBOX.name => {
|
||||
_create_docker_sandbox if command.name == commands::CREATE_DOCKER_SANDBOX.name => {
|
||||
ctx.emit(Event::CreateDockerSandbox);
|
||||
}
|
||||
conversations if command.name == commands::CONVERSATIONS.name => {
|
||||
_conversations if command.name == commands::CONVERSATIONS.name => {
|
||||
if FeatureFlag::AgentView.is_enabled() {
|
||||
self.open_conversation_menu(ctx);
|
||||
} else {
|
||||
ctx.dispatch_typed_action(&TerminalAction::OpenConversationsPalette);
|
||||
}
|
||||
}
|
||||
rename_tab if command.name == commands::RENAME_TAB.name => {
|
||||
_rename_tab if command.name == commands::RENAME_TAB.name => {
|
||||
let Some(name) = argument
|
||||
.map(|name| name.trim())
|
||||
.filter(|name| !name.is_empty())
|
||||
@@ -420,7 +420,7 @@ impl Input {
|
||||
|
||||
ctx.dispatch_typed_action(&WorkspaceAction::SetActiveTabName(name.to_owned()));
|
||||
}
|
||||
create_env if command.name == commands::CREATE_ENVIRONMENT.name => {
|
||||
_create_env if command.name == commands::CREATE_ENVIRONMENT.name => {
|
||||
// If the user included args after the slash command, treat them as repo paths/URLs.
|
||||
let repos = argument
|
||||
.map(|arg| {
|
||||
@@ -433,7 +433,7 @@ impl Input {
|
||||
|
||||
ctx.emit(Event::TriggerEnvironmentSetup { repos });
|
||||
}
|
||||
create_project if command.name == commands::CREATE_NEW_PROJECT.name => {
|
||||
_create_project if command.name == commands::CREATE_NEW_PROJECT.name => {
|
||||
if argument.is_none_or(|args| args.is_empty()) {
|
||||
show_error_toast(
|
||||
"Please describe the project you want to create after /create-new-project"
|
||||
@@ -446,7 +446,7 @@ impl Input {
|
||||
let args = argument.expect("args are Some()");
|
||||
self.initiate_create_new_project(args.to_owned(), ctx);
|
||||
}
|
||||
edit if command.name == commands::EDIT.name => {
|
||||
_edit if command.name == commands::EDIT.name => {
|
||||
#[cfg(feature = "local_fs")]
|
||||
match argument {
|
||||
Some(args) if !args.is_empty() => {
|
||||
@@ -539,7 +539,7 @@ impl Input {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
export_to_clipboard if command.name == commands::EXPORT_TO_CLIPBOARD.name => {
|
||||
_export_to_clipboard if command.name == commands::EXPORT_TO_CLIPBOARD.name => {
|
||||
let history = BlocklistAIHistoryModel::handle(ctx);
|
||||
let Some(conversation) = history
|
||||
.as_ref(ctx)
|
||||
@@ -564,7 +564,7 @@ impl Input {
|
||||
toast_stack.add_ephemeral_toast(toast, window_id, ctx);
|
||||
});
|
||||
}
|
||||
export_to_file if command.name == commands::EXPORT_TO_FILE.name => {
|
||||
_export_to_file if command.name == commands::EXPORT_TO_FILE.name => {
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
{
|
||||
self.export_conversation_to_file(
|
||||
@@ -581,76 +581,76 @@ impl Input {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
index if command.name == commands::INDEX.name => {
|
||||
_index if command.name == commands::INDEX.name => {
|
||||
ctx.dispatch_typed_action(&TerminalAction::IndexProjectSpeedbump);
|
||||
}
|
||||
init if command.name == commands::INIT.name => {
|
||||
_init if command.name == commands::INIT.name => {
|
||||
ctx.dispatch_typed_action(&TerminalAction::InitProject);
|
||||
}
|
||||
changelog if command.name == commands::CHANGELOG.name => {
|
||||
_changelog if command.name == commands::CHANGELOG.name => {
|
||||
if !FeatureFlag::Changelog.is_enabled() {
|
||||
return false;
|
||||
}
|
||||
ctx.dispatch_typed_action(&WorkspaceAction::ViewLatestChangelog);
|
||||
}
|
||||
feedback if command.name == commands::FEEDBACK.name => {
|
||||
_feedback if command.name == commands::FEEDBACK.name => {
|
||||
ctx.dispatch_typed_action(&WorkspaceAction::SendFeedback);
|
||||
}
|
||||
open_code_review if command.name == commands::OPEN_CODE_REVIEW.name => {
|
||||
_open_code_review if command.name == commands::OPEN_CODE_REVIEW.name => {
|
||||
ctx.dispatch_typed_action(&TerminalAction::ToggleCodeReviewPane {
|
||||
entrypoint: CodeReviewPaneEntrypoint::SlashCommand,
|
||||
});
|
||||
}
|
||||
open_mcp_servers if command.name == commands::OPEN_MCP_SERVERS.name => {
|
||||
_open_mcp_servers if command.name == commands::OPEN_MCP_SERVERS.name => {
|
||||
ctx.dispatch_typed_action(&TerminalAction::OpenViewMCPPane);
|
||||
}
|
||||
open_settings_file if command.name == commands::OPEN_SETTINGS_FILE.name => {
|
||||
_open_settings_file if command.name == commands::OPEN_SETTINGS_FILE.name => {
|
||||
if !FeatureFlag::SettingsFile.is_enabled() || !cfg!(feature = "local_fs") {
|
||||
return false;
|
||||
}
|
||||
ctx.dispatch_typed_action(&WorkspaceAction::OpenSettingsFile);
|
||||
}
|
||||
open_project_rules if command.name == commands::OPEN_PROJECT_RULES.name => {
|
||||
_open_project_rules if command.name == commands::OPEN_PROJECT_RULES.name => {
|
||||
ctx.dispatch_typed_action(&TerminalAction::OpenProjectRulesPane);
|
||||
}
|
||||
open_rules if command.name == commands::OPEN_RULES.name => {
|
||||
_open_rules if command.name == commands::OPEN_RULES.name => {
|
||||
ctx.dispatch_typed_action(&TerminalAction::OpenRulesPane);
|
||||
}
|
||||
edit_skill if command.name == commands::EDIT_SKILL.name => {
|
||||
_edit_skill if command.name == commands::EDIT_SKILL.name => {
|
||||
if !FeatureFlag::ListSkills.is_enabled() {
|
||||
return false;
|
||||
}
|
||||
// Open the skill selector menu - user will select a skill from the inline menu
|
||||
self.open_skill_selector(ctx);
|
||||
}
|
||||
invoke_skill if command.name == commands::INVOKE_SKILL.name => {
|
||||
_invoke_skill if command.name == commands::INVOKE_SKILL.name => {
|
||||
if !FeatureFlag::ListSkills.is_enabled() {
|
||||
return false;
|
||||
}
|
||||
// Open the skill selector menu for invocation - skill command will be inserted into buffer
|
||||
self.open_invoke_skill_selector(ctx);
|
||||
}
|
||||
models if command.name == commands::MODEL.name => {
|
||||
_models if command.name == commands::MODEL.name => {
|
||||
self.open_model_selector(ctx);
|
||||
}
|
||||
profiles if command.name == commands::PROFILE.name => {
|
||||
_profiles if command.name == commands::PROFILE.name => {
|
||||
if !FeatureFlag::InlineProfileSelector.is_enabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
self.open_profile_selector(ctx);
|
||||
}
|
||||
prompts if command.name == commands::PROMPTS.name => {
|
||||
_prompts if command.name == commands::PROMPTS.name => {
|
||||
if FeatureFlag::AgentView.is_enabled() {
|
||||
self.open_prompts_menu(ctx);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
rewind if command.name == commands::REWIND.name => {
|
||||
_rewind if command.name == commands::REWIND.name => {
|
||||
self.open_rewind_menu(ctx);
|
||||
}
|
||||
pr_comments if command.name == commands::PR_COMMENTS.name => {
|
||||
_pr_comments if command.name == commands::PR_COMMENTS.name => {
|
||||
if !FeatureFlag::PRCommentsSlashCommand.is_enabled() {
|
||||
return false;
|
||||
}
|
||||
@@ -671,10 +671,10 @@ impl Input {
|
||||
)
|
||||
});
|
||||
}
|
||||
usage if command.name == commands::USAGE.name => {
|
||||
_usage if command.name == commands::USAGE.name => {
|
||||
ctx.dispatch_typed_action(&TerminalAction::OpenBillingAndUsagePane);
|
||||
}
|
||||
remote_control if command.name == commands::REMOTE_CONTROL.name => {
|
||||
_remote_control if command.name == commands::REMOTE_CONTROL.name => {
|
||||
if !FeatureFlag::CreatingSharedSessions.is_enabled()
|
||||
|| !FeatureFlag::HOARemoteControl.is_enabled()
|
||||
{
|
||||
@@ -691,7 +691,7 @@ impl Input {
|
||||
}
|
||||
ctx.emit(Event::StartRemoteControl);
|
||||
}
|
||||
cost if command.name == commands::COST.name => {
|
||||
_cost if command.name == commands::COST.name => {
|
||||
let history = BlocklistAIHistoryModel::handle(ctx);
|
||||
let conversation = history
|
||||
.as_ref(ctx)
|
||||
@@ -715,7 +715,7 @@ impl Input {
|
||||
ctx.dispatch_typed_action(&TerminalAction::ToggleUsageFooter);
|
||||
}
|
||||
}
|
||||
fork if command.name == commands::FORK.name => {
|
||||
_fork if command.name == commands::FORK.name => {
|
||||
let Some(conversation_id) = self
|
||||
.ai_context_model
|
||||
.as_ref(ctx)
|
||||
@@ -740,11 +740,11 @@ impl Input {
|
||||
destination,
|
||||
});
|
||||
}
|
||||
fork_from if command.name == commands::FORK_FROM.name => {
|
||||
_fork_from if command.name == commands::FORK_FROM.name => {
|
||||
self.open_user_query_menu(UserQueryMenuAction::ForkFrom, ctx);
|
||||
return true;
|
||||
}
|
||||
fork_and_compact if command.name == commands::FORK_AND_COMPACT.name => {
|
||||
_fork_and_compact if command.name == commands::FORK_AND_COMPACT.name => {
|
||||
let Some(conversation_id) = self
|
||||
.ai_context_model
|
||||
.as_ref(ctx)
|
||||
@@ -772,7 +772,7 @@ impl Input {
|
||||
destination,
|
||||
});
|
||||
}
|
||||
compact_and if command.name == commands::COMPACT_AND.name => {
|
||||
_compact_and if command.name == commands::COMPACT_AND.name => {
|
||||
if self
|
||||
.ai_context_model
|
||||
.as_ref(ctx)
|
||||
@@ -791,7 +791,7 @@ impl Input {
|
||||
initial_prompt: argument.cloned(),
|
||||
});
|
||||
}
|
||||
queue if command.name == commands::QUEUE.name => {
|
||||
_queue if command.name == commands::QUEUE.name => {
|
||||
let Some(conversation_id) = self
|
||||
.ai_context_model
|
||||
.as_ref(ctx)
|
||||
@@ -820,13 +820,13 @@ impl Input {
|
||||
self.submit_queued_prompt(prompt, ctx);
|
||||
}
|
||||
}
|
||||
open_repo if command.name == commands::OPEN_REPO.name => {
|
||||
_open_repo if command.name == commands::OPEN_REPO.name => {
|
||||
if !FeatureFlag::InlineRepoMenu.is_enabled() {
|
||||
return false;
|
||||
}
|
||||
self.open_repos_menu(ctx);
|
||||
}
|
||||
command_that_just_sends_ai_request_with_prefix
|
||||
_command_that_just_sends_ai_request_with_prefix
|
||||
if command.name == commands::COMPACT.name
|
||||
|| command.name == commands::PLAN.name
|
||||
|| command.name == commands::ORCHESTRATE.name =>
|
||||
|
||||
@@ -3950,8 +3950,8 @@ impl TerminalView {
|
||||
}
|
||||
|
||||
ctx.subscribe_to_model(&AISettings::handle(ctx), |me, _, ai_settings_event, ctx| {
|
||||
if let AISettingsChangedEvent::AwsBedrockCredentialsEnabled { .. } = ai_settings_event {
|
||||
if !UserWorkspaces::as_ref(ctx).is_aws_bedrock_credentials_enabled(ctx) {
|
||||
if let AISettingsChangedEvent::BedrockEnabled { .. } = ai_settings_event {
|
||||
if !UserWorkspaces::as_ref(ctx).is_bedrock_enabled(ctx) {
|
||||
me.remove_aws_bedrock_login_banner(ctx);
|
||||
}
|
||||
}
|
||||
@@ -9318,7 +9318,7 @@ impl TerminalView {
|
||||
AwsBedrockLoginBannerAction::DontShowAgain => {
|
||||
AISettings::handle(ctx).update(ctx, |ai_settings, ctx| {
|
||||
report_if_error!(ai_settings
|
||||
.aws_bedrock_login_banner_dismissed
|
||||
.bedrock_login_banner_dismissed
|
||||
.set_value(true, ctx));
|
||||
});
|
||||
}
|
||||
@@ -9338,7 +9338,7 @@ impl TerminalView {
|
||||
/// user interaction (e.g. "do you want to override X profile? y/n" is common)
|
||||
fn run_aws_login_command(&mut self, ctx: &mut ViewContext<Self>) {
|
||||
let login_command = AISettings::as_ref(ctx)
|
||||
.aws_bedrock_auth_refresh_command
|
||||
.bedrock_auth_refresh_command
|
||||
.value()
|
||||
.clone();
|
||||
|
||||
@@ -9377,7 +9377,7 @@ impl TerminalView {
|
||||
}
|
||||
|
||||
// Check if AWS Bedrock is available in the workspace
|
||||
if !UserWorkspaces::as_ref(ctx).is_aws_bedrock_credentials_enabled(ctx) {
|
||||
if !UserWorkspaces::as_ref(ctx).is_bedrock_enabled(ctx) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@ impl ByoLlmAuthBannerSessionState {
|
||||
pub fn new(ctx: &mut ModelContext<Self>) -> Self {
|
||||
// Initialize from the persisted permanent dismissal setting
|
||||
let dismissed = *AISettings::as_ref(ctx)
|
||||
.aws_bedrock_login_banner_dismissed
|
||||
.bedrock_login_banner_dismissed
|
||||
.value();
|
||||
|
||||
// Subscribe to changes in the permanent dismissal setting
|
||||
ctx.subscribe_to_model(&AISettings::handle(ctx), |state, event, ctx| {
|
||||
if let AISettingsChangedEvent::AwsBedrockLoginBannerDismissed { .. } = event {
|
||||
if let AISettingsChangedEvent::BedrockLoginBannerDismissed { .. } = event {
|
||||
let permanently_dismissed = *AISettings::as_ref(ctx)
|
||||
.aws_bedrock_login_banner_dismissed
|
||||
.bedrock_login_banner_dismissed
|
||||
.value();
|
||||
if permanently_dismissed && !state.dismissed {
|
||||
state.dismissed = true;
|
||||
|
||||
Reference in New Issue
Block a user