From 12977e07f308d41c6322c7c7960075307df76077 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 3 Oct 2024 21:31:42 -0700 Subject: [PATCH] feat: collection file content editor --- .../workspace/Knowledge/Collection.svelte | 42 ++++++++++++++++--- .../Knowledge/Collection/Files.svelte | 14 ++++++- 2 files changed, 50 insertions(+), 6 deletions(-) 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} -