From ee6e41b14442666b133fb9a0f74627503c9ef66c Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 4 Oct 2024 16:56:20 -0700 Subject: [PATCH] refac: legacy support --- src/lib/components/chat/Chat.svelte | 42 +++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 9c9707e6d..58d0a5445 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -937,7 +937,26 @@ done: false } ]; - files.push(...model.info.meta.knowledge); + files.push( + ...model.info.meta.knowledge.map((item) => { + if (item?.collection_name) { + return { + id: item.collection_name, + name: item.name, + legacy: true + }; + } else if (item?.collection_names) { + return { + name: item.name, + type: 'collection', + collection_names: item.collection_names, + legacy: true + }; + } else { + return item; + } + }) + ); history.messages[responseMessageId] = responseMessage; } files.push( @@ -1243,7 +1262,26 @@ done: false } ]; - files.push(...model.info.meta.knowledge); + files.push( + ...model.info.meta.knowledge.map((item) => { + if (item?.collection_name) { + return { + id: item.collection_name, + name: item.name, + legacy: true + }; + } else if (item?.collection_names) { + return { + name: item.name, + type: 'collection', + collection_names: item.collection_names, + legacy: true + }; + } else { + return item; + } + }) + ); history.messages[responseMessageId] = responseMessage; } files.push(