mirror of
https://github.com/luckyyzh/pi-agent-integrated.git
synced 2026-10-03 02:59:35 +00:00
feat: integrate Pi backend and Pi Web
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { complete, getModel } from "../src/compat.ts";
|
||||
import type { Context } from "../src/types.ts";
|
||||
|
||||
describe.skipIf(!process.env.OPENAI_API_KEY)("openai responses cache affinity e2e", () => {
|
||||
it("handles direct OpenAI Responses requests with aligned cache-affinity identifiers", { retry: 2 }, async () => {
|
||||
const model = getModel("openai", "gpt-5.4");
|
||||
const sessionId = "0195d6e4-4cf9-7f44-a2d8-f8f7f49ee9d3";
|
||||
const context: Context = {
|
||||
systemPrompt: "You are a helpful assistant. Reply exactly as requested.",
|
||||
messages: [
|
||||
{
|
||||
role: "user",
|
||||
content: "Reply with exactly: openai cache affinity e2e success",
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
const response = await complete(model, context, {
|
||||
apiKey: process.env.OPENAI_API_KEY!,
|
||||
sessionId,
|
||||
});
|
||||
|
||||
expect(response.stopReason, response.errorMessage).not.toBe("error");
|
||||
expect(response.errorMessage).toBeUndefined();
|
||||
expect(response.content.map((block) => (block.type === "text" ? block.text : "")).join("")).toContain(
|
||||
"openai cache affinity e2e success",
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user