mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix(kiro): normalize dashboard thinking intensity models
Strip the generic dashboard model(level) suffix before resolving Kiro synthetic -thinking/-agentic variants so the upstream request no longer carries an invalid parenthesized model id. Map explicit levels to native Kiro effort fields only for supported Claude/GPT model families, and stop advertising native levels for unsupported legacy Kiro models. Applies to both OpenAI→Kiro and direct Claude→Kiro routes.
This commit is contained in:
@@ -424,6 +424,31 @@ describe("openaiToKiroRequest", () => {
|
||||
expect(result.additionalModelRequestFields).toBeUndefined();
|
||||
});
|
||||
|
||||
it.each([
|
||||
["claude-sonnet-4.5-thinking-agentic(high)", "claude-sonnet-4.5"],
|
||||
["glm-5-thinking-agentic(medium)", "glm-5"],
|
||||
])("normalizes unsupported Kiro intensity suffix for %s", (model, upstream) => {
|
||||
const result = openaiToKiroRequest(model, {
|
||||
messages: [{ role: "user", content: "hello" }],
|
||||
}, true, {});
|
||||
|
||||
expect(result.conversationState.currentMessage.userInputMessage.modelId).toBe(upstream);
|
||||
expect(result.additionalModelRequestFields).toBeUndefined();
|
||||
expect(systemPromptOf(result)).toContain("CHUNKED WRITE PROTOCOL");
|
||||
});
|
||||
|
||||
it("maps a supported Kiro Claude intensity suffix to native effort fields", () => {
|
||||
const result = openaiToKiroRequest("claude-sonnet-5-thinking-agentic(high)", {
|
||||
messages: [{ role: "user", content: "hello" }],
|
||||
}, true, {});
|
||||
|
||||
expect(result.conversationState.currentMessage.userInputMessage.modelId).toBe("claude-sonnet-5");
|
||||
expect(result.additionalModelRequestFields).toEqual({
|
||||
thinking: { type: "adaptive", display: "summarized" },
|
||||
output_config: { effort: "high" },
|
||||
});
|
||||
});
|
||||
|
||||
it("does not send additionalModelRequestFields for date-suffixed Claude 4 model ids", () => {
|
||||
const body = {
|
||||
reasoning_effort: "high",
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { getThinkingLevels } from "../../open-sse/providers/thinkingLevels.js";
|
||||
|
||||
describe("getThinkingLevels for Kiro", () => {
|
||||
it("does not advertise native intensity for legacy Kiro models", () => {
|
||||
expect(getThinkingLevels("kiro", "claude-sonnet-4.5")).toBeNull();
|
||||
expect(getThinkingLevels("kiro", "glm-5")).toBeNull();
|
||||
});
|
||||
|
||||
it("advertises native levels for supported Kiro models", () => {
|
||||
expect(getThinkingLevels("kiro", "claude-sonnet-5")).toContain("high");
|
||||
expect(getThinkingLevels("kiro", "gpt-5.6-sol")).toContain("xhigh");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user