
























@@ -1,13 +1,15 @@
11import { describe, expect, it } from "vitest";
22import {
33buildLiveModelFileProbeContext,
4+buildLiveModelFileProbeRetryContext,
45buildLiveModelImageProbeContext,
56extractAssistantText,
67fileProbeTextMatches,
78imageProbeTextMatches,
89isLiveModelProbeEnabled,
910LIVE_MODEL_FILE_PROBE_TOKEN,
1011modelSupportsImageInput,
12+shouldSkipLiveModelExtraProbes,
1113} from "./live-model-turn-probes.js";
12141315describe("live model turn probes", () => {
@@ -27,15 +29,19 @@ describe("live model turn probes", () => {
2729).toBe(true);
2830});
293130-it("builds a text-block file read probe", () => {
32+it("builds a text file read probe", () => {
3133const context = buildLiveModelFileProbeContext({ systemPrompt: "sys" });
3234expect(context.systemPrompt).toBe("sys");
33-expect(context.messages[0]?.content).toEqual([
34-expect.objectContaining({
35-type: "text",
36-text: expect.stringContaining(`LIVE_FILE_TOKEN=${LIVE_MODEL_FILE_PROBE_TOKEN}`),
37-}),
38-]);
35+expect(context.messages[0]?.content).toEqual(
36+expect.stringContaining(`LIVE_FILE_TOKEN=${LIVE_MODEL_FILE_PROBE_TOKEN}`),
37+);
38+});
39+40+it("builds a stricter file read retry probe", () => {
41+const context = buildLiveModelFileProbeRetryContext({});
42+expect(context.messages[0]?.content).toEqual(
43+expect.stringContaining(`Reply with exactly ${LIVE_MODEL_FILE_PROBE_TOKEN}`),
44+);
3945});
40464147it("builds an image probe with native image content", () => {
@@ -63,9 +69,24 @@ describe("live model turn probes", () => {
6369expect(modelSupportsImageInput({ input: ["text"] })).toBe(false);
6470});
657172+it("skips known stale extra probe routes", () => {
73+expect(
74+shouldSkipLiveModelExtraProbes({
75+provider: "openrouter",
76+id: "amazon/nova-2-lite-v1",
77+}),
78+).toBe(true);
79+expect(
80+shouldSkipLiveModelExtraProbes({
81+provider: "openrouter",
82+id: "amazon/nova-lite-v1",
83+}),
84+).toBe(false);
85+});
86+6687it("matches expected probe replies", () => {
6788expect(fileProbeTextMatches(`The value is ${LIVE_MODEL_FILE_PROBE_TOKEN}.`)).toBe(true);
68-expect(fileProbeTextMatches("OPAL-731")).toBe(false);
89+expect(fileProbeTextMatches("amber")).toBe(false);
6990expect(imageProbeTextMatches("OK")).toBe(true);
7091expect(imageProbeTextMatches("blue")).toBe(false);
7192});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。