Skip to content

Build and run agents you can see, understand and trust.

fix: block sending by Enter while a reply is in progress (#2529)

DavdGao26b936c9afa8
diff --git a/examples/web_ui/frontend/src/components/chat/TextInput.tsx b/examples/web_ui/frontend/src/components/chat/TextInput.tsx
index 37fcda415..4678892da 100644
--- a/examples/web_ui/frontend/src/components/chat/TextInput.tsx
+++ b/examples/web_ui/frontend/src/components/chat/TextInput.tsx
@@ -218,7 +218,9 @@ export const TextInput = forwardRef<TextInputRef, TextInputProps>(
};
const handleSend = () => {
- if (!value.trim() || disabled || hasProcessing) return;
+ // ``phase`` is guarded here rather than only on the button, since Enter
+ // calls this directly and would otherwise send during a running reply.
+ if (phase !== 'idle' || !value.trim() || disabled || hasProcessing) return;
const blocks: ContentBlock[] = [];