assistant2: Add support for referencing other threads as context (#22092)
This PR adds the ability to reference other threads as context: <img width="1159" alt="Screenshot 2024-12-16 at 11 29 54 AM" src="https://github.com/user-attachments/assets/bb8a24ff-56d3-4406-ab8c-6657e65d8c70" /> <img width="1159" alt="Screenshot 2024-12-16 at 11 29 35 AM" src="https://github.com/user-attachments/assets/7a02ebda-a2f5-40e9-9dd4-1bb029cb1c43" /> Release Notes: - N/A
This commit is contained in:
parent
188c55c8a6
commit
88f7942f11
6 changed files with 278 additions and 11 deletions
|
@ -1,7 +1,7 @@
|
|||
use std::rc::Rc;
|
||||
|
||||
use editor::{Editor, EditorElement, EditorStyle};
|
||||
use gpui::{AppContext, FocusableView, Model, TextStyle, View, WeakView};
|
||||
use gpui::{AppContext, FocusableView, Model, TextStyle, View, WeakModel, WeakView};
|
||||
use language_model::{LanguageModelRegistry, LanguageModelRequestTool};
|
||||
use language_model_selector::{LanguageModelSelector, LanguageModelSelectorPopoverMenu};
|
||||
use settings::Settings;
|
||||
|
@ -15,6 +15,7 @@ use workspace::Workspace;
|
|||
use crate::context::{Context, ContextId, ContextKind};
|
||||
use crate::context_picker::ContextPicker;
|
||||
use crate::thread::{RequestKind, Thread};
|
||||
use crate::thread_store::ThreadStore;
|
||||
use crate::ui::ContextPill;
|
||||
use crate::{Chat, ToggleModelSelector};
|
||||
|
||||
|
@ -32,6 +33,7 @@ pub struct MessageEditor {
|
|||
impl MessageEditor {
|
||||
pub fn new(
|
||||
workspace: WeakView<Workspace>,
|
||||
thread_store: WeakModel<ThreadStore>,
|
||||
thread: Model<Thread>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Self {
|
||||
|
@ -46,7 +48,9 @@ impl MessageEditor {
|
|||
}),
|
||||
context: Vec::new(),
|
||||
next_context_id: ContextId(0),
|
||||
context_picker: cx.new_view(|cx| ContextPicker::new(workspace.clone(), weak_self, cx)),
|
||||
context_picker: cx.new_view(|cx| {
|
||||
ContextPicker::new(workspace.clone(), thread_store.clone(), weak_self, cx)
|
||||
}),
|
||||
context_picker_handle: PopoverMenuHandle::default(),
|
||||
language_model_selector: cx.new_view(|cx| {
|
||||
LanguageModelSelector::new(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue