mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
* feat(kimi): sync Code, Web, and Moonshot providers * chore(quality): trim frozen file-size overflow in Kimi sync The Kimi/Moonshot provider sync added a net +1 line to both src/sse/services/auth.ts and ProviderDetailPageClient.tsx, pushing each 1 line past its frozen cap in file-size-baseline.json. Drop one optional blank line in each (prettier-neutral, no behavior change) to land back at/under the frozen baseline. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com> --------- Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
82 lines
2.1 KiB
TypeScript
82 lines
2.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
|
|
import { FORMATS } from "../../open-sse/translator/formats.ts";
|
|
import { translateRequest } from "../../open-sse/translator/index.ts";
|
|
|
|
type KimiClaudeRequest = {
|
|
thinking: { type: string; budget_tokens?: number };
|
|
output_config?: { effort?: string };
|
|
messages: Array<{ content: Array<Record<string, unknown>> }>;
|
|
};
|
|
|
|
test("OpenAI to Kimi Anthropic maps effort without inventing a token budget", () => {
|
|
const translated = translateRequest(
|
|
FORMATS.OPENAI,
|
|
FORMATS.CLAUDE,
|
|
"kimi-for-coding",
|
|
{
|
|
model: "kimi-for-coding",
|
|
max_tokens: 4096,
|
|
reasoning_effort: "high",
|
|
messages: [
|
|
{
|
|
role: "assistant",
|
|
content: null,
|
|
reasoning_content: "",
|
|
tool_calls: [
|
|
{
|
|
id: "call_1",
|
|
type: "function",
|
|
function: { name: "search", arguments: "{}" },
|
|
},
|
|
],
|
|
},
|
|
{ role: "user", content: "continue" },
|
|
],
|
|
},
|
|
false,
|
|
{},
|
|
"kimi-coding"
|
|
) as KimiClaudeRequest;
|
|
|
|
assert.deepEqual(translated.thinking, { type: "enabled" });
|
|
assert.deepEqual(translated.output_config, { effort: "high" });
|
|
assert.equal(translated.thinking.budget_tokens, undefined);
|
|
assert.deepEqual(translated.messages[0].content[0], {
|
|
type: "thinking",
|
|
thinking: "",
|
|
});
|
|
});
|
|
|
|
test("Kimi Anthropic preserves an explicit empty thinking block", () => {
|
|
const translated = translateRequest(
|
|
FORMATS.CLAUDE,
|
|
FORMATS.CLAUDE,
|
|
"kimi-for-coding",
|
|
{
|
|
model: "kimi-for-coding",
|
|
max_tokens: 4096,
|
|
thinking: { type: "enabled" },
|
|
messages: [
|
|
{
|
|
role: "assistant",
|
|
content: [
|
|
{ type: "thinking", thinking: "" },
|
|
{ type: "tool_use", id: "toolu_1", name: "search", input: {} },
|
|
],
|
|
},
|
|
{ role: "user", content: [{ type: "text", text: "continue" }] },
|
|
],
|
|
},
|
|
false,
|
|
{},
|
|
"kimi-coding"
|
|
) as KimiClaudeRequest;
|
|
|
|
assert.deepEqual(translated.messages[0].content[0], {
|
|
type: "thinking",
|
|
thinking: "",
|
|
});
|
|
});
|