diff --git a/src/renderer/src/services/messageStreaming/callbacks/baseCallbacks.ts b/src/renderer/src/services/messageStreaming/callbacks/baseCallbacks.ts index 146266fd9d..7000ad3d58 100644 --- a/src/renderer/src/services/messageStreaming/callbacks/baseCallbacks.ts +++ b/src/renderer/src/services/messageStreaming/callbacks/baseCallbacks.ts @@ -108,10 +108,17 @@ export const createBaseCallbacks = (deps: BaseCallbacksDependencies) => { const possibleBlockId = findBlockIdForCompletion() if (possibleBlockId) { - // 更改上一个block的状态为ERROR - const changes = { + // 更改上一个block的状态为ERROR/PAUSED + const changes: Record = { status: isErrorTypeAbort ? MessageBlockStatus.PAUSED : MessageBlockStatus.ERROR } + // 如果是 thinking block,保留实际思考时间 + if (blockManager.lastBlockType === MessageBlockType.THINKING) { + const thinkingInfo = getCurrentThinkingInfo?.() + if (thinkingInfo?.blockId === possibleBlockId && thinkingInfo?.millsec && thinkingInfo.millsec > 0) { + changes.thinking_millsec = thinkingInfo.millsec + } + } blockManager.smartBlockUpdate(possibleBlockId, changes, blockManager.lastBlockType!, true) }