@@ -71,6 +71,10 @@ const COMPOSER_CHROME_INTERACTIVE_SELECTOR = [
7171 "[role='option']" ,
7272] . join ( "," ) ;
7373
74+ function hasTerminalRunStatus ( status : ChatRunUiStatus | null | undefined ) : boolean {
75+ return status ?. phase === "done" || status ?. phase === "interrupted" ;
76+ }
77+
7478export type ChatProps = {
7579 sessionKey : string ;
7680 onSessionKeyChange : ( next : string ) => void ;
@@ -979,7 +983,8 @@ export function renderChat(props: ChatProps) {
979983 const canCompose = props . connected ;
980984 const isBusy = props . sending || props . stream !== null ;
981985 const canAbort = Boolean ( props . canAbort && props . onAbort ) ;
982- const composerRunStatus = canAbort ? { phase : "in-progress" as const } : props . runStatus ;
986+ const showAbortableUi = canAbort && ! hasTerminalRunStatus ( props . runStatus ) ;
987+ const composerRunStatus = showAbortableUi ? { phase : "in-progress" as const } : props . runStatus ;
983988 const compactBusy =
984989 props . compactionStatus ?. phase === "active" || props . compactionStatus ?. phase === "retrying" ;
985990 const activeSession = props . sessions ?. sessions ?. find ( ( row ) => row . key === props . sessionKey ) ;
@@ -1402,7 +1407,7 @@ export function renderChat(props: ChatProps) {
14021407
14031408 ${ renderChatQueue ( {
14041409 queue : props . queue ,
1405- canAbort : props . canAbort ,
1410+ canAbort : showAbortableUi ,
14061411 onQueueSteer : props . onQueueSteer ,
14071412 onQueueRemove : props . onQueueRemove ,
14081413 } ) }
@@ -1411,7 +1416,7 @@ export function renderChat(props: ChatProps) {
14111416 ${ renderCompactionIndicator ( props . compactionStatus ) }
14121417 ${ renderContextNotice ( activeSession , props . sessions ?. defaults ?. contextTokens ?? null , {
14131418 compactBusy,
1414- compactDisabled : ! props . connected || isBusy || Boolean ( props . canAbort ) ,
1419+ compactDisabled : ! props . connected || isBusy || showAbortableUi ,
14151420 onCompact : props . onCompact ,
14161421 } ) }
14171422 ${ props . showNewMessages
@@ -1533,7 +1538,7 @@ export function renderChat(props: ChatProps) {
15331538 </ div >
15341539
15351540 ${ renderChatRunControls ( {
1536- canAbort,
1541+ canAbort : showAbortableUi ,
15371542 connected : props . connected ,
15381543 draft : props . draft ,
15391544 hasMessages : props . messages . length > 0 ,
0 commit comments