Kyle Kelley 2024-05-02 13:26:46 -07:00 committed by GitHub
parent 43ad470e58
commit 1915a756a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 209 additions and 138 deletions

View file

@ -23,7 +23,7 @@ use semantic_index::{CloudEmbeddingProvider, ProjectIndex, SemanticIndex};
use serde::Deserialize;
use settings::Settings;
use std::sync::Arc;
use ui::Composer;
use ui::{Composer, ProjectIndexButton};
use util::{paths::EMBEDDINGS_DIR, ResultExt};
use workspace::{
dock::{DockPosition, Panel, PanelEvent},
@ -228,6 +228,7 @@ pub struct AssistantChat {
list_state: ListState,
language_registry: Arc<LanguageRegistry>,
composer_editor: View<Editor>,
project_index_button: Option<View<ProjectIndexButton>>,
user_store: Model<UserStore>,
next_message_id: MessageId,
collapsed_messages: HashMap<MessageId, bool>,
@ -263,6 +264,10 @@ impl AssistantChat {
},
);
let project_index_button = project_index.clone().map(|project_index| {
cx.new_view(|cx| ProjectIndexButton::new(project_index, tool_registry.clone(), cx))
});
Self {
model,
messages: Vec::new(),
@ -275,6 +280,7 @@ impl AssistantChat {
list_state,
user_store,
language_registry,
project_index_button,
project_index,
next_message_id: MessageId(0),
editing_message: None,
@ -397,7 +403,7 @@ impl AssistantChat {
{
this.tool_registry.definitions()
} else {
&[]
Vec::new()
};
call_count += 1;
@ -590,7 +596,7 @@ impl AssistantChat {
element.child(Composer::new(
body.clone(),
self.user_store.read(cx).current_user(),
self.tool_registry.clone(),
self.project_index_button.clone(),
crate::ui::ModelSelector::new(
cx.view().downgrade(),
self.model.clone(),
@ -768,7 +774,7 @@ impl Render for AssistantChat {
.child(Composer::new(
self.composer_editor.clone(),
self.user_store.read(cx).current_user(),
self.tool_registry.clone(),
self.project_index_button.clone(),
crate::ui::ModelSelector::new(cx.view().downgrade(), self.model.clone())
.into_any_element(),
))