Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Fix chat send button (#5647)

Harikrishna C549e24e7d83b
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsx
index e4fcff6b0f7..13f18d7b6a7 100644
--- a/studio/frontend/src/components/assistant-ui/thread.tsx
+++ b/studio/frontend/src/components/assistant-ui/thread.tsx
@@ -289,19 +289,31 @@ const PendingAudioChip: FC = () => {
const Composer: FC<{ disabled?: boolean }> = ({ disabled }) => {
const { inputProps, isComposing, isComposingRef } = useImeComposerInputHandlers();
+ const composerText = useAuiState(({ composer }) => composer.text);
+ const hasAttachments = useAuiState(
+ ({ composer }) => composer.attachments.length > 0,
+ );
const hasPendingAttachments = useAuiState(({ composer }) =>
composer.attachments.some(
(attachment) => attachment.status.type === "running",
),
);
+ const hasPendingAudio = useChatRuntimeStore((s) => Boolean(s.pendingAudioName));
+ const hasSendableContent =
+ composerText.trim().length > 0 || hasAttachments || hasPendingAudio;
const handleSubmit = useCallback(
(event: FormEvent<HTMLFormElement>) => {
- if (disabled || isComposingRef.current || hasPendingAttachments) {
+ if (
+ disabled ||
+ !hasSendableContent ||
+ isComposingRef.current ||
+ hasPendingAttachments
+ ) {
event.preventDefault();
}
},
- [disabled, hasPendingAttachments, isComposingRef],
+ [disabled, hasPendingAttachments, hasSendableContent, isComposingRef],
);
const composerContent = (
@@ -323,8 +335,12 @@ const Composer: FC<{ disabled?: boolean }> = ({ disabled }) => {
{...inputProps}
/>
<ComposerAction
- disabled={disabled || isComposing || hasPendingAttachments}
- blockSend={() => isComposingRef.current || hasPendingAttachments}
+ disabled={
+ disabled || !hasSendableContent || isComposing || hasPendingAttachments
+ }
+ blockSend={() =>
+ !hasSendableContent || isComposingRef.current || hasPendingAttachments
+ }
/>
</>
);