fix: Add Moonshot provider tool call ID sanitization to prevent 'duplicated' errors
- Add Moonshot to PLUGIN_CAPABILITIES_FALLBACKS with transcriptToolCallIdMode: 'strict' - Update resolveTranscriptToolCallIdMode to return 'strict' mode in addition to 'strict9' - Enable sanitizeToolCallIds when providerToolCallIdMode is set Fixes HTTP 400 error: 'tool call id write:XXX is duplicated' when using Moonshot/Kimi provider
This commit is contained in:
parent
fcabecc9a4
commit
42cd74528f
@ -46,6 +46,10 @@ const PLUGIN_CAPABILITIES_FALLBACKS: Record<string, Partial<ProviderCapabilities
|
||||
providerFamily: "anthropic",
|
||||
dropThinkingBlockModelHints: ["claude"],
|
||||
},
|
||||
moonshot: {
|
||||
transcriptToolCallIdMode: "strict",
|
||||
transcriptToolCallIdModelHints: ["kimi", "moonshot"],
|
||||
},
|
||||
mistral: {
|
||||
transcriptToolCallIdMode: "strict9",
|
||||
transcriptToolCallIdModelHints: [
|
||||
@ -193,10 +197,10 @@ export function resolveTranscriptToolCallIdMode(
|
||||
provider?: string | null,
|
||||
modelId?: string | null,
|
||||
options?: ProviderCapabilityLookupOptions,
|
||||
): "strict9" | undefined {
|
||||
): "strict9" | "strict" | undefined {
|
||||
const capabilities = resolveProviderCapabilities(provider, options);
|
||||
const mode = capabilities.transcriptToolCallIdMode;
|
||||
if (mode === "strict9") {
|
||||
if (mode === "strict9" || mode === "strict") {
|
||||
return mode;
|
||||
}
|
||||
if (modelIncludesAnyHint(modelId, capabilities.transcriptToolCallIdModelHints)) {
|
||||
|
||||
@ -92,7 +92,7 @@ export function resolveTranscriptPolicy(params: {
|
||||
isGoogle || isAnthropic || isMistral || shouldSanitizeGeminiThoughtSignaturesForProvider;
|
||||
|
||||
const sanitizeToolCallIds =
|
||||
isGoogle || isMistral || isAnthropic || requiresOpenAiCompatibleToolIdSanitization;
|
||||
isGoogle || isMistral || isAnthropic || requiresOpenAiCompatibleToolIdSanitization || !!providerToolCallIdMode;
|
||||
const toolCallIdMode: ToolCallIdMode | undefined = providerToolCallIdMode
|
||||
? providerToolCallIdMode
|
||||
: isMistral
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user