Repository navigation
poc: add stop button to cancel in-flight chat stream - #131
Open
Penina-Levy wants to merge 32 commits into
Open
Penina-Levy wants to merge 32 commits into
Penina-Levy wants to merge 32 commits into
Conversation
When isSending, replaces the send button with a red stop button. Clicking it aborts the fetch stream via AbortController and appends an assistant message "okay, I won't answer that" to the canvas. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The preview deployment for sefaria/ai-chatbot:server is ready. 🟢 Open app | Open Build Logs | Open Application Logs Last updated at: 2026-06-25 11:33:10 CET |
📊 Code Quality Score: 10/100
Scored by GitVelocity · How are scores calculated? |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44x44px, #c03522 background, #a02c1c on hover/active, 8px radius, lucide square outline icon (16x16, white stroke). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Matches native title-attribute tooltip pattern used on header buttons. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add wasStopped flag to hide the thinking/progress block the moment stop is clicked, so "okay, I won't answer that" cleanly replaces it without a brief overlap. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously, aborting during stream reading fell through to the recovery logic which could deliver a response anyway, making the stop button appear to do nothing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add box-sizing: border-box and padding: 0 to prevent browser default styles from inflating the button beyond 44px. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When the user clicks stop, the thinking block disappears and no new message is added. Existing chat content remains unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
White bg (#ffffff) with lucide/circle-stop icon (#6f6f6f stroke), hover state light gray (#eeeeee). Replaces red ButtonTest/stop design. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lt, cccccc hover Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ius-sm) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Default bg: --lc-disabled-button-hover (#cccccc) Hover bg: new --lc-stop-btn-hover (#999999) Icon: currentColor via --lc-bg (#ffffff) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…SS vars - Remove wasStopped state flag (was ineffective due to Svelte batching) - Replace setTimeout focus hack with await tick() in finally block - Rename --lc-disabled-button-hover to --lc-stop-btn-bg for clarity - Both stop button vars now follow --lc-stop-btn-* naming Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Removes redundant --lc-stop-btn-bg/hover variables. Stop button now uses --lc-primary and --lc-primary-hover, matching Figma update and the send button pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- :focus-visible uses outline: 2px solid --lc-primary with offset, consistent with primary color focus pattern in codebase - aria-hidden=true on SVG since button already has aria-label Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- streamAbortController: plain let, not $state (not used in template) - stoppedByUser: moved below early-return guard - saveMessagesToStorage: deduplicated, called once at end of catch - STATUS_SENT constant added, replaces hardcoded 'sent' string - sendMessageStream signal wrapped in options object (avoids 10th positional param) - type=button added to stop button - focus-visible: white outline + navy box-shadow, visible on any background Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
transition:all was including outline, causing focus ring to flash and disappear. Now only background-color and transform transition. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uard tick() in finally - Replace all status: 'sent' with STATUS_SENT constant - Add JSDoc for options param in sendMessageStream - Wrap await tick() in try/catch to prevent masking original errors Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fires reportClientStreamEvent('stream_cancelled') on abort, including:
- elapsed_ms: time from request start to cancel
- last_progress_type: what the stream was doing when stopped
- last_tool_name: which tool was running if any
Uses a getProgress callback in options so api.js can read live
component state without coupling. metadata spread added to
reportClientStreamEvent for extensible extra fields.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This reverts commit 508d735.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44x44px, transparent bg with 1px navy border, rounded-square stop icon Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When isSending, replaces the send button with a red stop button. Clicking it aborts the fetch stream via AbortController and appends an assistant message "okay, I won't answer that" to the canvas.