Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions apps/web/src/components/ai-elements/prompt-input.test.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions apps/web/src/components/ai-elements/prompt-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,15 @@ export const PromptInput = ({
const incoming = Array.from(fileList);
const accepted = incoming.filter((f) => matchesAccept(f));

if (incoming.length && accepted.length === 0) {
if (incoming.length > accepted.length) {
onError?.({
code: 'accept',
message: 'No files match the accepted types.',
message: accepted.length
? 'Some files were not added because their types are not supported.'
: 'No files match the accepted types.',
});

return;
if (accepted.length === 0) return;
}

const withinSize = (f: File) =>
Expand Down Expand Up @@ -424,13 +426,15 @@ export const PromptInput = ({
const incoming = Array.from(fileList);
const accepted = incoming.filter((f) => matchesAccept(f));

if (incoming.length && accepted.length === 0) {
if (incoming.length > accepted.length) {
onError?.({
code: 'accept',
message: 'No files match the accepted types.',
message: accepted.length
? 'Some files were not added because their types are not supported.'
: 'No files match the accepted types.',
});

return;
if (accepted.length === 0) return;
}

const withinSize = (f: File) =>
Expand Down
25 changes: 25 additions & 0 deletions apps/web/src/components/tasks/TaskPromptInput.client.test.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions apps/web/src/components/tasks/TaskPromptInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ReactNode } from 'react';
import { toast } from 'sonner';
import { BasicTooltip, SendHorizontal } from '@/components/system';

import {
Expand Down Expand Up @@ -162,6 +163,7 @@ export function TaskPromptInput({
<PromptInputRoot
key={promptKey}
onSubmit={onSubmit}
onError={(error) => toast.error(error.message)}
clearOnSubmit={false}
accept={ROOMOTE_FILE_ATTACHMENT_ACCEPT}
multiple
Expand Down
Loading