mirror of
https://github.com/open-webui/open-webui
synced 2024-12-29 07:12:07 +00:00
refac
This commit is contained in:
parent
81a8ad2762
commit
ba0b3a984d
@ -873,7 +873,7 @@ def save_docs_to_vector_db(
|
|||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(e)
|
log.exception(e)
|
||||||
return False
|
raise e
|
||||||
|
|
||||||
|
|
||||||
class ProcessFileForm(BaseModel):
|
class ProcessFileForm(BaseModel):
|
||||||
@ -903,7 +903,7 @@ def process_file(
|
|||||||
|
|
||||||
docs = [
|
docs = [
|
||||||
Document(
|
Document(
|
||||||
page_content=form_data.content,
|
page_content=form_data.content.replace("<br/>", "\n"),
|
||||||
metadata={
|
metadata={
|
||||||
**file.meta,
|
**file.meta,
|
||||||
"name": file.filename,
|
"name": file.filename,
|
||||||
|
@ -446,7 +446,13 @@
|
|||||||
|
|
||||||
const onDragOver = (e) => {
|
const onDragOver = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dragged = true;
|
|
||||||
|
// Check if a file is being draggedOver.
|
||||||
|
if (e.dataTransfer?.types?.includes('Files')) {
|
||||||
|
dragged = true;
|
||||||
|
} else {
|
||||||
|
dragged = false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onDragLeave = () => {
|
const onDragLeave = () => {
|
||||||
@ -457,15 +463,17 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dragged = false;
|
dragged = false;
|
||||||
|
|
||||||
if (e.dataTransfer?.files) {
|
if (e.dataTransfer?.types?.includes('Files')) {
|
||||||
const inputFiles = e.dataTransfer?.files;
|
if (e.dataTransfer?.files) {
|
||||||
|
const inputFiles = e.dataTransfer?.files;
|
||||||
|
|
||||||
if (inputFiles && inputFiles.length > 0) {
|
if (inputFiles && inputFiles.length > 0) {
|
||||||
for (const file of inputFiles) {
|
for (const file of inputFiles) {
|
||||||
await uploadFileHandler(file);
|
await uploadFileHandler(file);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toast.error($i18n.t(`File not found.`));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
toast.error($i18n.t(`File not found.`));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user