Skip to content

Commit b76c48f

Browse files
committed
acualestly support all file types
1 parent c82d402 commit b76c48f

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

src/client/components/ChatV2/ChatV2.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,9 @@ export const ChatV2 = () => {
111111
const handleSubmit = async (message: string, ignoreTokenUsageWarning: boolean) => {
112112
const formData = new FormData()
113113

114-
let file = fileInputRef.current?.files?.[0]
114+
const file = fileInputRef.current?.files?.[0]
115115
if (file) {
116-
if (ALLOWED_FILE_TYPES.includes(file.type)) {
117-
formData.append('file', file)
118-
} else {
119-
console.error('File not attached')
120-
file = undefined
121-
}
116+
formData.append('file', file)
122117
}
123118

124119
const newMessages = messages.concat({
@@ -463,7 +458,7 @@ export const ChatV2 = () => {
463458
position: 'relative',
464459
transition: 'border 300ms',
465460
borderLeft: '1px solid',
466-
borderColor: showAnnotations ? 'rgba(0,0,0,0.12)' : 'rgba(0,0,0,0)'
461+
borderColor: showAnnotations ? 'rgba(0,0,0,0.12)' : 'rgba(0,0,0,0)',
467462
}}
468463
>
469464
<Box
@@ -472,8 +467,9 @@ export const ChatV2 = () => {
472467
top: 65,
473468
padding: '2rem',
474469
transition: 'transform 250ms ease-in-out',
475-
transform: showAnnotations ? 'translateX(0%)' : 'translate(100%)'
476-
}}>
470+
transform: showAnnotations ? 'translateX(0%)' : 'translate(100%)',
471+
}}
472+
>
477473
{activeFileSearchResult && <Annotations fileSearchResult={activeFileSearchResult} setShowAnnotations={setShowAnnotations} />}
478474
</Box>
479475
</Box>

src/client/components/ChatV2/useChatStream.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const useChatStream = ({
99
}: {
1010
onFileSearchComplete: (data: FileSearchCompletedData) => void
1111
onComplete: ({ previousResponseId, message }: { previousResponseId: string | undefined; message: Message }) => void
12-
onError: (error: string) => void
12+
onError: (error: unknown) => void
1313
}) => {
1414
const [completion, setCompletion] = useState('')
1515
const [isStreaming, setIsStreaming] = useState(false)
@@ -91,7 +91,7 @@ export const useChatStream = ({
9191
}
9292
}
9393
}
94-
} catch (err: any) {
94+
} catch (err: unknown) {
9595
error += '\nResponse stream was interrupted'
9696
onError(err)
9797
} finally {

src/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,3 @@ export const DEFAULT_MODEL_ON_ENABLE = 'gpt-4o'
5656

5757
export const DEFAULT_ASSISTANT_INSTRUCTIONS = 'Olet avulias avustaja'
5858
export const DEFAULT_MODEL_TEMPERATURE = 0.5
59-
export const ALLOWED_FILE_TYPES = ['text/plain', 'text/html', 'text/css', 'text/csv', 'text/markdown', 'text/md', 'application/pdf']

0 commit comments

Comments
 (0)