Merge pull request #3972 from jonathan-rohde/fix/missing-tags-add-doc-modal

fix: missing tags add doc modal
This commit is contained in:
Timothy Jaeryang Baek 2024-07-18 13:15:22 +02:00 committed by GitHub
commit 376b2d0297
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -35,12 +35,12 @@
SUPPORTED_FILE_TYPE.includes(file['type']) || SUPPORTED_FILE_TYPE.includes(file['type']) ||
SUPPORTED_FILE_EXTENSIONS.includes(file.name.split('.').at(-1)) SUPPORTED_FILE_EXTENSIONS.includes(file.name.split('.').at(-1))
) { ) {
uploadDoc(file); uploadDoc(file, tags);
} else { } else {
toast.error( toast.error(
`Unknown File Type '${file['type']}', but accepting and treating as plain text` `Unknown File Type '${file['type']}', but accepting and treating as plain text`
); );
uploadDoc(file); uploadDoc(file, tags);
} }
} }

View File

@ -51,7 +51,7 @@
await documents.set(await getDocs(localStorage.token)); await documents.set(await getDocs(localStorage.token));
}; };
const uploadDoc = async (file) => { const uploadDoc = async (file, tags?: object) => {
console.log(file); console.log(file);
// Check if the file is an audio file and transcribe/convert it to text file // Check if the file is an audio file and transcribe/convert it to text file
if (['audio/mpeg', 'audio/wav'].includes(file['type'])) { if (['audio/mpeg', 'audio/wav'].includes(file['type'])) {
@ -84,7 +84,12 @@
res.collection_name, res.collection_name,
res.filename, res.filename,
transformFileName(res.filename), transformFileName(res.filename),
res.filename res.filename,
tags?.length > 0
? {
tags: tags
}
: null
).catch((error) => { ).catch((error) => {
toast.error(error); toast.error(error);
return null; return null;