summaryrefslogtreecommitdiffstats
path: root/src/client/qianwen.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-05-22 21:29:23 +0800
committerGitHub <noreply@github.com>2024-05-22 21:29:23 +0800
commitba3bcfd67c1d6fea5d3d3c5908c975682ee7909b (patch)
tree29811c719f131f946cd37634507885ee8c63534d /src/client/qianwen.rs
parent91a06543b24733cf578f3f2d4cb0884e2b18cf2f (diff)
downloadaichat-ba3bcfd67c1d6fea5d3d3c5908c975682ee7909b.tar.gz
feat: allow patching req body with client config (#534)
Diffstat (limited to 'src/client/qianwen.rs')
-rw-r--r--src/client/qianwen.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/client/qianwen.rs b/src/client/qianwen.rs
index b33d13e..2c7b375 100644
--- a/src/client/qianwen.rs
+++ b/src/client/qianwen.rs
@@ -1,6 +1,7 @@
use super::{
maybe_catch_error, message::*, sse_stream, Client, CompletionOutput, ExtraConfig, Model,
- ModelData, PromptAction, PromptKind, QianwenClient, SendData, SsMmessage, SseHandler,
+ ModelData, ModelPatches, PromptAction, PromptKind, QianwenClient, SendData, SsMmessage,
+ SseHandler,
};
use crate::utils::{base64_decode, sha256};
@@ -27,6 +28,7 @@ pub struct QianwenConfig {
pub api_key: Option<String>,
#[serde(default)]
pub models: Vec<ModelData>,
+ pub patches: Option<ModelPatches>,
pub extra: Option<ExtraConfig>,
}
@@ -46,7 +48,8 @@ impl QianwenClient {
true => API_URL_VL,
false => API_URL,
};
- let (body, has_upload) = build_body(data, &self.model, is_vl)?;
+ let (mut body, has_upload) = build_body(data, &self.model, is_vl)?;
+ self.patch_request_body(&mut body);
debug!("Qianwen Request: {url} {body}");