fix(kimi): apply K3 effort policy to aliases (#10005)

This commit is contained in:
Ke Jin
2026-08-11 19:55:41 +08:00
committed by GitHub
parent e3675916c9
commit 549739a9b7
2 changed files with 19 additions and 1 deletions

View File

@@ -25,7 +25,9 @@ const KIMI_CODE_STATIC_THINKING_POLICIES: Record<string, KimiCodeThinkingPolicy>
export function getKimiCodeStaticThinkingPolicy(modelId: unknown): KimiCodeThinkingPolicy | null {
if (typeof modelId !== "string") return null;
return KIMI_CODE_STATIC_THINKING_POLICIES[modelId] || null;
const normalizedModel = modelId.trim().toLowerCase().split("/").pop() || "";
if (/^k3(?:$|-)/.test(normalizedModel)) return KIMI_CODE_STATIC_THINKING_POLICIES.k3;
return KIMI_CODE_STATIC_THINKING_POLICIES[normalizedModel] || null;
}
export type KimiCodeDeviceIdentity = {

View File

@@ -263,6 +263,22 @@ test("handleResponsesCore preserves Kimi K3 reasoning through provider translati
assert.equal(native.call.body.messages?.[1]?.reasoning_content, "I should search first.");
});
test("handleResponsesCore maps unsupported Kimi K3 xhigh effort to max", async () => {
const { call, result } = await invokeResponsesCore({
body: {
model: "k3-256k",
reasoning: { effort: "xhigh", summary: "auto" },
input: "Reply with OK.",
},
provider: "kimi-coding-apikey",
model: "k3-256k",
});
assert.equal(result.success, true);
assert.deepEqual(call.body.thinking, { type: "enabled" });
assert.deepEqual(call.body.output_config, { effort: "max" });
});
test("handleResponsesCore strips previous_response_id by default and handles empty input arrays", async () => {
const { call, result } = await invokeResponsesCore({
body: {