diff --git a/src/lib/components/workspace/Knowledge/Collection.svelte b/src/lib/components/workspace/Knowledge/Collection.svelte
index ea93e8b38..bbc03f051 100644
--- a/src/lib/components/workspace/Knowledge/Collection.svelte
+++ b/src/lib/components/workspace/Knowledge/Collection.svelte
@@ -38,8 +38,17 @@
let knowledge: Knowledge | null = null;
let query = '';
+ let selectedFile = null;
let selectedFileId = null;
+ $: if (selectedFileId) {
+ const file = knowledge.files.find((file) => file.id === selectedFileId);
+ if (file) {
+ file.data = file.data ?? { content: '' };
+ selectedFile = file;
+ }
+ }
+
let debounceTimeout = null;
let mediaQuery;
let dragged = false;
@@ -271,7 +280,7 @@
{
changeDebounceHandler();
@@ -321,7 +330,16 @@
{#if (knowledge?.files ?? []).length > 0}
-
+ {
+ selectedFileId = e.detail;
+ }}
+ on:delete={(e) => {
+ console.log(e.detail);
+ }}
+ />
{:else}
No content found
@@ -331,9 +349,23 @@
{#if largeScreen}
-
- {#if selectedFileId}
-
+
+ {#if selectedFile}
+
+
+
+ {selectedFile?.meta?.name}
+
+
+
+
+
+
+
{:else}
diff --git a/src/lib/components/workspace/Knowledge/Collection/Files.svelte b/src/lib/components/workspace/Knowledge/Collection/Files.svelte
index 01a5ce720..977e7e579 100644
--- a/src/lib/components/workspace/Knowledge/Collection/Files.svelte
+++ b/src/lib/components/workspace/Knowledge/Collection/Files.svelte
@@ -1,6 +1,10 @@
@@ -9,11 +13,19 @@
{
+ dispatch('click', file.id);
+ }}
+ on:dismiss={() => {
+ dispatch('delete', file.id);
+ }}
/>
{/each}