mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-22 21:50:42 -05:00
refac
This commit is contained in:
1 parent
31ef2064da
commit
10e695004c
7 files changed
+507
-475
No files matched your search
@@ -39,7 +39,7 @@
|
||||
socket,
|
||||
audioQueue as _audioQueue,
|
||||
showTabs as _showTabs,
|
||||
sideChatRequest,
|
||||
chatTabRequest,
|
||||
openEmbeddedChatIds,
|
||||
showCallOverlay as _showCallOverlay,
|
||||
temporaryChatEnabled as _temporaryChatEnabled,
|
||||
@@ -491,7 +491,7 @@
|
||||
// the list is rebuilt after a debounce, so it can lag behind the block being opened
|
||||
getContents();
|
||||
if (embedded) onOpenArtifacts?.(code);
|
||||
else terminalTabs?.openArtifacts(code);
|
||||
else tabs?.openArtifacts(code);
|
||||
};
|
||||
// a notes chat has nowhere to show them
|
||||
$: canOpenArtifacts = !embedded || !!onOpenArtifacts;
|
||||
@@ -508,7 +508,7 @@
|
||||
$: isShared = chat != null && chat.user_id !== $user?.id;
|
||||
$: if (isShared && $showCallOverlay) showCallOverlay.set(false);
|
||||
$: canClone = isShared && ($user?.role === 'admin' || ($user?.permissions?.chat?.import ?? true));
|
||||
$: sideChatAllowed =
|
||||
$: canOpenChatTab =
|
||||
$user?.role === 'admin' ||
|
||||
($user?.role === 'user' && ($user.permissions?.chat?.side_chat ?? false));
|
||||
let cloning = false;
|
||||
@@ -600,7 +600,7 @@
|
||||
if (selectedModels.includes('')) throw new Error($i18n.t('Model not selected'));
|
||||
const attachments = [structuredClone(file)];
|
||||
if (fullWidthTabs) {
|
||||
terminalTabs?.focusMainChat();
|
||||
tabs?.focusMainChat();
|
||||
await tick();
|
||||
if (!$showCallOverlay) messageInput?.focus({ preventScroll: true });
|
||||
}
|
||||
@@ -621,7 +621,7 @@
|
||||
// Adds text to the composer for the user to review, keeping any draft already there.
|
||||
const draftPrompt = async (text: string) => {
|
||||
if (fullWidthTabs) {
|
||||
terminalTabs?.focusMainChat();
|
||||
tabs?.focusMainChat();
|
||||
await tick();
|
||||
}
|
||||
messageInput?.setText(prompt.trim() ? `${prompt.trimEnd()}\n\n${text}` : text);
|
||||
@@ -993,7 +993,7 @@
|
||||
onDestroy(() => chatLoadController.abort());
|
||||
const navigateHandler = async () => {
|
||||
loading = true;
|
||||
terminalTabs?.prepareChatSwitch();
|
||||
tabs?.resetForChatSwitch();
|
||||
const signal = startChatLoad();
|
||||
modelDefaults = null;
|
||||
cancelBrowserInteractions();
|
||||
@@ -2178,7 +2178,7 @@
|
||||
) {
|
||||
tick().then(async () => {
|
||||
await initNewChat();
|
||||
if (initialPage) terminalTabs?.openPageTab({ href: initialPage, label: '' });
|
||||
if (initialPage) tabs?.openPageTab({ href: initialPage, label: '' });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2898,14 +2898,15 @@
|
||||
}
|
||||
if (destinationFolder?.id) mainChatHref = `/folders/${destinationFolder.id}`;
|
||||
if (keepDraft && !$chatId && !history.currentId && previousHref === mainChatHref) {
|
||||
terminalTabs?.focusMainChat();
|
||||
tabs?.focusMainChat();
|
||||
return;
|
||||
}
|
||||
terminalTabs?.prepareChatSwitch(preserveTabs);
|
||||
if (preserveTabs) tabs?.carryPagesToNewChat();
|
||||
else tabs?.resetForChatSwitch();
|
||||
loading = true;
|
||||
if (
|
||||
!embedded &&
|
||||
($showTabs === 'comments' || $showTabs === 'side' || typeof $showTabs === 'object')
|
||||
($showTabs === 'comments' || $showTabs === 'chat' || typeof $showTabs === 'object')
|
||||
)
|
||||
showTabs.set(false);
|
||||
const signal = startChatLoad();
|
||||
@@ -3189,12 +3190,12 @@
|
||||
);
|
||||
|
||||
await tick();
|
||||
if (preserveTabs) terminalTabs?.focusMainChat();
|
||||
if (preserveTabs) tabs?.focusMainChat();
|
||||
messageInput?.focus({ preventScroll: true });
|
||||
};
|
||||
|
||||
const loadChat = async (signal = startChatLoad()) => {
|
||||
if (chatIdProp && chatIdProp !== $chatId) terminalTabs?.prepareChatSwitch();
|
||||
if (chatIdProp && chatIdProp !== $chatId) tabs?.resetForChatSwitch();
|
||||
if (chatIdProp && chatIdProp !== $chatId) {
|
||||
terminalContext = null;
|
||||
history = { messages: {}, currentId: null };
|
||||
@@ -4214,7 +4215,7 @@
|
||||
prompt = '';
|
||||
};
|
||||
|
||||
let terminalTabs: Tabs;
|
||||
let tabs: Tabs;
|
||||
let fullWidthTabs = false;
|
||||
let mainChatActive = false;
|
||||
let mainChatStyle = '';
|
||||
@@ -4376,13 +4377,13 @@
|
||||
_chatId = createTemporaryChatId($socket?.id);
|
||||
await chatId.set(_chatId);
|
||||
}
|
||||
if (!_chatId && (tabbed || context?.currentDirectory || terminalTabs?.hasTerminals())) {
|
||||
if (!_chatId && (tabbed || context?.currentDirectory || tabs?.hasTerminalTabs())) {
|
||||
_chatId = await initChatHandler(_history);
|
||||
}
|
||||
await tick();
|
||||
}
|
||||
if (history !== _history) return null;
|
||||
if (_chatId) await terminalTabs?.bindTerminalChat(_chatId);
|
||||
if (_chatId) await tabs?.attachChatViewTo(_chatId);
|
||||
if (history !== _history || $chatId !== _chatId) return null;
|
||||
// Also covers temporary/embedded chats and retries after a failed initialization.
|
||||
if (_chatId) await initializeTerminalDirectory(_chatId, context);
|
||||
@@ -4433,21 +4434,21 @@
|
||||
messageInput?.openComments();
|
||||
return { status: 'rejected' };
|
||||
}
|
||||
const sideCommand = String(userPrompt)
|
||||
const chatTabCommand = String(userPrompt)
|
||||
.trim()
|
||||
.match(/^\/(?:side|btw)(?:\s+([\s\S]*))?$/i);
|
||||
if (sideCommand && !sideChatAllowed) {
|
||||
if (chatTabCommand && !canOpenChatTab) {
|
||||
toast.error($i18n.t('You do not have permission to use side chat.'));
|
||||
return { status: 'rejected' };
|
||||
}
|
||||
if (sideCommand && !embedded && $chatId && history.currentId) {
|
||||
if (chatTabCommand && !embedded && $chatId && history.currentId) {
|
||||
if (selectedModels.length !== 1 || !selectedModelIds[0]) {
|
||||
toast.error($i18n.t('Select only one model to open a side chat.'));
|
||||
return { status: 'rejected' };
|
||||
}
|
||||
clearCommandInput();
|
||||
sideChatRequest.set({ parentId: $chatId, prompt: sideCommand[1] ?? '' });
|
||||
showTabs.set('side');
|
||||
chatTabRequest.set({ parentChatId: $chatId, prompt: chatTabCommand[1] ?? '' });
|
||||
showTabs.set('chat');
|
||||
return { status: 'rejected' };
|
||||
}
|
||||
if (String(userPrompt).trim() === '/fork') {
|
||||
@@ -5789,9 +5790,9 @@
|
||||
id={chatContainerId}
|
||||
data-chat={embedded ? instanceId : 'main'}
|
||||
role="presentation"
|
||||
on:dragover|capture={(event) => terminalTabs?.dragOverChat(event)}
|
||||
on:drop|capture={(event) => terminalTabs?.dropChat(event)}
|
||||
on:dragleave={(event) => terminalTabs?.leaveChatDrop(event)}
|
||||
on:dragover|capture={(event) => tabs?.handleChatDragOver(event)}
|
||||
on:drop|capture={(event) => tabs?.handleChatDrop(event)}
|
||||
on:dragleave={(event) => tabs?.handleChatDragLeave(event)}
|
||||
>
|
||||
<div in:fade={{ duration: 50 }} class="w-full h-full flex flex-col">
|
||||
{#if backgroundImage}
|
||||
@@ -5811,8 +5812,8 @@
|
||||
style={fullWidthTabs ? mainChatStyle : undefined}
|
||||
data-main-chat-pane
|
||||
data-panel-group={fullWidthTabs ? mainChatGroupId : undefined}
|
||||
on:focusin={() => fullWidthTabs && terminalTabs?.focusMainChat()}
|
||||
on:pointerdown={() => fullWidthTabs && terminalTabs?.focusMainChat()}
|
||||
on:focusin={() => fullWidthTabs && tabs?.focusMainChat()}
|
||||
on:pointerdown={() => fullWidthTabs && tabs?.focusMainChat()}
|
||||
id={fullWidthTabs ? 'chat-panel-main-chat-view' : undefined}
|
||||
role={fullWidthTabs ? 'tabpanel' : undefined}
|
||||
aria-labelledby={fullWidthTabs ? 'chat-panel-main-chat' : undefined}
|
||||
@@ -6281,15 +6282,15 @@
|
||||
tabActions={loading ? undefined : !$chatId && $selectedFolder ? folderTabActions : tabActions}
|
||||
tabBarActions={loading ? undefined : tabBarActions}
|
||||
{terminalContext}
|
||||
bind:history
|
||||
bind:chatHistory={history}
|
||||
bind:files
|
||||
chatId={$chatId}
|
||||
mainArtifacts={artifacts}
|
||||
bind:this={terminalTabs}
|
||||
bind:this={tabs}
|
||||
folderId={chat ? (chat.folder_id ?? null) : ($selectedFolder?.id ?? null)}
|
||||
chatUser={chatOwner}
|
||||
modelId={selectedModelIds?.at(0) ?? null}
|
||||
canBranchChat={sideChatAllowed}
|
||||
{canOpenChatTab}
|
||||
systemPrompt={params?.system || $settings.system || ''}
|
||||
submitPrompt={submitHandler}
|
||||
onAskFile={askFile}
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
showFileNavDir,
|
||||
TTSWorker,
|
||||
temporaryChatEnabled,
|
||||
sideChatRequest,
|
||||
chatTabRequest,
|
||||
visibleControls
|
||||
} from '$lib/stores';
|
||||
|
||||
@@ -1753,8 +1753,8 @@
|
||||
onComments: openComments,
|
||||
onSide: () => {
|
||||
if (!canSide) return;
|
||||
sideChatRequest.set({ parentId: chatId, prompt: '' });
|
||||
showTabs.set('side');
|
||||
chatTabRequest.set({ parentChatId: chatId, prompt: '' });
|
||||
showTabs.set('chat');
|
||||
},
|
||||
onFork: forkHandler,
|
||||
onModel: () => modelSelector?.open(),
|
||||
|
||||
+427
-396
File diff suppressed because it is too large.
Load diff
@@ -2,7 +2,7 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
import type { TerminalContext } from '$lib/types';
|
||||
import type { TerminalTarget } from '$lib/apis/terminal';
|
||||
|
||||
export type PanelTabKind =
|
||||
export type TabKind =
|
||||
| 'chat'
|
||||
| 'page'
|
||||
| 'files'
|
||||
@@ -14,9 +14,9 @@ export type PanelTabKind =
|
||||
| 'preview'
|
||||
| 'voice'
|
||||
| 'comments';
|
||||
export type PanelTab = {
|
||||
export type Tab = {
|
||||
id: string;
|
||||
kind: PanelTabKind;
|
||||
kind: TabKind;
|
||||
label: string;
|
||||
href?: string;
|
||||
initialPrompt?: string;
|
||||
@@ -38,39 +38,39 @@ export type PanelTab = {
|
||||
browserBaseUrl?: string;
|
||||
context?: TerminalContext | null;
|
||||
};
|
||||
export type PanelGroup = { id: string; tabIds: string[]; activeId: string };
|
||||
export type TabGroup = { id: string; tabIds: string[]; activeId: string };
|
||||
export type SplitEdge = 'left' | 'right' | 'top' | 'bottom';
|
||||
export type PanelLayout =
|
||||
export type TabLayout =
|
||||
| { type: 'group'; groupId: string }
|
||||
| {
|
||||
type: 'split';
|
||||
id: string;
|
||||
direction: 'horizontal' | 'vertical';
|
||||
ratio: number;
|
||||
first: PanelLayout;
|
||||
second: PanelLayout;
|
||||
first: TabLayout;
|
||||
second: TabLayout;
|
||||
};
|
||||
export type PanelTabs = {
|
||||
tabs: PanelTab[];
|
||||
export type TabsState = {
|
||||
tabs: Tab[];
|
||||
activeId: string;
|
||||
history: string[];
|
||||
groups: PanelGroup[];
|
||||
groups: TabGroup[];
|
||||
activeGroupId: string;
|
||||
layout: PanelLayout;
|
||||
layout: TabLayout;
|
||||
};
|
||||
export type ChatViewState = {
|
||||
schemaVersion: 1;
|
||||
selectedTerminalId: string | null;
|
||||
panels: PanelTabs;
|
||||
panels: TabsState;
|
||||
};
|
||||
export type PanelRect = { left: number; top: number; width: number; height: number };
|
||||
export type PanelDivider = PanelRect & {
|
||||
export type GroupRect = { left: number; top: number; width: number; height: number };
|
||||
export type SplitDivider = GroupRect & {
|
||||
id: string;
|
||||
direction: 'horizontal' | 'vertical';
|
||||
ratio: number;
|
||||
};
|
||||
|
||||
export const emptyTabs = (): PanelTabs => ({
|
||||
export const createTabsState = (): TabsState => ({
|
||||
tabs: [],
|
||||
activeId: '',
|
||||
history: [],
|
||||
@@ -82,13 +82,13 @@ export const mainChatTabId = 'main-chat';
|
||||
|
||||
/** Read layouts saved before all conversation tabs used kind: 'chat'. */
|
||||
export function normalizeChatTab(
|
||||
tab: Omit<PanelTab, 'kind'> & {
|
||||
kind: PanelTabKind | 'side';
|
||||
tab: Omit<Tab, 'kind'> & {
|
||||
kind: TabKind | 'side';
|
||||
sideChatNumber?: number;
|
||||
sideChat?: boolean;
|
||||
},
|
||||
parentChatId: string | null
|
||||
): PanelTab {
|
||||
): Tab {
|
||||
const { sideChatNumber, sideChat, ...current } = tab;
|
||||
return {
|
||||
...current,
|
||||
@@ -102,7 +102,7 @@ export function normalizeChatTab(
|
||||
};
|
||||
}
|
||||
|
||||
export function setMainChatTab(state: PanelTabs, visible: boolean, label = 'Chat'): PanelTabs {
|
||||
export function setMainChatTab(state: TabsState, visible: boolean, label = 'Chat'): TabsState {
|
||||
if (!visible) {
|
||||
return setSplitTabs(removeTab(state, mainChatTabId), false);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ export function setMainChatTab(state: PanelTabs, visible: boolean, label = 'Chat
|
||||
return activateTab(next, state.activeId || mainChatTabId);
|
||||
}
|
||||
|
||||
export function setSplitTabs(state: PanelTabs, split: boolean): PanelTabs {
|
||||
export function setSplitTabs(state: TabsState, split: boolean): TabsState {
|
||||
if (!split) {
|
||||
if (state.groups.length === 1) return state;
|
||||
return {
|
||||
@@ -144,7 +144,7 @@ export function setSplitTabs(state: PanelTabs, split: boolean): PanelTabs {
|
||||
return activateTab(splitTab(state, mainChatTabId, group.id, 'left'), state.activeId);
|
||||
}
|
||||
|
||||
export function activateTab(state: PanelTabs, id: string): PanelTabs {
|
||||
export function activateTab(state: TabsState, id: string): TabsState {
|
||||
const group = state.groups.find((group) => group.tabIds.includes(id));
|
||||
if (!group || (state.activeId === id && group.activeId === id)) return state;
|
||||
return {
|
||||
@@ -159,7 +159,7 @@ export function activateTab(state: PanelTabs, id: string): PanelTabs {
|
||||
};
|
||||
}
|
||||
|
||||
export function openTab(state: PanelTabs, tab: PanelTab): PanelTabs {
|
||||
export function openTab(state: TabsState, tab: Tab): TabsState {
|
||||
return activateTab(
|
||||
state.tabs.some((item) => item.id === tab.id)
|
||||
? state
|
||||
@@ -177,11 +177,11 @@ export function openTab(state: PanelTabs, tab: PanelTab): PanelTabs {
|
||||
}
|
||||
|
||||
/** Opens `tab` in a group beside the one holding `besideId`, so both stay in view. */
|
||||
export function openTabInSidePanel(
|
||||
state: PanelTabs,
|
||||
tab: PanelTab,
|
||||
export function openTabInSplit(
|
||||
state: TabsState,
|
||||
tab: Tab,
|
||||
besideId = mainChatTabId
|
||||
): PanelTabs {
|
||||
): TabsState {
|
||||
const besideGroup = state.groups.find((group) => group.tabIds.includes(besideId));
|
||||
if (!besideGroup) return openTab(state, tab);
|
||||
if (state.tabs.some((item) => item.id === tab.id) && !besideGroup.tabIds.includes(tab.id))
|
||||
@@ -195,14 +195,14 @@ export function openTabInSidePanel(
|
||||
: splitTab(next, tab.id, besideGroup.id, 'right');
|
||||
}
|
||||
|
||||
function removeLayoutGroup(layout: PanelLayout, groupId: string): PanelLayout | null {
|
||||
function removeLayoutGroup(layout: TabLayout, groupId: string): TabLayout | null {
|
||||
if (layout.type === 'group') return layout.groupId === groupId ? null : layout;
|
||||
const first = removeLayoutGroup(layout.first, groupId);
|
||||
const second = removeLayoutGroup(layout.second, groupId);
|
||||
return first && second ? { ...layout, first, second } : (first ?? second);
|
||||
}
|
||||
|
||||
function removeFromGroup(state: PanelTabs, id: string): PanelTabs {
|
||||
function removeFromGroup(state: TabsState, id: string): TabsState {
|
||||
const source = state.groups.find((group) => group.tabIds.includes(id));
|
||||
if (!source) return state;
|
||||
const tabIds = source.tabIds.filter((tabId) => tabId !== id);
|
||||
@@ -231,12 +231,12 @@ function removeFromGroup(state: PanelTabs, id: string): PanelTabs {
|
||||
};
|
||||
}
|
||||
|
||||
export function removeTab(state: PanelTabs, id: string): PanelTabs {
|
||||
export function removeTab(state: TabsState, id: string): TabsState {
|
||||
if (!state.tabs.some((tab) => tab.id === id)) return state;
|
||||
return { ...removeFromGroup(state, id), tabs: state.tabs.filter((tab) => tab.id !== id) };
|
||||
}
|
||||
|
||||
export function moveTab(state: PanelTabs, id: string, to: number): PanelTabs {
|
||||
export function moveTab(state: TabsState, id: string, to: number): TabsState {
|
||||
const group = state.groups.find((group) => group.tabIds.includes(id));
|
||||
if (!group) return state;
|
||||
const from = group.tabIds.indexOf(id);
|
||||
@@ -249,7 +249,7 @@ export function moveTab(state: PanelTabs, id: string, to: number): PanelTabs {
|
||||
};
|
||||
}
|
||||
|
||||
export function moveTabToGroup(state: PanelTabs, id: string, groupId: string): PanelTabs {
|
||||
export function moveTabToGroup(state: TabsState, id: string, groupId: string): TabsState {
|
||||
const target = state.groups.find((group) => group.id === groupId);
|
||||
if (!target || !state.tabs.some((tab) => tab.id === id)) return state;
|
||||
if (target.tabIds.includes(id)) return activateTab(state, id);
|
||||
@@ -266,20 +266,20 @@ export function moveTabToGroup(state: PanelTabs, id: string, groupId: string): P
|
||||
}
|
||||
|
||||
export function splitTab(
|
||||
state: PanelTabs,
|
||||
state: TabsState,
|
||||
id: string,
|
||||
groupId: string,
|
||||
edge: SplitEdge
|
||||
): PanelTabs {
|
||||
): TabsState {
|
||||
const source = state.groups.find((group) => group.tabIds.includes(id));
|
||||
if (!source || !state.groups.some((group) => group.id === groupId)) return state;
|
||||
if (source.id === groupId && source.tabIds.length === 1) return state;
|
||||
const next = removeFromGroup(state, id);
|
||||
const newGroup: PanelGroup = { id: uuidv4(), tabIds: [id], activeId: id };
|
||||
const replace = (layout: PanelLayout): PanelLayout => {
|
||||
const newGroup: TabGroup = { id: uuidv4(), tabIds: [id], activeId: id };
|
||||
const replace = (layout: TabLayout): TabLayout => {
|
||||
if (layout.type === 'group') {
|
||||
if (layout.groupId !== groupId) return layout;
|
||||
const leaf: PanelLayout = { type: 'group', groupId: newGroup.id };
|
||||
const leaf: TabLayout = { type: 'group', groupId: newGroup.id };
|
||||
const before = edge === 'left' || edge === 'top';
|
||||
return {
|
||||
type: 'split',
|
||||
@@ -298,7 +298,7 @@ export function splitTab(
|
||||
);
|
||||
}
|
||||
|
||||
export function resizeSplit(layout: PanelLayout, id: string, ratio: number): PanelLayout {
|
||||
export function resizeSplit(layout: TabLayout, id: string, ratio: number): TabLayout {
|
||||
if (layout.type === 'group') return layout;
|
||||
if (layout.id === id) return { ...layout, ratio: Math.max(0.2, Math.min(0.8, ratio)) };
|
||||
return {
|
||||
@@ -309,10 +309,10 @@ export function resizeSplit(layout: PanelLayout, id: string, ratio: number): Pan
|
||||
}
|
||||
|
||||
// Flat positions keep every tab view mounted when the split tree changes.
|
||||
export function panelPositions(layout: PanelLayout) {
|
||||
const groups: Record<string, PanelRect> = {};
|
||||
const dividers: PanelDivider[] = [];
|
||||
const visit = (node: PanelLayout, rect: PanelRect) => {
|
||||
export function getLayoutRects(layout: TabLayout) {
|
||||
const groups: Record<string, GroupRect> = {};
|
||||
const dividers: SplitDivider[] = [];
|
||||
const visit = (node: TabLayout, rect: GroupRect) => {
|
||||
if (node.type === 'group') {
|
||||
groups[node.groupId] = rect;
|
||||
return;
|
||||
|
||||
@@ -6,12 +6,12 @@ import { terminalRequest, type TerminalTarget } from '$lib/apis/terminal';
|
||||
import { createBrowserSession } from '$lib/apis/terminal/browser';
|
||||
import { isSavedChatId } from '$lib/utils/chatId';
|
||||
import {
|
||||
emptyTabs,
|
||||
createTabsState,
|
||||
mainChatTabId,
|
||||
normalizeChatTab,
|
||||
removeTab,
|
||||
type ChatViewState,
|
||||
type PanelTab
|
||||
type Tab
|
||||
} from '$lib/components/chat/Tabs/tabs';
|
||||
|
||||
export type EditorDraft = {
|
||||
@@ -91,7 +91,7 @@ export function chatViewEntry(userId: string, chatId: string | null, temporary =
|
||||
instanceId: uuidv4(),
|
||||
userId,
|
||||
chatId,
|
||||
state: { schemaVersion: 1, selectedTerminalId: null, panels: emptyTabs() },
|
||||
state: { schemaVersion: 1, selectedTerminalId: null, panels: createTabsState() },
|
||||
drafts: new Map(),
|
||||
transient: {},
|
||||
pending: new Map(),
|
||||
@@ -171,7 +171,7 @@ export async function flushChatView(entry: Entry): Promise<void> {
|
||||
return entry.write;
|
||||
}
|
||||
|
||||
export function updateViewTab(entry: Entry, id: string, values: Partial<PanelTab>) {
|
||||
export function updateViewTab(entry: Entry, id: string, values: Partial<Tab>) {
|
||||
if (!entry.state.panels.tabs.some((tab) => tab.id === id)) return;
|
||||
changeChatView(
|
||||
entry,
|
||||
|
||||
@@ -173,7 +173,7 @@ export const showChangelog = writable(false);
|
||||
export const showTabs = writable<
|
||||
| boolean
|
||||
| 'comments'
|
||||
| 'side'
|
||||
| 'chat'
|
||||
| 'voice'
|
||||
| (CommentTarget & { tab: 'comments'; comment_id?: string })
|
||||
>(false);
|
||||
@@ -194,7 +194,7 @@ export const embed = writable(null);
|
||||
|
||||
export const temporaryChatEnabled = writable(false);
|
||||
export const openEmbeddedChatIds = writable<Set<string>>(new Set());
|
||||
export const sideChatRequest = writable<{ parentId: string; prompt: string } | null>(null);
|
||||
export const chatTabRequest = writable<{ parentChatId: string; prompt: string } | null>(null);
|
||||
|
||||
export type QueryData = {
|
||||
query: string;
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
await goto(`/auth?redirect=${encodeURIComponent(currentUrl)}`);
|
||||
};
|
||||
|
||||
// Chat shortcuts act on the chat that has focus, otherwise the main chat. Side chats sit
|
||||
// Chat shortcuts act on the chat that has focus, otherwise the main chat. Chat tabs sit
|
||||
// inside the main chat, so an element belongs to the nearest [data-chat] around it.
|
||||
const chatElements = <T extends HTMLElement = HTMLElement>(selector: string): T[] => {
|
||||
const chat =
|
||||
|
||||
Reference in new issue
Block a user