diff --git a/scripts/lib/wp7-02-controlled-executor.mjs b/scripts/lib/wp7-02-controlled-executor.mjs index 41e1e56..1cfce51 100644 --- a/scripts/lib/wp7-02-controlled-executor.mjs +++ b/scripts/lib/wp7-02-controlled-executor.mjs @@ -38,6 +38,10 @@ function assertModelConfig(modelConfig) { && (profile.reference_endpoint !== "https://oneapi.intelligrow.cn/v1/images/edits")) { 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; } @@ -104,15 +108,16 @@ export function buildProviderRequest({ modelConfig, prompt, ratio, reference }) url: config.route_profile.endpoint, }; } + const providerModelId = config.route_profile.provider_model_id ?? config.model_id; const body = { - model: config.model_id, + model: providerModelId, prompt, response_format: "b64_json", size: gptImageRequestSizeForRatio(ratio), }; if (reference) { const form = new FormData(); - form.append("model", config.model_id); + form.append("model", providerModelId); form.append("prompt", prompt); form.append("response_format", "b64_json"); form.append("size", gptImageRequestSizeForRatio(ratio));