mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-25 11:20:07 +08:00
fix(OpenAIProvider): ensure tool_calls are only yielded when present (#6861)
This update modifies the OpenAIProvider to yield tool_calls only if they exist and have a length greater than zero, improving the handling of delta content. Additionally, a minor cleanup was performed by removing an unnecessary blank line in the code.
This commit is contained in:
parent
b44b397cdd
commit
dd15b391c5
@ -635,7 +635,7 @@ export default class OpenAIProvider extends BaseOpenAIProvider {
|
||||
if (delta?.content) {
|
||||
yield { type: 'text-delta', textDelta: delta.content }
|
||||
}
|
||||
if (delta?.tool_calls) {
|
||||
if (delta?.tool_calls && delta?.tool_calls.length > 0) {
|
||||
yield { type: 'tool-calls', delta: delta }
|
||||
}
|
||||
|
||||
@ -664,7 +664,6 @@ export default class OpenAIProvider extends BaseOpenAIProvider {
|
||||
for await (const chunk of readableStreamAsyncIterable(processedStream)) {
|
||||
const delta = chunk.type === 'finish' ? chunk.delta : chunk
|
||||
const rawChunk = chunk.type === 'finish' ? chunk.chunk : chunk
|
||||
|
||||
switch (chunk.type) {
|
||||
case 'reasoning': {
|
||||
if (time_first_token_millsec === 0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user