@@ -39,7 +39,7 @@ define(function (require, exports, module) {
3939 let _hasReceivedContent = false ; // tracks if we've received any text/tool in current response
4040
4141 // DOM references
42- let $panel , $messages , $status , $statusText , $textarea , $sendBtn ;
42+ let $panel , $messages , $status , $statusText , $textarea , $sendBtn , $stopBtn ;
4343
4444 const PANEL_HTML =
4545 '<div class="ai-chat-panel">' +
@@ -58,7 +58,10 @@ define(function (require, exports, module) {
5858 '<div class="ai-chat-input-wrap">' +
5959 '<textarea class="ai-chat-textarea" placeholder="Ask Claude..." rows="1"></textarea>' +
6060 '<button class="ai-send-btn" title="Send message">' +
61- '<i class="fa-solid fa-arrow-up"></i>' +
61+ '<i class="fa-solid fa-paper-plane"></i>' +
62+ '</button>' +
63+ '<button class="ai-stop-btn" title="Stop generation (Esc)" style="display:none">' +
64+ '<i class="fa-solid fa-stop"></i>' +
6265 '</button>' +
6366 '</div>' +
6467 '</div>' +
@@ -143,11 +146,16 @@ define(function (require, exports, module) {
143146 $statusText = $panel . find ( ".ai-status-text" ) ;
144147 $textarea = $panel . find ( ".ai-chat-textarea" ) ;
145148 $sendBtn = $panel . find ( ".ai-send-btn" ) ;
149+ $stopBtn = $panel . find ( ".ai-stop-btn" ) ;
146150
147151 // Event handlers
148152 $sendBtn . on ( "click" , _sendMessage ) ;
153+ $stopBtn . on ( "click" , _cancelQuery ) ;
149154 $panel . find ( ".ai-new-session-btn" ) . on ( "click" , _newSession ) ;
150155
156+ // Hide "+ New" button initially (no conversation yet)
157+ $panel . find ( ".ai-new-session-btn" ) . hide ( ) ;
158+
151159 $textarea . on ( "keydown" , function ( e ) {
152160 if ( e . key === "Enter" && ! e . shiftKey ) {
153161 e . preventDefault ( ) ;
@@ -198,6 +206,9 @@ define(function (require, exports, module) {
198206 return ;
199207 }
200208
209+ // Show "+ New" button once a conversation starts
210+ $panel . find ( ".ai-new-session-btn" ) . show ( ) ;
211+
201212 // Append user message
202213 _appendUserMessage ( text ) ;
203214
@@ -255,6 +266,10 @@ define(function (require, exports, module) {
255266 if ( $messages ) {
256267 $messages . empty ( ) ;
257268 }
269+ // Hide "+ New" button since we're back to empty state
270+ if ( $panel ) {
271+ $panel . find ( ".ai-new-session-btn" ) . hide ( ) ;
272+ }
258273 if ( $status ) {
259274 $status . removeClass ( "active" ) ;
260275 }
@@ -607,8 +622,14 @@ define(function (require, exports, module) {
607622 $textarea [ 0 ] . focus ( { preventScroll : true } ) ;
608623 }
609624 }
610- if ( $sendBtn ) {
611- $sendBtn . prop ( "disabled" , streaming ) ;
625+ if ( $sendBtn && $stopBtn ) {
626+ if ( streaming ) {
627+ $sendBtn . hide ( ) ;
628+ $stopBtn . show ( ) ;
629+ } else {
630+ $stopBtn . hide ( ) ;
631+ $sendBtn . show ( ) ;
632+ }
612633 }
613634 if ( ! streaming && $messages ) {
614635 // Clean up thinking indicator if still present
0 commit comments