Fix blocking
This commit is contained in:
parent
47e17e4d42
commit
c16db22728
14
src/api.rs
14
src/api.rs
@ -110,12 +110,16 @@ impl OllamaChat {
|
||||
pub async fn complete(
|
||||
chat: Arc<RwLock<OllamaChat>>,
|
||||
) -> anyhow::Result<impl Stream<Item = anyhow::Result<String>>> {
|
||||
let mut chat = chat.write().await;
|
||||
let body = serde_json::to_string(chat.deref())?;
|
||||
println!("Sending: {}", body);
|
||||
{
|
||||
let mut chat = chat.write().await;
|
||||
let body = serde_json::to_string(chat.deref())?;
|
||||
println!("Sending: {}", body);
|
||||
|
||||
let msg = Arc::new(RwLock::new(String::from("")));
|
||||
chat.current_message = Some(msg.clone());
|
||||
let msg = Arc::new(RwLock::new(String::from("")));
|
||||
chat.current_message = Some(msg.clone());
|
||||
}
|
||||
|
||||
let chat = chat.read().await;
|
||||
|
||||
let request = chat
|
||||
.client
|
||||
|
Loading…
Reference in New Issue
Block a user