mirror of
https://github.com/open-webui/open-webui
synced 2024-11-29 07:21:01 +00:00
refac
This commit is contained in:
parent
1f9b5b6456
commit
61b147441c
@ -738,12 +738,18 @@ def process_file(
|
||||
collection_name = f"file-{file.id}"
|
||||
|
||||
if form_data.content:
|
||||
VECTOR_DB_CLIENT.delete(
|
||||
collection_name=f"file-{file.id}",
|
||||
filter={"file_id": file.id},
|
||||
)
|
||||
|
||||
docs = [
|
||||
Document(
|
||||
page_content=form_data.content,
|
||||
metadata={
|
||||
"name": file.meta.get("name", file.filename),
|
||||
"created_by": file.user_id,
|
||||
"file_id": file.id,
|
||||
**file.meta,
|
||||
},
|
||||
)
|
||||
@ -755,7 +761,7 @@ def process_file(
|
||||
collection_name=f"file-{file.id}", filter={"file_id": file.id}
|
||||
)
|
||||
|
||||
if result:
|
||||
if len(result.ids[0]) > 0:
|
||||
docs = [
|
||||
Document(
|
||||
page_content=result.documents[0][idx],
|
||||
@ -770,6 +776,7 @@ def process_file(
|
||||
metadata={
|
||||
"name": file.meta.get("name", file.filename),
|
||||
"created_by": file.user_id,
|
||||
"file_id": file.id,
|
||||
**file.meta,
|
||||
},
|
||||
)
|
||||
@ -795,6 +802,7 @@ def process_file(
|
||||
metadata={
|
||||
"name": file.filename,
|
||||
"created_by": file.user_id,
|
||||
"file_id": file.id,
|
||||
**file.meta,
|
||||
},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user