diff options
| author | sigoden <sigoden@gmail.com> | 2024-05-22 21:29:23 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-22 21:29:23 +0800 |
| commit | ba3bcfd67c1d6fea5d3d3c5908c975682ee7909b (patch) | |
| tree | 29811c719f131f946cd37634507885ee8c63534d /src/client/ollama.rs | |
| parent | 91a06543b24733cf578f3f2d4cb0884e2b18cf2f (diff) | |
| download | aichat-ba3bcfd67c1d6fea5d3d3c5908c975682ee7909b.tar.gz | |
feat: allow patching req body with client config (#534)
Diffstat (limited to 'src/client/ollama.rs')
| -rw-r--r-- | src/client/ollama.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/ollama.rs b/src/client/ollama.rs index 24d2dfe..37a3667 100644 --- a/src/client/ollama.rs +++ b/src/client/ollama.rs @@ -1,6 +1,6 @@ use super::{ - catch_error, message::*, CompletionOutput, ExtraConfig, Model, ModelData, OllamaClient, - PromptAction, PromptKind, SendData, SseHandler, + catch_error, message::*, Client, CompletionOutput, ExtraConfig, Model, ModelData, ModelPatches, + OllamaClient, PromptAction, PromptKind, SendData, SseHandler, }; use anyhow::{anyhow, bail, Result}; @@ -16,6 +16,7 @@ pub struct OllamaConfig { pub api_auth: Option<String>, pub chat_endpoint: Option<String>, pub models: Vec<ModelData>, + pub patches: Option<ModelPatches>, pub extra: Option<ExtraConfig>, } @@ -40,7 +41,7 @@ impl OllamaClient { let api_auth = self.get_api_auth().ok(); let mut body = build_body(data, &self.model)?; - self.model.merge_extra_fields(&mut body); + self.patch_request_body(&mut body); let chat_endpoint = self.config.chat_endpoint.as_deref().unwrap_or("/api/chat"); |
