Skip to content

Commit c82d402

Browse files
committed
acually allow all text file types
1 parent 7e8168a commit c82d402

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/client/components/ChatV2/ChatBox.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,16 @@ export const ChatBox = ({
6565
}
6666

6767
const handleFileTypeValidation = (file: File): void => {
68-
const allowedFileTypes = ['text/plain', 'text/html', 'text/css', 'text/csv', 'text/markdown', 'application/pdf']
69-
70-
if (allowedFileTypes.includes(file.type)) {
71-
setFileName(file.name)
72-
} else {
68+
if (!file.type.startsWith('text/') && file.type !== 'application/pdf') {
7369
setDisallowedFileType(file.type)
7470
setFileTypeAlertOpen(true)
7571
setTimeout(() => {
7672
setFileTypeAlertOpen(false)
77-
}, 5000)
73+
}, 6000)
74+
return
7875
}
76+
77+
setFileName(file.name)
7978
}
8079

8180
const onSubmit = (e: React.FormEvent) => {
@@ -177,13 +176,7 @@ export const ChatBox = ({
177176
<Box>
178177
<IconButton component="label">
179178
<AttachFileIcon />
180-
<input
181-
type="file"
182-
accept="text/*,application/pdf"
183-
hidden
184-
ref={fileInputRef}
185-
onChange={(e) => e.target.files?.[0] && handleFileTypeValidation(e.target.files[0])}
186-
/>
179+
<input type="file" accept="*" hidden ref={fileInputRef} onChange={(e) => e.target.files?.[0] && handleFileTypeValidation(e.target.files[0])} />
187180
</IconButton>
188181
{fileName && <Chip sx={{ borderRadius: 100 }} label={fileName} onDelete={handleDeleteFile} />}
189182
<ModelSelector currentModel={currentModel} setModel={setModel} availableModels={availableModels} />

0 commit comments

Comments
 (0)