Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/renderer/src/store/thunk/messageThunk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ const createSSEReadableStream = (

const abortHandler = () => {
cancelReader(signal.reason ?? 'aborted')
// Enqueue an 'abort' stream part before erroring, matching AI SDK stream behavior.
// Without this, AiSdkToChunkAdapter never emits the ERROR chunk, so callbacks.onError
// is never called and block statuses (e.g., thinking timer) are not updated on abort.
try {
controller.enqueue({ type: 'abort' } as TextStreamPart<Record<string, any>>)
} catch {
// Controller may already be closed
}
controller.error(new DOMException('Aborted', 'AbortError'))
}

Expand Down
Loading