summaryrefslogtreecommitdiffstats
path: root/src/client/openai.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2025-02-26 21:06:11 +0800
committerGitHub <noreply@github.com>2025-02-26 21:06:11 +0800
commitcb54f8643a965fbc35b1f07eb3ea026692eb8091 (patch)
tree719617569d379e4c34badbff95a77d0771df7213 /src/client/openai.rs
parent6b28b1c4fcf57edc4375703bca34eeafa597c905 (diff)
downloadaichat-cb54f8643a965fbc35b1f07eb3ea026692eb8091.tar.gz
refactor: several improvements (#1203)
Diffstat (limited to 'src/client/openai.rs')
-rw-r--r--src/client/openai.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/openai.rs b/src/client/openai.rs
index c002f52..e5f4d23 100644
--- a/src/client/openai.rs
+++ b/src/client/openai.rs
@@ -300,7 +300,11 @@ pub fn openai_build_chat_completions_body(data: ChatCompletionsData, model: &Mod
});
if let Some(v) = model.max_tokens_param() {
- if model.patch().and_then(|v| v.get("body").and_then(|v| v.get("max_tokens"))) == Some(&Value::Null) {
+ if model
+ .patch()
+ .and_then(|v| v.get("body").and_then(|v| v.get("max_tokens")))
+ == Some(&Value::Null)
+ {
body["max_completion_tokens"] = v.into();
} else {
body["max_tokens"] = v.into();