From 493745a70bff7106d6f78f9754895740a142c661 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 4 Oct 2024 19:32:33 -0700 Subject: [PATCH] refac --- backend/open_webui/apps/retrieval/utils.py | 2 +- src/lib/components/workspace/Models/Knowledge/Selector.svelte | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/apps/retrieval/utils.py b/backend/open_webui/apps/retrieval/utils.py index 1c1f1e8cf..0fe206c96 100644 --- a/backend/open_webui/apps/retrieval/utils.py +++ b/backend/open_webui/apps/retrieval/utils.py @@ -347,7 +347,7 @@ def get_rag_context( try: context = None - if file["type"] == "text": + if file.get("type") == "text": context = file["content"] else: if hybrid_search: diff --git a/src/lib/components/workspace/Models/Knowledge/Selector.svelte b/src/lib/components/workspace/Models/Knowledge/Selector.svelte index 5cb22dc50..6843c17a0 100644 --- a/src/lib/components/workspace/Models/Knowledge/Selector.svelte +++ b/src/lib/components/workspace/Models/Knowledge/Selector.svelte @@ -61,7 +61,8 @@ items = [...$knowledge, ...legacy_collections].map((item) => { return { ...item, - ...(item?.legacy || item?.meta?.legacy || item?.meta?.document ? { legacy: true } : {}) + ...(item?.legacy || item?.meta?.legacy || item?.meta?.document ? { legacy: true } : {}), + type: item?.meta?.document ? 'document' : 'collection' }; });