mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 09:22:14 +00:00
61 lines
1.7 KiB
TypeScript
61 lines
1.7 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { stripOpencodeGoKimiReasoningPayload } from "./reasoning-sanitizer.js";
|
|
|
|
describe("OpenCode Go Kimi reasoning payload sanitizer", () => {
|
|
it("strips unsupported replay reasoning fields from messages and input", () => {
|
|
const payload = {
|
|
model: "kimi-k2.6",
|
|
reasoning_effort: "high",
|
|
reasoning: { effort: "high" },
|
|
reasoningEffort: "high",
|
|
messages: [
|
|
{
|
|
role: "assistant",
|
|
content: [
|
|
{ type: "text", text: "done" },
|
|
{ type: "thinking", reasoning_details: [{ text: "private thought" }] },
|
|
{ type: "redacted_thinking", data: "opaque" },
|
|
],
|
|
reasoning_details: [{ text: "private thought" }],
|
|
reasoning_content: "private thought",
|
|
reasoning_text: "private thought",
|
|
},
|
|
],
|
|
input: [
|
|
{
|
|
role: "assistant",
|
|
content: "done",
|
|
reasoning_details: [{ text: "private thought" }],
|
|
},
|
|
{ type: "reasoning", summary: [] },
|
|
{
|
|
role: "assistant",
|
|
content: [{ type: "thinking", reasoning_details: [{ text: "private thought" }] }],
|
|
},
|
|
],
|
|
};
|
|
|
|
stripOpencodeGoKimiReasoningPayload(payload);
|
|
|
|
expect(payload).toEqual({
|
|
model: "kimi-k2.6",
|
|
messages: [
|
|
{
|
|
role: "assistant",
|
|
content: [{ type: "text", text: "done" }],
|
|
},
|
|
],
|
|
input: [
|
|
{
|
|
role: "assistant",
|
|
content: "done",
|
|
},
|
|
{
|
|
role: "assistant",
|
|
content: [{ type: "text", text: "[assistant reasoning omitted]" }],
|
|
},
|
|
],
|
|
});
|
|
});
|
|
});
|