fix: clicking a cited file in a temporary side chat opens nothing (#34923)

In a temporary side chat, clicking a source from a knowledge base did nothing, both on the citation marker in the reply and in the source list. No tab opened beside the chat and no source dialog showed either. The file now opens in a tab beside the chat with the cited passage marked, the same as in a saved side chat or a temporary main chat.

Fixes #34921
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-24 18:52:47 +04:00
1 parent 810f2ddd8a
commit 00cb737759
1 file changed
+10 -2
+10 -2
View File
@@ -118,7 +118,7 @@
import ConfirmDialog from '../common/ConfirmDialog.svelte';
let stopTerminalChoice: ((stop: boolean) => void) | null = null;
import SplitPanel from '../icons/SplitPanel.svelte';
import { isSavedChatId } from '$lib/utils/chatId';
import { isSavedChatId, isTemporaryChatId } from '$lib/utils/chatId';
const i18n = getContext<any>('i18n');
const appLayout = getContext<AppLayoutContext | undefined>('appLayout');
@@ -1499,9 +1499,17 @@
return source ? `${tab.label} · ${source.label}` : tab.label;
};
$: showArtifactsTab = $mainArtifacts.length > 0 && $visibleControls['chat.artifacts'];
// A temporary side chat tab keeps no chat id; a citation clicked there comes from the active tab.
$: embedSourceTab =
$embed?.chatId && $embed.chatId !== chatId
? tabs.tabs.find((tab) => tab.kind === 'chat' && tab.chatId === $embed.chatId)
? (tabs.tabs.find((tab) => tab.kind === 'chat' && tab.chatId === $embed.chatId) ??
($showEmbeds &&
isTemporaryChatId($embed.chatId) &&
activeTab?.kind === 'chat' &&
activeTab.id !== mainChatTabId &&
!activeTab.chatId
? activeTab
: undefined))
: undefined;
$: showPreviewTab = !!$embed && ($embed.chatId === chatId || !!embedSourceTab);
$: availableViews = [