Properly handle assistant messages
This commit is contained in:
parent
c16db22728
commit
271fbaf57e
@ -3,6 +3,7 @@ mod api;
|
|||||||
use std::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
io::{self, Write},
|
io::{self, Write},
|
||||||
|
ops::Deref,
|
||||||
sync::{
|
sync::{
|
||||||
mpsc::{Receiver, Sender},
|
mpsc::{Receiver, Sender},
|
||||||
Arc,
|
Arc,
|
||||||
@ -173,6 +174,14 @@ impl Application for UI {
|
|||||||
|
|
||||||
let _ = send.send(UIMessage::Nop);
|
let _ = send.send(UIMessage::Nop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut chat = chat.write().await;
|
||||||
|
let msg = chat.current_message.clone();
|
||||||
|
if let Some(msg) = msg {
|
||||||
|
let msg = msg.write().await;
|
||||||
|
chat.send_assistant(msg.deref());
|
||||||
|
chat.current_message = None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//state.ollama_api.complete(&x);
|
//state.ollama_api.complete(&x);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user