test(gateway): strip MiniMax live scaffolding

This commit is contained in:
Peter Steinberger
2026-03-26 19:34:12 +00:00
parent 53f15afade
commit b48df79c0a

View File

@@ -285,10 +285,17 @@ function shouldStripAssistantScaffoldingForLiveModel(modelKey?: string): boolean
return true;
}
const [provider, ...rest] = modelKey.split("/");
const modelId = rest.join("/");
if (provider === "minimax" || provider === "minimax-portal") {
// MiniMax transcript persistence can mirror our <final> wrapper style even
// though user-visible surfaces already strip it. Keep the live reader
// aligned with the runtime-facing sanitizers for the whole provider family.
return true;
}
if (provider !== "google" || rest.length === 0) {
return false;
}
const normalizedKey = `${provider}/${normalizeGoogleModelId(rest.join("/"))}`;
const normalizedKey = `${provider}/${normalizeGoogleModelId(modelId)}`;
return GATEWAY_LIVE_STRIP_SCAFFOLDING_MODEL_KEYS.has(normalizedKey);
}
@@ -332,6 +339,24 @@ describe("maybeStripAssistantScaffoldingForLiveModel", () => {
),
).toBe("<think>hidden</think>Visible");
});
it("strips scaffolding for MiniMax transcript wrappers", () => {
expect(
maybeStripAssistantScaffoldingForLiveModel(
"<final>Visible</final>",
"minimax/MiniMax-M2.5-highspeed",
),
).toBe("Visible");
expect(
maybeStripAssistantScaffoldingForLiveModel(
"<final>Visible</final>",
"minimax-portal/MiniMax-M2.7-highspeed",
),
).toBe("Visible");
expect(
maybeStripAssistantScaffoldingForLiveModel("<final>Visible</final>", "minimax/MiniMax-M2.7"),
).toBe("Visible");
});
});
function isGoogleModelNotFoundText(text: string): boolean {