diff --git a/assets/icons/robot_14.svg b/assets/icons/robot_14.svg
new file mode 100644
index 0000000000..7b6dc3f752
--- /dev/null
+++ b/assets/icons/robot_14.svg
@@ -0,0 +1,4 @@
+
diff --git a/crates/ai/src/assistant.rs b/crates/ai/src/assistant.rs
index 77353e1ee4..e5702cb677 100644
--- a/crates/ai/src/assistant.rs
+++ b/crates/ai/src/assistant.rs
@@ -6,12 +6,9 @@ use anyhow::{anyhow, Result};
use chrono::{DateTime, Local};
use collections::{HashMap, HashSet};
use editor::{
- display_map::ToDisplayPoint,
- scroll::{
- autoscroll::{Autoscroll, AutoscrollStrategy},
- ScrollAnchor,
- },
- Anchor, DisplayPoint, Editor, ExcerptId, ExcerptRange, MultiBuffer,
+ display_map::{BlockDisposition, BlockId, BlockProperties, BlockStyle, ToDisplayPoint},
+ scroll::autoscroll::{Autoscroll, AutoscrollStrategy},
+ Anchor, Editor, ToOffset as _,
};
use fs::Fs;
use futures::{io::BufReader, AsyncBufReadExt, AsyncReadExt, Stream, StreamExt};
@@ -19,17 +16,20 @@ use gpui::{
actions,
elements::*,
executor::Background,
- geometry::vector::vec2f,
+ geometry::vector::{vec2f, Vector2F},
platform::{CursorStyle, MouseButton},
Action, AppContext, AsyncAppContext, ClipboardItem, Entity, ModelContext, ModelHandle,
Subscription, Task, View, ViewContext, ViewHandle, WeakViewHandle, WindowContext,
};
use isahc::{http::StatusCode, Request, RequestExt};
-use language::{language_settings::SoftWrap, Buffer, LanguageRegistry};
+use language::{language_settings::SoftWrap, Buffer, LanguageRegistry, ToOffset as _};
use serde::Deserialize;
use settings::SettingsStore;
-use std::{borrow::Cow, cell::RefCell, cmp, fmt::Write, io, rc::Rc, sync::Arc, time::Duration};
-use util::{post_inc, truncate_and_trailoff, ResultExt, TryFutureExt};
+use std::{
+ borrow::Cow, cell::RefCell, cmp, fmt::Write, io, iter, ops::Range, rc::Rc, sync::Arc,
+ time::Duration,
+};
+use util::{channel::ReleaseChannel, post_inc, truncate_and_trailoff, ResultExt, TryFutureExt};
use workspace::{
dock::{DockPosition, Panel},
item::Item,
@@ -44,6 +44,12 @@ actions!(
);
pub fn init(cx: &mut AppContext) {
+ if *util::channel::RELEASE_CHANNEL == ReleaseChannel::Stable {
+ cx.update_default_global::(move |filter, _cx| {
+ filter.filtered_namespaces.insert("assistant");
+ });
+ }
+
settings::register::(cx);
cx.add_action(
|workspace: &mut Workspace, _: &NewContext, cx: &mut ViewContext| {
@@ -60,6 +66,11 @@ pub fn init(cx: &mut AppContext) {
cx.capture_action(AssistantEditor::copy);
cx.add_action(AssistantPanel::save_api_key);
cx.add_action(AssistantPanel::reset_api_key);
+ cx.add_action(
+ |workspace: &mut Workspace, _: &ToggleFocus, cx: &mut ViewContext| {
+ workspace.toggle_panel_focus::(cx);
+ },
+ );
}
pub enum AssistantPanelEvent {
@@ -387,7 +398,7 @@ impl Panel for AssistantPanel {
}
fn icon_path(&self) -> &'static str {
- "icons/speech_bubble_12.svg"
+ "icons/robot_14.svg"
}
fn icon_tooltip(&self) -> (String, Option>) {
@@ -420,20 +431,20 @@ impl Panel for AssistantPanel {
}
enum AssistantEvent {
- MessagesEdited { ids: Vec },
+ MessagesEdited,
SummaryChanged,
StreamedCompletion,
}
struct Assistant {
- buffer: ModelHandle,
+ buffer: ModelHandle,
messages: Vec,
- messages_metadata: HashMap,
+ messages_metadata: HashMap,
+ next_message_id: MessageId,
summary: Option,
pending_summary: Task