Compare commits

...

1 Commits

Author SHA1 Message Date
Richard Feldman
c0dfefaeaf wip 2025-03-27 16:05:23 -04:00
3 changed files with 13 additions and 2 deletions

View File

@@ -223,7 +223,10 @@ impl ActiveThread {
cx: &mut Context<Self>, cx: &mut Context<Self>,
) -> Self { ) -> Self {
let subscriptions = vec![ let subscriptions = vec![
cx.observe(&thread, |_, _, cx| cx.notify()), cx.observe(&thread, |_, _, cx| {
println!("Thread notified!");
cx.notify()
}),
cx.subscribe_in(&thread, window, Self::handle_thread_event), cx.subscribe_in(&thread, window, Self::handle_thread_event),
]; ];
@@ -371,7 +374,7 @@ impl ActiveThread {
window: &mut Window, window: &mut Window,
cx: &mut Context<Self>, cx: &mut Context<Self>,
) { ) {
match event { match dbg!(event) {
ThreadEvent::ShowError(error) => { ThreadEvent::ShowError(error) => {
self.last_error = Some(error.clone()); self.last_error = Some(error.clone());
} }

View File

@@ -272,6 +272,13 @@ impl AssistantPanel {
cx, cx,
) )
}); });
cx.observe(&thread, |_, _, cx| {
println!("Panel: Thread notified!");
cx.notify();
})
.detach();
self.message_editor = cx.new(|cx| { self.message_editor = cx.new(|cx| {
MessageEditor::new( MessageEditor::new(
self.fs.clone(), self.fs.clone(),

View File

@@ -541,6 +541,7 @@ impl Thread {
self.messages.push(Message { id, role, segments }); self.messages.push(Message { id, role, segments });
self.touch_updated_at(); self.touch_updated_at();
cx.emit(ThreadEvent::MessageAdded(id)); cx.emit(ThreadEvent::MessageAdded(id));
cx.notify();
id id
} }