mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-06 05:42:37 +02:00
disable message sending if the image processing hasnt completed yet
This commit is contained in:
parent
b5f5301761
commit
08c0232184
1 changed files with 11 additions and 1 deletions
|
|
@ -37,6 +37,9 @@ export function ComposeBoxPlayground({
|
|||
}, [messages.length, shouldAutoFocus]);
|
||||
|
||||
function handleInput() {
|
||||
// Mirror send-button disable rules to block Enter submits
|
||||
if (disabled || loading || uploading) return;
|
||||
if (pendingImage?.url && pendingImage.description === undefined) return;
|
||||
const text = input.trim();
|
||||
if (!text && !pendingImage) {
|
||||
return;
|
||||
|
|
@ -181,7 +184,14 @@ export function ComposeBoxPlayground({
|
|||
<Button
|
||||
size="sm"
|
||||
isIconOnly
|
||||
disabled={disabled || uploading || (loading ? false : (!input.trim() && !pendingImage))}
|
||||
disabled={
|
||||
disabled
|
||||
|| uploading
|
||||
// If an image is selected but description isn't ready yet, keep disabled
|
||||
|| (pendingImage?.url && pendingImage.description === undefined)
|
||||
// When not loading a response, require either text or a ready image
|
||||
|| (loading ? false : (!input.trim() && !pendingImage))
|
||||
}
|
||||
onPress={loading ? onCancel : handleInput}
|
||||
className={`
|
||||
transition-all duration-200
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue