mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-10-08 15:43:10 +08:00
fix: set OpenAI Responses image detail to auto
This commit is contained in:
@@ -453,6 +453,7 @@ fn responses_content(parts: &[ContentPart], text_type: &str) -> Result<Vec<Value
|
|||||||
ContentPart::Text { text } => Some(Ok(json!({"type":text_type, "text":text}))),
|
ContentPart::Text { text } => Some(Ok(json!({"type":text_type, "text":text}))),
|
||||||
ContentPart::Image { mime_type, data } => Some(Ok(json!({
|
ContentPart::Image { mime_type, data } => Some(Ok(json!({
|
||||||
"type":"input_image",
|
"type":"input_image",
|
||||||
|
"detail":"auto",
|
||||||
"image_url":format!("data:{mime_type};base64,{}", STANDARD.encode(data)),
|
"image_url":format!("data:{mime_type};base64,{}", STANDARD.encode(data)),
|
||||||
}))),
|
}))),
|
||||||
})
|
})
|
||||||
@@ -539,5 +540,6 @@ mod tests {
|
|||||||
assert_eq!(input[0]["call_id"], "call");
|
assert_eq!(input[0]["call_id"], "call");
|
||||||
assert_eq!(input[0]["output"][0]["type"], "input_text");
|
assert_eq!(input[0]["output"][0]["type"], "input_text");
|
||||||
assert_eq!(input[0]["output"][1]["type"], "input_image");
|
assert_eq!(input[0]["output"][1]["type"], "input_image");
|
||||||
|
assert_eq!(input[0]["output"][1]["detail"], "auto");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ async fn openai_responses_raw_stream_does_not_invent_reasoning_effort() {
|
|||||||
assert!(body.get("service_tier").is_none());
|
assert!(body.get("service_tier").is_none());
|
||||||
assert_eq!(body["max_output_tokens"], 4096);
|
assert_eq!(body["max_output_tokens"], 4096);
|
||||||
assert_eq!(body["input"][0]["content"][1]["type"], "input_image");
|
assert_eq!(body["input"][0]["content"][1]["type"], "input_image");
|
||||||
|
assert_eq!(body["input"][0]["content"][1]["detail"], "auto");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
body["input"][0]["content"][1]["image_url"],
|
body["input"][0]["content"][1]["image_url"],
|
||||||
"data:image/png;base64,AQID"
|
"data:image/png;base64,AQID"
|
||||||
|
|||||||
Reference in New Issue
Block a user