feat(P0-A): 整合第一版并冻结最终发布 #1
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user