fix(OpenAIProvider): Enhanced function arguments fault tolerance (#3267)

This commit is contained in:
Chris Wan 2025-03-13 21:40:02 +08:00 committed by GitHub
parent a0fde96b40
commit 52de270d04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -373,6 +373,9 @@ export default class OpenAIProvider extends BaseProvider {
} }
} else { } else {
for (let i = 0; i < chunkToolCalls.length; i++) { for (let i = 0; i < chunkToolCalls.length; i++) {
if (typeof toolCalls[i].function.arguments !== 'string') {
toolCalls[i].function.arguments = ''
}
toolCalls[i].function.arguments += chunkToolCalls[i].function?.arguments || '' toolCalls[i].function.arguments += chunkToolCalls[i].function?.arguments || ''
} }
} }