mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-30 17:14:40 +08:00
Merge pull request #6337 from Kilo-Org/session/agent_2b4968a6-6808-4df7-9d6b-e11307fcadbb
Remove fixDuplicateReasoning function
This commit is contained in:
@@ -234,40 +234,10 @@ export namespace ProviderTransform {
|
||||
})
|
||||
}
|
||||
|
||||
// kilocode_change - function added
|
||||
function fixDuplicateReasoning(msgs: ModelMessage[]) {
|
||||
for (const msg of msgs) {
|
||||
if (!Array.isArray(msg.content)) {
|
||||
continue
|
||||
}
|
||||
let isFirstToolCall = true
|
||||
for (const part of msg.content) {
|
||||
if (part.type === "reasoning") {
|
||||
// this entry is corrupt
|
||||
delete part.providerOptions?.openrouter?.reasoning_details
|
||||
}
|
||||
if (part.type === "tool-call" && isFirstToolCall) {
|
||||
isFirstToolCall = false
|
||||
continue
|
||||
}
|
||||
if (part.type === "tool-call") {
|
||||
// this is a duplicate entry
|
||||
delete part.providerOptions?.openrouter?.reasoning_details
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function message(msgs: ModelMessage[], model: Provider.Model, options: Record<string, unknown>) {
|
||||
msgs = unsupportedParts(msgs, model)
|
||||
msgs = normalizeMessages(msgs, model, options)
|
||||
|
||||
// kilocode_change - workaround for @openrouter/ai-sdk-provider v1 duplicating reasoning
|
||||
// fixed in https://github.com/OpenRouterTeam/ai-sdk-provider/pull/344/
|
||||
if (model.api.npm === "@kilocode/kilo-gateway") {
|
||||
fixDuplicateReasoning(msgs)
|
||||
}
|
||||
|
||||
if (
|
||||
(model.providerID === "anthropic" ||
|
||||
model.api.id.includes("anthropic") ||
|
||||
|
||||
Reference in New Issue
Block a user