mirror of
https://github.com/open-webui/open-webui
synced 2025-04-04 21:03:18 +00:00
refac: legacy support
This commit is contained in:
parent
8013c152d0
commit
1fe1c27220
@ -334,7 +334,10 @@ def get_rag_context(
|
|||||||
elif file.get("collection_name"):
|
elif file.get("collection_name"):
|
||||||
collection_names.append(file["collection_name"])
|
collection_names.append(file["collection_name"])
|
||||||
elif file.get("id"):
|
elif file.get("id"):
|
||||||
collection_names.append(f"file-{file['id']}")
|
if file.get("legacy"):
|
||||||
|
collection_names.append(f"{file['id']}")
|
||||||
|
else:
|
||||||
|
collection_names.append(f"file-{file['id']}")
|
||||||
|
|
||||||
collection_names = set(collection_names).difference(extracted_collections)
|
collection_names = set(collection_names).difference(extracted_collections)
|
||||||
if not collection_names:
|
if not collection_names:
|
||||||
|
@ -65,6 +65,7 @@ def upgrade():
|
|||||||
user_id=doc.user_id,
|
user_id=doc.user_id,
|
||||||
description=doc.name,
|
description=doc.name,
|
||||||
meta={
|
meta={
|
||||||
|
"legacy": True,
|
||||||
"document": True,
|
"document": True,
|
||||||
"tags": json.loads(doc.content or "{}").get("tags", []),
|
"tags": json.loads(doc.content or "{}").get("tags", []),
|
||||||
},
|
},
|
||||||
|
@ -101,7 +101,12 @@
|
|||||||
]
|
]
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
items = [...$knowledge, ...legacy_collections];
|
items = [...$knowledge, ...legacy_collections].map((item) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
...{ legacy: item?.legacy ?? item?.meta?.document ?? undefined }
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
fuse = new Fuse(items, {
|
fuse = new Fuse(items, {
|
||||||
keys: ['name', 'description']
|
keys: ['name', 'description']
|
||||||
|
Loading…
Reference in New Issue
Block a user