From 612254480153e6738fca7331cbf6af3eda1d9409 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 23 Nov 2026 19:14:51 +0400 Subject: [PATCH] refac --- .../components/chat/Messages/Markdown/SourceToken.svelte | 7 ++++--- src/lib/components/common/FileItem.svelte | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib/components/chat/Messages/Markdown/SourceToken.svelte b/src/lib/components/chat/Messages/Markdown/SourceToken.svelte index 2270f393eb..9d740dbb10 100644 --- a/src/lib/components/chat/Messages/Markdown/SourceToken.svelte +++ b/src/lib/components/chat/Messages/Markdown/SourceToken.svelte @@ -91,9 +91,10 @@ ? $i18n.t('View source: {{title}}', { title: label }) : `${getDisplayTitle(label)} +${sources.length - 1} more sources`} class="text-[0.625rem] w-fit translate-y-[2px] px-2 py-0.5 dark:bg-base-0/5 dark:text-base-0/80 dark:hover:text-base-0 bg-base-50 text-base-1000/80 hover:text-base-1000 transition rounded-xl" - on:click={() => { - if (sources.length === 1) { - openSource(sources[0].id); + on:click={(e) => { + // From the keyboard, the marker opens the source its card shows. + if (sources.length === 1 || (openPreview && e.detail === 0)) { + openSource(sources[sourceIdx].id); } else { openPreview = !openPreview; } diff --git a/src/lib/components/common/FileItem.svelte b/src/lib/components/common/FileItem.svelte index 1b863e10eb..144e26d34a 100644 --- a/src/lib/components/common/FileItem.svelte +++ b/src/lib/components/common/FileItem.svelte @@ -40,9 +40,7 @@ import Folder from '../icons/Folder.svelte'; let showModal = false; - // The composer asks for the modal instead, as it holds the attachment's retrieval setting. const canOpenKnowledge = () => - !modal && item?.type === 'collection' && !!item.id && !!appLayout?.openPageTab &&