feat: Add cancel button for fast mode chat messages - #6
Conversation
mo-tunn
left a comment
There was a problem hiding this comment.
Thanks for adding the stop button UX — the direction is good. However, I don’t think this is safe to merge yet due to a few blocking issues:
-
Streaming state is still force-reset without guaranteed backend cancellation (high impact)
Inrenderer/js/panel/bootstrap.js, the textarea focus handler forcefully resetsisStreamingand re-enables controls without ensuring the in-flight request is aborted. This can allow overlapping requests and inconsistent UI/session state. -
60s timeout has the same race condition (high impact)
Inrenderer/js/panel/messaging.js, the safety timeout sets the UI back to idle and re-enables send, but it does not guarantee the active request is actually cancelled. A slow but valid response can still be running while users send another message. -
Multi-monitor panel positioning remains incorrect for negative coordinates (medium impact)
Inmain.js:getPanelPosition(), savedx/y < 0values are treated as invalid. This breaks common layouts where secondary displays are positioned to the left/top of the primary display. -
PR scope is too broad for a cancel-button feature (medium impact)
This PR includes unrelated carry-over changes (multi-monitor, AssemblyAI/PTT, prompt updates,.gitignore) from earlier commits. Please keep this PR focused to the cancel-button behavior so it can be reviewed and merged safely.
Please address the blockers above and I’ll re-review quickly.
3f6534c to
a569731
Compare
|
Added Fixed race conditions by moving state resets to Synchronized UI (Send/Stop buttons) using a dedicated Cleaned up the scope; no unrelated changes included. |
Summary
When using the chat interface (especially in "fast mode"), users previously did not have a way to cancel an ongoing AI generation. This PR introduces a stop/cancel button that replaces the send button while the AI is streaming a response, allowing users to safely abort long-running or stuck requests.
User-Visible Changes
Implementation Details
.stop-btntoindex.htmland implemented its styles/hover states instyle.css.messaging.jsto toggle visibility between thesend-btnandstop-btnbased on the streaming state.cancelMessagefunction inmessaging.jswhich triggers theabort-messageIPC call.bootstrap.js.