mirror of
https://github.com/sigoden/aichat
synced 2024-11-16 06:15:26 +00:00
This commit is contained in:
parent
4b27378443
commit
ce8d6d750d
@ -262,12 +262,7 @@ pub fn gemini_build_chat_completions_body(
|
||||
stream: _,
|
||||
} = data;
|
||||
|
||||
let mut system_message = None;
|
||||
if model.name().starts_with("gemini-1.5") {
|
||||
system_message = extract_system_message(&mut messages);
|
||||
} else {
|
||||
patch_system_message(&mut messages);
|
||||
};
|
||||
patch_system_message(&mut messages);
|
||||
|
||||
let mut network_image_urls = vec![];
|
||||
let contents: Vec<Value> = messages
|
||||
@ -338,10 +333,6 @@ pub fn gemini_build_chat_completions_body(
|
||||
|
||||
let mut body = json!({ "contents": contents, "generationConfig": {} });
|
||||
|
||||
if let Some(v) = system_message {
|
||||
body["systemInstruction"] = json!({ "parts": [{ "text": v }] });
|
||||
}
|
||||
|
||||
if let Some(v) = model.max_tokens_param() {
|
||||
body["generationConfig"]["maxOutputTokens"] = v.into();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user