diff --git a/crates/agent_ui/src/inline_prompt_editor.rs b/crates/agent_ui/src/inline_prompt_editor.rs index d268c2f21154ee0dae5eeab1e35a900f6b773d69..b6517a54339df71659805ff38718e94be7192fa8 100644 --- a/crates/agent_ui/src/inline_prompt_editor.rs +++ b/crates/agent_ui/src/inline_prompt_editor.rs @@ -1,29 +1,18 @@ -use crate::agent_model_selector::AgentModelSelector; -use crate::buffer_codegen::BufferCodegen; -use crate::context_picker::{ContextPicker, ContextPickerCompletionProvider}; -use crate::context_strip::{ContextStrip, ContextStripEvent, SuggestContextKind}; -use crate::message_editor::{ContextCreasesAddon, extract_message_creases, insert_message_creases}; -use crate::terminal_codegen::TerminalCodegen; -use crate::{CycleNextInlineAssist, CyclePreviousInlineAssist, ModelUsageContext}; -use crate::{RemoveAllContext, ToggleContextPicker}; use agent::{ context_store::ContextStore, thread_store::{TextThreadStore, ThreadStore}, }; -use client::ErrorExt; use collections::VecDeque; -use db::kvp::Dismissable; use editor::actions::Paste; use editor::display_map::EditorMargins; use editor::{ ContextMenuOptions, Editor, EditorElement, EditorEvent, EditorMode, EditorStyle, MultiBuffer, actions::{MoveDown, MoveUp}, }; -use feature_flags::{FeatureFlagAppExt as _, ZedProFeatureFlag}; use fs::Fs; use gpui::{ - AnyElement, App, ClickEvent, Context, CursorStyle, Entity, EventEmitter, FocusHandle, - Focusable, FontWeight, Subscription, TextStyle, WeakEntity, Window, anchored, deferred, point, + AnyElement, App, Context, CursorStyle, Entity, EventEmitter, FocusHandle, Focusable, + Subscription, TextStyle, WeakEntity, Window, }; use language_model::{LanguageModel, LanguageModelRegistry}; use parking_lot::Mutex; @@ -33,12 +22,19 @@ use std::rc::Rc; use std::sync::Arc; use theme::ThemeSettings; use ui::utils::WithRemSize; -use ui::{ - CheckboxWithLabel, IconButtonShape, KeyBinding, Popover, PopoverMenuHandle, Tooltip, prelude::*, -}; +use ui::{IconButtonShape, KeyBinding, PopoverMenuHandle, Tooltip, prelude::*}; use workspace::Workspace; use zed_actions::agent::ToggleModelSelector; +use crate::agent_model_selector::AgentModelSelector; +use crate::buffer_codegen::BufferCodegen; +use crate::context_picker::{ContextPicker, ContextPickerCompletionProvider}; +use crate::context_strip::{ContextStrip, ContextStripEvent, SuggestContextKind}; +use crate::message_editor::{ContextCreasesAddon, extract_message_creases, insert_message_creases}; +use crate::terminal_codegen::TerminalCodegen; +use crate::{CycleNextInlineAssist, CyclePreviousInlineAssist, ModelUsageContext}; +use crate::{RemoveAllContext, ToggleContextPicker}; + pub struct PromptEditor { pub editor: Entity, mode: PromptEditorMode, @@ -144,47 +140,16 @@ impl Render for PromptEditor { }; let error_message = SharedString::from(error.to_string()); - if error.error_code() == proto::ErrorCode::RateLimitExceeded - && cx.has_flag::() - { - el.child( - v_flex() - .child( - IconButton::new( - "rate-limit-error", - IconName::XCircle, - ) - .toggle_state(self.show_rate_limit_notice) - .shape(IconButtonShape::Square) - .icon_size(IconSize::Small) - .on_click( - cx.listener(Self::toggle_rate_limit_notice), - ), - ) - .children(self.show_rate_limit_notice.then(|| { - deferred( - anchored() - .position_mode( - gpui::AnchoredPositionMode::Local, - ) - .position(point(px(0.), px(24.))) - .anchor(gpui::Corner::TopLeft) - .child(self.render_rate_limit_notice(cx)), - ) - })), - ) - } else { - el.child( - div() - .id("error") - .tooltip(Tooltip::text(error_message)) - .child( - Icon::new(IconName::XCircle) - .size(IconSize::Small) - .color(Color::Error), - ), - ) - } + el.child( + div() + .id("error") + .tooltip(Tooltip::text(error_message)) + .child( + Icon::new(IconName::XCircle) + .size(IconSize::Small) + .color(Color::Error), + ), + ) }), ) .child( @@ -310,19 +275,6 @@ impl PromptEditor { crate::active_thread::attach_pasted_images_as_context(&self.context_store, cx); } - fn toggle_rate_limit_notice( - &mut self, - _: &ClickEvent, - window: &mut Window, - cx: &mut Context, - ) { - self.show_rate_limit_notice = !self.show_rate_limit_notice; - if self.show_rate_limit_notice { - window.focus(&self.editor.focus_handle(cx)); - } - cx.notify(); - } - fn handle_prompt_editor_events( &mut self, _: &Entity, @@ -707,61 +659,6 @@ impl PromptEditor { .into_any_element() } - fn render_rate_limit_notice(&self, cx: &mut Context) -> impl IntoElement { - Popover::new().child( - v_flex() - .occlude() - .p_2() - .child( - Label::new("Out of Tokens") - .size(LabelSize::Small) - .weight(FontWeight::BOLD), - ) - .child(Label::new( - "Try Zed Pro for higher limits, a wider range of models, and more.", - )) - .child( - h_flex() - .justify_between() - .child(CheckboxWithLabel::new( - "dont-show-again", - Label::new("Don't show again"), - if RateLimitNotice::dismissed() { - ui::ToggleState::Selected - } else { - ui::ToggleState::Unselected - }, - |selection, _, cx| { - let is_dismissed = match selection { - ui::ToggleState::Unselected => false, - ui::ToggleState::Indeterminate => return, - ui::ToggleState::Selected => true, - }; - - RateLimitNotice::set_dismissed(is_dismissed, cx); - }, - )) - .child( - h_flex() - .gap_2() - .child( - Button::new("dismiss", "Dismiss") - .style(ButtonStyle::Transparent) - .on_click(cx.listener(Self::toggle_rate_limit_notice)), - ) - .child(Button::new("more-info", "More Info").on_click( - |_event, window, cx| { - window.dispatch_action( - Box::new(zed_actions::OpenAccountSettings), - cx, - ) - }, - )), - ), - ), - ) - } - fn render_editor(&mut self, _window: &mut Window, cx: &mut Context) -> AnyElement { let colors = cx.theme().colors(); @@ -978,15 +875,7 @@ impl PromptEditor { self.editor .update(cx, |editor, _| editor.set_read_only(false)); } - CodegenStatus::Error(error) => { - if cx.has_flag::() - && error.error_code() == proto::ErrorCode::RateLimitExceeded - && !RateLimitNotice::dismissed() - { - self.show_rate_limit_notice = true; - cx.notify(); - } - + CodegenStatus::Error(_error) => { self.edited_since_done = false; self.editor .update(cx, |editor, _| editor.set_read_only(false)); @@ -1189,12 +1078,6 @@ impl PromptEditor { } } -struct RateLimitNotice; - -impl Dismissable for RateLimitNotice { - const KEY: &'static str = "dismissed-rate-limit-notice"; -} - pub enum CodegenStatus { Idle, Pending, diff --git a/crates/agent_ui/src/language_model_selector.rs b/crates/agent_ui/src/language_model_selector.rs index 3633e533da97b2b80e5c8d62c271da7121d3582b..eb5a734b4ca57c2b79ac0dd004e42fc59c195fed 100644 --- a/crates/agent_ui/src/language_model_selector.rs +++ b/crates/agent_ui/src/language_model_selector.rs @@ -1,8 +1,6 @@ use std::{cmp::Reverse, sync::Arc}; -use cloud_llm_client::Plan; use collections::{HashSet, IndexMap}; -use feature_flags::ZedProFeatureFlag; use fuzzy::{StringMatch, StringMatchCandidate, match_strings}; use gpui::{Action, AnyElement, App, BackgroundExecutor, DismissEvent, Subscription, Task}; use language_model::{ @@ -13,8 +11,6 @@ use ordered_float::OrderedFloat; use picker::{Picker, PickerDelegate}; use ui::{ListItem, ListItemSpacing, prelude::*}; -const TRY_ZED_PRO_URL: &str = "https://zed.dev/pro"; - type OnModelChanged = Arc, &mut App) + 'static>; type GetActiveModel = Arc Option + 'static>; @@ -531,13 +527,9 @@ impl PickerDelegate for LanguageModelPickerDelegate { fn render_footer( &self, - _: &mut Window, + _window: &mut Window, cx: &mut Context>, ) -> Option { - use feature_flags::FeatureFlagAppExt; - - let plan = Plan::ZedPro; - Some( h_flex() .w_full() @@ -546,28 +538,6 @@ impl PickerDelegate for LanguageModelPickerDelegate { .p_1() .gap_4() .justify_between() - .when(cx.has_flag::(), |this| { - this.child(match plan { - Plan::ZedPro => Button::new("zed-pro", "Zed Pro") - .icon(IconName::ZedAssistant) - .icon_size(IconSize::Small) - .icon_color(Color::Muted) - .icon_position(IconPosition::Start) - .on_click(|_, window, cx| { - window - .dispatch_action(Box::new(zed_actions::OpenAccountSettings), cx) - }), - Plan::ZedFree | Plan::ZedProTrial => Button::new( - "try-pro", - if plan == Plan::ZedProTrial { - "Upgrade to Pro" - } else { - "Try Pro" - }, - ) - .on_click(|_, _, cx| cx.open_url(TRY_ZED_PRO_URL)), - }) - }) .child( Button::new("configure", "Configure") .icon(IconName::Settings) diff --git a/crates/feature_flags/src/feature_flags.rs b/crates/feature_flags/src/feature_flags.rs index b9e9f3ae9f36ecaa7cf4f4c7a41dc8ccab973730..2f609f51ab79f933d8f25505f710db24e6615ef0 100644 --- a/crates/feature_flags/src/feature_flags.rs +++ b/crates/feature_flags/src/feature_flags.rs @@ -66,11 +66,6 @@ impl FeatureFlag for LlmClosedBetaFeatureFlag { const NAME: &'static str = "llm-closed-beta"; } -pub struct ZedProFeatureFlag {} -impl FeatureFlag for ZedProFeatureFlag { - const NAME: &'static str = "zed-pro"; -} - pub struct NotebookFeatureFlag; impl FeatureFlag for NotebookFeatureFlag {