test(wp7-02): require Gemini chat image relay
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:
@@ -72,6 +72,17 @@ const stableFlashOpenAiImageModel = {
|
||||
},
|
||||
};
|
||||
|
||||
const stableFlashOpenAiChatModel = {
|
||||
config_version: 7,
|
||||
model_id: "gemini-3.1-flash-image-preview",
|
||||
route_profile: {
|
||||
endpoint: "https://oneapi.intelligrow.cn/v1/chat/completions",
|
||||
mode: "sync",
|
||||
protocol_version: "gemini-openai-chat-v1",
|
||||
provider_model_id: "gemini-3.1-flash-image",
|
||||
},
|
||||
};
|
||||
|
||||
const onePixelPng = Buffer.from(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=",
|
||||
"base64",
|
||||
@@ -142,6 +153,27 @@ test("TDD-WP7-EXT-001 builds protocol-specific requests without auth in argument
|
||||
size: "1408x1056",
|
||||
});
|
||||
|
||||
const stableOpenAiChat = buildProviderRequest({
|
||||
modelConfig: stableFlashOpenAiChatModel,
|
||||
prompt: "controlled fixture prompt",
|
||||
ratio: "4:3",
|
||||
reference,
|
||||
});
|
||||
assert.deepEqual(stableOpenAiChat.body, {
|
||||
extra_body: { google: { image_config: { aspect_ratio: "4:3", image_size: "1K" } } },
|
||||
messages: [{
|
||||
content: [
|
||||
{ text: "controlled fixture prompt", type: "text" },
|
||||
{ image_url: { url: `data:image/png;base64,${onePixelPng.toString("base64")}` }, type: "image_url" },
|
||||
],
|
||||
role: "user",
|
||||
}],
|
||||
model: "gemini-3.1-flash-image",
|
||||
stream: false,
|
||||
});
|
||||
assert.equal(stableOpenAiChat.url, "https://oneapi.intelligrow.cn/v1/chat/completions");
|
||||
assert.equal("authorization" in stableOpenAiChat.headers, false);
|
||||
|
||||
const openai = buildProviderRequest({ modelConfig: models[2], prompt: "controlled fixture prompt", ratio: "9:16" });
|
||||
assert.deepEqual(openai.body, {
|
||||
model: "gpt-image-2",
|
||||
@@ -182,6 +214,14 @@ test("TDD-WP7-EXT-001 retains only response metadata and hashes", () => {
|
||||
assert.deepEqual(interactionNormalized.dimensions, { height: 1, width: 1 });
|
||||
assert.equal(interactionNormalized.mime, "image/png");
|
||||
assert.deepEqual(interactionNormalized.usage_summary, { input_units: 11, output_units: 13, total_units: 24 });
|
||||
|
||||
const chatNormalized = normalizeProviderResponse(stableFlashOpenAiChatModel, {
|
||||
choices: [{ message: { content: `})` } }],
|
||||
usage: { completion_tokens: 17, prompt_tokens: 15, total_tokens: 32 },
|
||||
});
|
||||
assert.deepEqual(chatNormalized.dimensions, { height: 1, width: 1 });
|
||||
assert.equal(chatNormalized.mime, "image/png");
|
||||
assert.deepEqual(chatNormalized.usage_summary, { input_units: 15, output_units: 17, total_units: 32 });
|
||||
});
|
||||
|
||||
test("TDD-WP7-EXT-001 rejects sensitive or shared evidence fields", () => {
|
||||
|
||||
Reference in New Issue
Block a user