summaryrefslogtreecommitdiffstats
path: root/src/client/cloudflare.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/cloudflare.rs
parent91a06543b24733cf578f3f2d4cb0884e2b18cf2f (diff)
downloadaichat-ba3bcfd67c1d6fea5d3d3c5908c975682ee7909b.tar.gz
feat: allow patching req body with client config (#534)
Diffstat (limited to 'src/client/cloudflare.rs')
-rw-r--r--src/client/cloudflare.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/cloudflare.rs b/src/client/cloudflare.rs
index dfff009..3369266 100644
--- a/src/client/cloudflare.rs
+++ b/src/client/cloudflare.rs
@@ -1,6 +1,6 @@
use super::{
- catch_error, sse_stream, CloudflareClient, CompletionOutput, ExtraConfig, Model, ModelData,
- PromptAction, PromptKind, SendData, SsMmessage, SseHandler,
+ catch_error, sse_stream, Client, CloudflareClient, CompletionOutput, ExtraConfig, Model,
+ ModelData, ModelPatches, PromptAction, PromptKind, SendData, SsMmessage, SseHandler,
};
use anyhow::{anyhow, Result};
@@ -17,6 +17,7 @@ pub struct CloudflareConfig {
pub api_key: Option<String>,
#[serde(default)]
pub models: Vec<ModelData>,
+ pub patches: Option<ModelPatches>,
pub extra: Option<ExtraConfig>,
}
@@ -33,7 +34,8 @@ impl CloudflareClient {
let account_id = self.get_account_id()?;
let api_key = self.get_api_key()?;
- let body = build_body(data, &self.model)?;
+ let mut body = build_body(data, &self.model)?;
+ self.patch_request_body(&mut body);
let url = format!(
"{API_BASE}/accounts/{account_id}/ai/run/{}",