diff --git a/apps/agent/entrypoints/sidepanel/index/ChatInput.tsx b/apps/agent/entrypoints/sidepanel/index/ChatInput.tsx index dbeff190..27946e2a 100644 --- a/apps/agent/entrypoints/sidepanel/index/ChatInput.tsx +++ b/apps/agent/entrypoints/sidepanel/index/ChatInput.tsx @@ -147,12 +147,18 @@ export const ChatInput = forwardRef( [closeMention, openMentionAtCursor, toggleMentionAtCursor], ) + const isBusy = status !== 'ready' && status !== 'error' + const handleSubmit = (e: FormEvent) => { if (mentionStateRef.current.isOpen) { e.preventDefault() closeMention() return } + if (isBusy) { + e.preventDefault() + return + } onSubmitProp(e) } @@ -229,7 +235,7 @@ export const ChatInput = forwardRef( !e.nativeEvent.isComposing ) { e.preventDefault() - if (input.trim()) { + if (input.trim() && !isBusy) { e.currentTarget.form?.requestSubmit() } } @@ -280,7 +286,7 @@ export const ChatInput = forwardRef( } rows={1} /> - {status === 'streaming' ? ( + {isBusy ? (