feat(wp7-02): map provider image model ids
Dada P0-A isolated Windows CI / validate-and-package (push) Canceled after 0s
Dada P0-A isolated Windows CI / validate-and-package (push) Canceled after 0s
This commit is contained in:
@@ -38,6 +38,10 @@ function assertModelConfig(modelConfig) {
|
|||||||
&& (profile.reference_endpoint !== "https://oneapi.intelligrow.cn/v1/images/edits")) {
|
&& (profile.reference_endpoint !== "https://oneapi.intelligrow.cn/v1/images/edits")) {
|
||||||
throw new Error("WP7_02_REFERENCE_ROUTE_PROFILE_INVALID");
|
throw new Error("WP7_02_REFERENCE_ROUTE_PROFILE_INVALID");
|
||||||
}
|
}
|
||||||
|
if (profile.protocol_version === "openai-images-v1" && profile.provider_model_id !== undefined
|
||||||
|
&& profile.provider_model_id !== "gemini-3.1-flash-image") {
|
||||||
|
throw new Error("WP7_02_ROUTE_PROFILE_INVALID");
|
||||||
|
}
|
||||||
return modelConfig;
|
return modelConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,15 +108,16 @@ export function buildProviderRequest({ modelConfig, prompt, ratio, reference })
|
|||||||
url: config.route_profile.endpoint,
|
url: config.route_profile.endpoint,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
const providerModelId = config.route_profile.provider_model_id ?? config.model_id;
|
||||||
const body = {
|
const body = {
|
||||||
model: config.model_id,
|
model: providerModelId,
|
||||||
prompt,
|
prompt,
|
||||||
response_format: "b64_json",
|
response_format: "b64_json",
|
||||||
size: gptImageRequestSizeForRatio(ratio),
|
size: gptImageRequestSizeForRatio(ratio),
|
||||||
};
|
};
|
||||||
if (reference) {
|
if (reference) {
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
form.append("model", config.model_id);
|
form.append("model", providerModelId);
|
||||||
form.append("prompt", prompt);
|
form.append("prompt", prompt);
|
||||||
form.append("response_format", "b64_json");
|
form.append("response_format", "b64_json");
|
||||||
form.append("size", gptImageRequestSizeForRatio(ratio));
|
form.append("size", gptImageRequestSizeForRatio(ratio));
|
||||||
|
|||||||
Reference in New Issue
Block a user