mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:40:07 +08:00
fix: auto-complete thinking when text output starts
This fixes the issue where the thinking timer continues running after thinking is complete and text output begins. Some AI providers don't send a reasoning-end event explicitly, so we now auto-complete thinking when a text-start event is received with accumulated reasoning content. Fixes #11796 Signed-off-by: Calvin <calvinvwei@gmail.com>
This commit is contained in:
parent
1ce2076185
commit
cc6fcda856
@ -145,6 +145,15 @@ export class AiSdkToChunkAdapter {
|
||||
}
|
||||
// === 文本相关事件 ===
|
||||
case 'text-start':
|
||||
// 如果有未完成的思考内容,先生成 THINKING_COMPLETE
|
||||
// 这处理了某些提供商不发送 reasoning-end 事件的情况
|
||||
if (final.reasoningContent) {
|
||||
this.onChunk({
|
||||
type: ChunkType.THINKING_COMPLETE,
|
||||
text: final.reasoningContent
|
||||
})
|
||||
final.reasoningContent = ''
|
||||
}
|
||||
this.onChunk({
|
||||
type: ChunkType.TEXT_START
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user