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(
|
pub async fn complete(
|
||||||
chat: Arc<RwLock<OllamaChat>>,
|
chat: Arc<RwLock<OllamaChat>>,
|
||||||
) -> anyhow::Result<impl Stream<Item = anyhow::Result<String>>> {
|
) -> anyhow::Result<impl Stream<Item = anyhow::Result<String>>> {
|
||||||
let mut chat = chat.write().await;
|
{
|
||||||
let body = serde_json::to_string(chat.deref())?;
|
let mut chat = chat.write().await;
|
||||||
println!("Sending: {}", body);
|
let body = serde_json::to_string(chat.deref())?;
|
||||||
|
println!("Sending: {}", body);
|
||||||
|
|
||||||
let msg = Arc::new(RwLock::new(String::from("")));
|
let msg = Arc::new(RwLock::new(String::from("")));
|
||||||
chat.current_message = Some(msg.clone());
|
chat.current_message = Some(msg.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
let chat = chat.read().await;
|
||||||
|
|
||||||
let request = chat
|
let request = chat
|
||||||
.client
|
.client
|
||||||
|
Loading…
Reference in New Issue
Block a user