fix: should not include reasoning text in the chat completion request

This commit is contained in:
Louis 2025-08-06 17:07:32 +07:00
parent 4727132d3c
commit 804b0f0116
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2

View File

@ -102,6 +102,15 @@ export class CompletionMessagesBuilder {
content = content.slice(splitIndex).trim()
}
}
if (content.includes('<|channel|>analysis<|message|>')) {
const match = content.match(
/<\|channel\|>analysis<\|message\|>([\s\S]*?)<\|start\|>assistant<\|channel\|>final<\|message\|>/
)
if (match?.index !== undefined) {
const splitIndex = match.index + match[0].length
content = content.slice(splitIndex).trim()
}
}
return content
}
}