assistant2: Stream in completion text (#21182)
This PR makes it so that the completion text streams into the message list rather than being buffered until the end. Release Notes: - N/A
This commit is contained in:
parent
91a565f5fa
commit
9ee1aba80a
3 changed files with 75 additions and 51 deletions
|
@ -1,7 +1,7 @@
|
|||
use anyhow::Result;
|
||||
use gpui::{
|
||||
prelude::*, px, Action, AppContext, AsyncWindowContext, EventEmitter, FocusHandle,
|
||||
FocusableView, Model, Pixels, Task, View, ViewContext, WeakView, WindowContext,
|
||||
FocusableView, Model, Pixels, Subscription, Task, View, ViewContext, WeakView, WindowContext,
|
||||
};
|
||||
use language_model::LanguageModelRegistry;
|
||||
use language_model_selector::LanguageModelSelector;
|
||||
|
@ -28,6 +28,7 @@ pub struct AssistantPanel {
|
|||
pane: View<Pane>,
|
||||
thread: Model<Thread>,
|
||||
message_editor: View<MessageEditor>,
|
||||
_subscriptions: Vec<Subscription>,
|
||||
}
|
||||
|
||||
impl AssistantPanel {
|
||||
|
@ -59,11 +60,13 @@ impl AssistantPanel {
|
|||
});
|
||||
|
||||
let thread = cx.new_model(Thread::new);
|
||||
let subscriptions = vec![cx.observe(&thread, |_, _, cx| cx.notify())];
|
||||
|
||||
Self {
|
||||
pane,
|
||||
thread: thread.clone(),
|
||||
message_editor: cx.new_view(|cx| MessageEditor::new(thread, cx)),
|
||||
_subscriptions: subscriptions,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue