fix: hide unsupported vip98k image editors

This commit is contained in:
134 2026-09-08 09:59:54 +08:00
parent d10068874e
commit f5a4cca1fe
2 changed files with 41 additions and 0 deletions

View File

@ -199,6 +199,14 @@ const VERIFIED_2026_IMAGE_MODEL_PATTERNS = [
/^youchuan\/v8\.1(?:$|[-/])/,
];
// These catalog entries currently expose array-shaped request metadata but do
// not provide reliable multi-reference editing. Keep them out of image pickers
// until the provider publishes and verifies a real multi-image contract.
const VIP98K_MULTI_IMAGE_MODEL_EXCLUSIONS = new Set([
"nano-banana-2-lite",
"nano-banana-fast",
]);
function toRecord(value: unknown): Record<string, unknown> | null {
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
return value as Record<string, unknown>;
@ -443,6 +451,11 @@ function hasMultiImageReferenceInput(model: Vip98kCatalogModel) {
}
export function isVip98kMultiImageEditCatalogModel(model: Vip98kCatalogModel) {
if (
VIP98K_MULTI_IMAGE_MODEL_EXCLUSIONS.has(getModelId(model).toLowerCase())
) {
return false;
}
return (
resolvePresetType(model) === "image" &&
hasMediaReferenceInput(model, "image") &&

View File

@ -527,6 +527,34 @@ test.describe("VIP98K reference-image routing", () => {
expect(presets).toEqual([]);
});
test("excludes Lite and Fast even when catalog metadata claims image arrays", () => {
const presets = buildVip98kModelPresets(
["nano-banana-2-lite", "nano-banana-fast"].map((modelId) => ({
id: modelId,
type: "image",
capabilities: ["text_to_image", "image_to_image"],
invocation: {
kind: "task",
method: "POST",
path: "/extensions/v1/tasks",
content_type: "application/json",
request_example: {
file_urls: ["https://api.vip98k.com/logo.png"],
model: modelId,
prompt: "Edit",
},
input_schema: {
properties: {
file_urls: { type: "array", maxItems: 8 },
},
},
},
})),
);
expect(presets).toEqual([]);
});
test("maps frontend ratio and resolution to the VIP98K V2 size contract", () => {
expect(
resolveVip98kImageTaskSize({