feat(POSTV1-02): 增加AI真实生成探测
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run
Dada P0-A isolated Windows CI / validate-and-package (push) Waiting to run
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { GenerationAdapterRequest } from "../../apps/worker/src/ai-adapter-contract.js";
|
||||
import { runAiRuntimeProbe } from "../../apps/worker/src/ai-runtime-probe.js";
|
||||
import { OneApiGenerationAdapter } from "../../apps/worker/src/oneapi-generation-adapter.js";
|
||||
|
||||
function request(overrides: Partial<GenerationAdapterRequest> = {}): GenerationAdapterRequest {
|
||||
@@ -63,4 +64,22 @@ describe("POSTV1-02 OneAPI runtime adapter", () => {
|
||||
status: "failed",
|
||||
});
|
||||
});
|
||||
|
||||
it("returns only a bounded probe summary and wipes generated bytes", async () => {
|
||||
const bytes = Buffer.from("probe-output");
|
||||
const result = await runAiRuntimeProbe({
|
||||
async start() {
|
||||
return { outputs: [{ bytes, mimeType: "image/png", pixelHeight: 1080, pixelWidth: 1080 }], status: "completed" };
|
||||
},
|
||||
});
|
||||
expect(result).toEqual({
|
||||
code: "ai_probe_passed",
|
||||
mime_type: "image/png",
|
||||
pixel_height: 1080,
|
||||
pixel_width: 1080,
|
||||
real_calls: 1,
|
||||
success: true,
|
||||
});
|
||||
expect(bytes.every((value) => value === 0)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user