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' }; });