@@ -47,6 +47,7 @@ import {
4747} from "@/browser/utils/ui/keybinds" ;
4848import { ModelSelector , type ModelSelectorRef } from "../ModelSelector" ;
4949import { useModelLRU } from "@/browser/hooks/useModelLRU" ;
50+ import { SendHorizontal } from "lucide-react" ;
5051import { VimTextArea } from "../VimTextArea" ;
5152import { ImageAttachments , type ImageAttachment } from "../ImageAttachments" ;
5253import {
@@ -61,6 +62,7 @@ import { useTelemetry } from "@/browser/hooks/useTelemetry";
6162import { setTelemetryEnabled } from "@/common/telemetry" ;
6263import { getTokenCountPromise } from "@/browser/utils/tokenizer/rendererClient" ;
6364import { CreationCenterContent } from "./CreationCenterContent" ;
65+ import { cn } from "@/common/lib/utils" ;
6466import { CreationControls } from "./CreationControls" ;
6567import { useCreationWorkspace } from "./useCreationWorkspace" ;
6668
@@ -163,6 +165,8 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
163165 [ tokenCountPromise ]
164166 ) ;
165167 const hasTypedText = input . trim ( ) . length > 0 ;
168+ const hasImages = imageAttachments . length > 0 ;
169+ const canSend = ( hasTypedText || hasImages ) && ! disabled && ! isSending ;
166170 // Setter for model - updates localStorage directly so useSendMessageOptions picks it up
167171 const setPreferredModel = useCallback (
168172 ( model : string ) => {
@@ -449,8 +453,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
449453 ) ;
450454
451455 const handleSend = async ( ) => {
452- // Allow sending if there's text or images
453- if ( ( ! input . trim ( ) && imageAttachments . length === 0 ) || disabled || isSending ) {
456+ if ( ! canSend ) {
454457 return ;
455458 }
456459
@@ -912,7 +915,7 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
912915 />
913916 ) }
914917
915- < div className = "flex items-end gap-2.5 " data-component = "ChatInputControls" >
918+ < div className = "flex items-end" data-component = "ChatInputControls" >
916919 < VimTextArea
917920 ref = { inputRef }
918921 value = { input }
@@ -1011,6 +1014,25 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
10111014
10121015 < div className = "ml-auto flex items-center gap-2" data-component = "ModelControls" >
10131016 < ModeSelector mode = { mode } onChange = { setMode } />
1017+ < TooltipWrapper inline >
1018+ < button
1019+ type = "button"
1020+ onClick = { ( ) => void handleSend ( ) }
1021+ disabled = { ! canSend }
1022+ aria-label = "Send message"
1023+ className = { cn (
1024+ "inline-flex items-center gap-1 rounded-sm border border-border-light px-2 py-1 text-[11px] font-medium text-white transition-colors duration-200 disabled:opacity-50" ,
1025+ mode === "plan"
1026+ ? "bg-plan-mode hover:bg-plan-mode-hover disabled:hover:bg-plan-mode"
1027+ : "bg-exec-mode hover:bg-exec-mode-hover disabled:hover:bg-exec-mode"
1028+ ) }
1029+ >
1030+ < SendHorizontal className = "h-3.5 w-3.5" strokeWidth = { 2.5 } />
1031+ </ button >
1032+ < Tooltip className = "tooltip" align = "center" >
1033+ Send message ({ formatKeybind ( KEYBINDS . SEND_MESSAGE ) } )
1034+ </ Tooltip >
1035+ </ TooltipWrapper >
10141036 </ div >
10151037 </ div >
10161038
0 commit comments