fix(wp7-02): update Gemini routes to v1
Dada P0-A isolated Windows CI / validate-and-package (push) Failing after 2m12s

This commit is contained in:
suyx
2026-08-04 17:09:58 +08:00
parent b8e30ab0b2
commit 0938997327
3 changed files with 16 additions and 16 deletions
+3 -3
View File
@@ -28,7 +28,7 @@ function assertModelConfig(modelConfig) {
const profile = modelConfig.route_profile;
if (!profile || typeof profile !== "object" || typeof profile.endpoint !== "string"
|| !profile.endpoint.startsWith("https://oneapi.intelligrow.cn/")
|| !["gemini-native-v1beta", "openai-images-v1"].includes(profile.protocol_version)) {
|| !["gemini-native-v1", "openai-images-v1"].includes(profile.protocol_version)) {
throw new Error("WP7_02_ROUTE_PROFILE_INVALID");
}
return modelConfig;
@@ -67,7 +67,7 @@ export function buildProviderRequest({ modelConfig, prompt, ratio, reference })
throw new Error("WP7_02_REFERENCE_FIXTURE_INVALID");
}
const headers = { "content-type": "application/json" };
if (config.route_profile.protocol_version === "gemini-native-v1beta") {
if (config.route_profile.protocol_version === "gemini-native-v1") {
const parts = [{ text: prompt }];
if (reference) parts.push({ inlineData: { data: reference.bytes.toString("base64"), mimeType: reference.mime_type } });
return {
@@ -170,7 +170,7 @@ export function normalizeProviderResponse(modelConfig, response) {
let bytes;
let mime;
let usageSummary;
if (config.route_profile.protocol_version === "gemini-native-v1beta") {
if (config.route_profile.protocol_version === "gemini-native-v1") {
const parts = response?.candidates?.flatMap((candidate) => candidate?.content?.parts ?? []) ?? [];
const images = parts.map((part) => part?.inlineData ?? part?.inline_data).filter((entry) => entry?.data);
if (images.length !== 1) throw new Error("WP7_02_RESPONSE_SINGLE_IMAGE_REQUIRED");