mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-06 08:37:22 +00:00
remove file validation
This commit is contained in:
1 parent
846a3fd685
commit
6378e49a96
4 files changed
+24
-360
No files matched your search
@@ -40,7 +40,6 @@ import OpenAI from 'openai';
|
||||
import { makeSystemPrompt } from '@/lib/system';
|
||||
import { assistantContentEmpty } from '@/lib/ai-messages';
|
||||
import { saveFileToTmp } from '@/lib/fileUtils';
|
||||
import { validateFiles, DEFAULT_MAX_SIZE, DEFAULT_ACCEPT } from '@/lib/fileValidation';
|
||||
|
||||
interface ChatPaneProps {
|
||||
projectId: string;
|
||||
@@ -358,39 +357,21 @@ export const ChatPane = forwardRef<ChatPaneRef, ChatPaneProps>(({
|
||||
const files = Array.from(e.dataTransfer.files);
|
||||
if (files.length === 0) return;
|
||||
|
||||
// Validate files using the same logic as FileAttachment
|
||||
const { validFiles, errors } = validateFiles(files, {
|
||||
maxSize: DEFAULT_MAX_SIZE,
|
||||
accept: DEFAULT_ACCEPT,
|
||||
maxFiles: 10 // Limit to 10 files at once
|
||||
});
|
||||
// Add all files without validation
|
||||
setAttachedFiles(prev => [...prev, ...files]);
|
||||
|
||||
// Add valid files to attachments
|
||||
if (validFiles.length > 0) {
|
||||
setAttachedFiles(prev => [...prev, ...validFiles]);
|
||||
|
||||
// Announce files added via toast
|
||||
if (validFiles.length === 1) {
|
||||
toast({
|
||||
title: "File added",
|
||||
description: `${validFiles[0].name} has been added to attachments.`,
|
||||
});
|
||||
} else {
|
||||
toast({
|
||||
title: "Files added",
|
||||
description: `${validFiles.length} files have been added to attachments.`,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Show errors for invalid files
|
||||
errors.forEach(error => {
|
||||
// Announce files added via toast
|
||||
if (files.length === 1) {
|
||||
toast({
|
||||
title: "File upload error",
|
||||
description: error.error,
|
||||
variant: "destructive",
|
||||
title: "File added",
|
||||
description: `${files[0].name} has been added to attachments.`,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
toast({
|
||||
title: "Files added",
|
||||
description: `${files.length} files have been added to attachments.`,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleSend = async () => {
|
||||
|
||||
Reference in new issue
Block a user