File tree Expand file tree Collapse file tree
packages/cli/src/ui/hooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,27 +143,11 @@ export const useCommandHandler = (
143143 // ensureStoreInitialized 是唯一的初始化点,必须在 processSlashCommand 前调用
144144 await ensureStoreInitialized ( ) ;
145145
146- // 检查是否有正在运行的任务
147- const wasProcessing = isProcessing ;
148-
149- const abortController = commandActions . createAbortController ( ) ;
150-
151- // 如果之前有任务在运行,显示中断消息
152- if ( wasProcessing ) {
153- // drain 缓冲区,保留已接收内容
154- const { extraContent, extraThinking } = streamingBuffer . drainPendingBuffers ( ) ;
155-
156- // 用 drain 结果 finalize,确保已收内容提交到 store
157- const streamingId = getState ( ) . session . currentStreamingMessageId ;
158- if ( streamingId ) {
159- if ( extraContent ) appendMarkdownDelta ( streamingId , extraContent ) ;
160- finalizeMarkdownCache ( streamingId ) ;
161- }
162- sessionActions . finalizeStreamingMessage ( extraContent , extraThinking ) ;
163-
164- // 显示中断消息
165- sessionActions . addAssistantMessage ( '上一条消息已中断' ) ;
166- }
146+ // 复用 executeCommand 中已创建的 controller。
147+ // 不能再次调用 createAbortController():它会中止并替换上层的 controller,
148+ // 导致 executeCommand 的 finally 中 isOurTask 检查失败,isProcessing 永远不被重置。
149+ const abortController =
150+ commandActions . getAbortController ( ) ?? commandActions . createAbortController ( ) ;
167151
168152 const slashResult = await processSlashCommand (
169153 resolved ,
You can’t perform that action at this time.
0 commit comments