diff options
Diffstat (limited to 'src/client/ollama.rs')
| -rw-r--r-- | src/client/ollama.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/client/ollama.rs b/src/client/ollama.rs index 1394ced..f2340c6 100644 --- a/src/client/ollama.rs +++ b/src/client/ollama.rs @@ -1,6 +1,6 @@ use super::{ - message::*, Client, ExtraConfig, Model, ModelConfig, OllamaClient, PromptType, ReplyHandler, - SendData, + catch_error, message::*, Client, ExtraConfig, Model, ModelConfig, OllamaClient, PromptType, + ReplyHandler, SendData, }; use crate::utils::PromptKind; @@ -191,11 +191,3 @@ fn build_body(data: SendData, model: &Model) -> Result<Value> { Ok(body) } - -fn catch_error(data: &Value, status: u16) -> Result<()> { - debug!("Invalid response, status: {status}, data: {data}"); - if let Some(error) = data["error"].as_str() { - bail!("{error}"); - } - bail!("Invalid response, status: {status}, data: {data}"); -} |
