From 125a7d795f87fbfdb0e25b07730e79471f873fb5 Mon Sep 17 00:00:00 2001 From: QiuYang Shen <1741258352@qq.com> Date: Mon, 28 Jul 2025 11:39:17 +0800 Subject: [PATCH] feat: add tool call support for moonshot models --- core/llm/autodetect.ts | 1 + core/llm/toolSupport.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/core/llm/autodetect.ts b/core/llm/autodetect.ts index a220b5dbd..02e241815 100644 --- a/core/llm/autodetect.ts +++ b/core/llm/autodetect.ts @@ -188,6 +188,7 @@ function autodetectTemplateType(model: string): TemplateType | undefined { lower.includes("gemini") || lower.includes("grok") || lower.includes("moonshot") || + lower.includes("kimi") || lower.includes("mercury") || /^o\d/.test(lower) ) { diff --git a/core/llm/toolSupport.ts b/core/llm/toolSupport.ts index a3b643c34..99bea4baf 100644 --- a/core/llm/toolSupport.ts +++ b/core/llm/toolSupport.ts @@ -285,6 +285,22 @@ export const PROVIDER_TOOL_SUPPORT: Record boolean> = } } + return false; + }, + moonshot: (model) => { + // support moonshot models + // https://platform.moonshot.ai/docs/pricing/chat#concepts + if ( + model.toLowerCase().startsWith("kimi") && + model.toLowerCase() !== "kimi-thinking-preview" + ) { + return true; + } + + if (model.toLowerCase().startsWith("moonshot")) { + return true; + } + return false; }, };