fix: preserve provider image response formats
This commit is contained in:
1 parent
94eaee7b95
commit
e6d23afd58
1 file changed
+6
-1
+6
-1
@@ -100,7 +100,12 @@ public class AsyncProviderClient {
|
|||||||
String base = trim(provider.baseUrl());
|
String base = trim(provider.baseUrl());
|
||||||
if ("image".equalsIgnoreCase(taskType)) {
|
if ("image".equalsIgnoreCase(taskType)) {
|
||||||
Map<String,Object> body = new LinkedHashMap<>();
|
Map<String,Object> body = new LinkedHashMap<>();
|
||||||
body.put("model", model); body.put("prompt", prompt); body.put("n", 1); body.put("response_format", "url");
|
body.put("model", model); body.put("prompt", prompt); body.put("n", 1);
|
||||||
|
// DALL-E accepts `url` while GPT-image models require
|
||||||
|
// `b64_json` and reject response_format altogether. Forward an
|
||||||
|
// explicitly requested format only; otherwise let the provider
|
||||||
|
// choose its documented default and normalize either shape.
|
||||||
|
copyParameter(input, body, "response_format");
|
||||||
copyParameter(input, body, "size");
|
copyParameter(input, body, "size");
|
||||||
Map<String,Object> response = media == null
|
Map<String,Object> response = media == null
|
||||||
? request("POST", base + "/images/generations", provider.nextApiKey(), body, "上游图片任务创建失败")
|
? request("POST", base + "/images/generations", provider.nextApiKey(), body, "上游图片任务创建失败")
|
||||||
|
|||||||
Reference in new issue
Block a user