Skip to content
Merged
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
12 changes: 9 additions & 3 deletions core/http/react-ui/src/hooks/useChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,15 @@ export function useChat(initialModel = '') {
})
userFiles.push({ name: file.name, type: 'audio' })
} else {
// Text/PDF files - append to content
userFiles.push({ name: file.name, type: 'file', content: file.textContent || '' })
}
// Text/PDF files - append to content
if (file.textContent) {
messageContent.push({
type: 'text',
text: `\n\n--- File: ${file.name} ---\n${file.textContent}\n--- End of ${file.name} ---`,
})
}
userFiles.push({ name: file.name, type: 'file', content: file.textContent || '' })
}
}
} else {
messageContent = content
Expand Down
6 changes: 5 additions & 1 deletion core/http/react-ui/src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ export default function Home() {
const newFiles = []
for (const file of fileList) {
const base64 = await fileToBase64(file)
newFiles.push({ name: file.name, type: file.type, base64 })
const entry = { name: file.name, type: file.type, base64 }
if (!file.type.startsWith('image/') && !file.type.startsWith('audio/')) {
entry.textContent = await file.text().catch(() => '')
}
newFiles.push(entry)
}
setter(prev => [...prev, ...newFiles])
}, [])
Expand Down
Loading