This commit is contained in:
Deleted user 2026-05-27 10:09:54 +08:00 committed by GitHub
commit f42e5c576d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -224,12 +224,15 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
// Convert Anthropic messages to OpenAI format.
// Pass normalization function for Mistral compatibility (requires 9-char alphanumeric IDs)
const isMistral = modelId.toLowerCase().includes("mistral")
// Also detect Devstral models which are part of the Mistral family
const isMistralFamily = modelId.toLowerCase().includes("mistral") || modelId.toLowerCase().includes("devstral")
let openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [
{ role: "system", content: systemPrompt },
...convertToOpenAiMessages(
messages,
isMistral ? { normalizeToolCallId: normalizeMistralToolCallId } : undefined,
isMistralFamily
? { normalizeToolCallId: normalizeMistralToolCallId, mergeToolResultText: true }
: undefined,
),
]