@@ -243,23 +243,6 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
243243 } ,
244244 )
245245 const working = createMemo ( ( ) => status ( ) ?. type !== "idle" )
246- const tip = ( ) => {
247- if ( working ( ) ) {
248- return (
249- < div class = "flex items-center gap-2" >
250- < span > { language . t ( "prompt.action.stop" ) } </ span >
251- < span class = "text-icon-base text-12-medium text-[10px]!" > { language . t ( "common.key.esc" ) } </ span >
252- </ div >
253- )
254- }
255-
256- return (
257- < div class = "flex items-center gap-2" >
258- < span > { language . t ( "prompt.action.send" ) } </ span >
259- < Icon name = "enter" size = "small" class = "text-icon-base" />
260- </ div >
261- )
262- }
263246 const imageAttachments = createMemo ( ( ) =>
264247 prompt . current ( ) . filter ( ( part ) : part is ImageAttachmentPart => part . type === "image" ) ,
265248 )
@@ -297,6 +280,31 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
297280 if ( store . mode === "shell" ) return 0
298281 return prompt . context . items ( ) . filter ( ( item ) => ! ! item . comment ?. trim ( ) ) . length
299282 } )
283+ const blank = createMemo ( ( ) => {
284+ const text = prompt
285+ . current ( )
286+ . map ( ( part ) => ( "content" in part ? part . content : "" ) )
287+ . join ( "" )
288+ return text . trim ( ) . length === 0 && imageAttachments ( ) . length === 0 && commentCount ( ) === 0
289+ } )
290+ const stopping = createMemo ( ( ) => working ( ) && blank ( ) )
291+ const tip = ( ) => {
292+ if ( stopping ( ) ) {
293+ return (
294+ < div class = "flex items-center gap-2" >
295+ < span > { language . t ( "prompt.action.stop" ) } </ span >
296+ < span class = "text-icon-base text-12-medium text-[10px]!" > { language . t ( "common.key.esc" ) } </ span >
297+ </ div >
298+ )
299+ }
300+
301+ return (
302+ < div class = "flex items-center gap-2" >
303+ < span > { language . t ( "prompt.action.send" ) } </ span >
304+ < Icon name = "enter" size = "small" class = "text-icon-base" />
305+ </ div >
306+ )
307+ }
300308
301309 const contextItems = createMemo ( ( ) => {
302310 const items = prompt . context . items ( )
@@ -1407,17 +1415,17 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
14071415 />
14081416
14091417 < div class = "flex items-center gap-1 pointer-events-auto" >
1410- < Tooltip placement = "top" inactive = { ! prompt . dirty ( ) && ! working ( ) } value = { tip ( ) } >
1418+ < Tooltip placement = "top" inactive = { ! working ( ) && blank ( ) } value = { tip ( ) } >
14111419 < IconButton
14121420 data-action = "prompt-submit"
14131421 type = "submit"
1414- disabled = { store . mode !== "normal" || ( ! prompt . dirty ( ) && ! working ( ) && commentCount ( ) === 0 ) }
1422+ disabled = { store . mode !== "normal" || ( ! working ( ) && blank ( ) ) }
14151423 tabIndex = { store . mode === "normal" ? undefined : - 1 }
1416- icon = { working ( ) ? "stop" : "arrow-up" }
1424+ icon = { stopping ( ) ? "stop" : "arrow-up" }
14171425 variant = "primary"
14181426 class = "size-8"
14191427 style = { buttons ( ) }
1420- aria-label = { working ( ) ? language . t ( "prompt.action.stop" ) : language . t ( "prompt.action.send" ) }
1428+ aria-label = { stopping ( ) ? language . t ( "prompt.action.stop" ) : language . t ( "prompt.action.send" ) }
14211429 />
14221430 </ Tooltip >
14231431 </ div >
0 commit comments