mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-17 22:35:07 +08:00
Fix strip_routing_prefix to handle kimi provider prefix (US-023)
Add "kimi" to the strip_routing_prefix matches so that models like "kimi/kimi-k2.5" have their prefix stripped before sending to the DashScope API (consistent with qwen/openai/xai/grok handling). Also add unit test strip_routing_prefix_strips_kimi_provider_prefix. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -801,7 +801,7 @@ fn strip_routing_prefix(model: &str) -> &str {
|
||||
let prefix = &model[..pos];
|
||||
// Only strip if the prefix before "/" is a known routing prefix,
|
||||
// not if "/" appears in the middle of the model name for other reasons.
|
||||
if matches!(prefix, "openai" | "xai" | "grok" | "qwen") {
|
||||
if matches!(prefix, "openai" | "xai" | "grok" | "qwen" | "kimi") {
|
||||
&model[pos + 1..]
|
||||
} else {
|
||||
model
|
||||
@@ -2199,4 +2199,12 @@ mod tests {
|
||||
assert_eq!(OpenAiCompatConfig::openai().max_request_body_bytes, 104_857_600); // 100MB
|
||||
assert_eq!(OpenAiCompatConfig::xai().max_request_body_bytes, 52_428_800); // 50MB
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strip_routing_prefix_strips_kimi_provider_prefix() {
|
||||
// US-023: kimi prefix should be stripped for wire format
|
||||
assert_eq!(super::strip_routing_prefix("kimi/kimi-k2.5"), "kimi-k2.5");
|
||||
assert_eq!(super::strip_routing_prefix("kimi-k2.5"), "kimi-k2.5"); // no prefix, unchanged
|
||||
assert_eq!(super::strip_routing_prefix("kimi/kimi-k1.5"), "kimi-k1.5");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user