This commit is contained in:
Timothy Jaeryang Baek committed 2026-07-11 20:43:45 -05:00
1 parent ae35beff4d
commit 2aa1630aee
5 files changed
+70 -9

No files matched your search

@@ -0,0 +1,9 @@
<script lang="ts">
import MarkdownRenderer from '$lib/components/markdown/MarkdownRenderer.svelte';
let { content }: { content: string } = $props();
</script>
<div class="h-full overflow-y-auto px-6 py-5">
<div class="mx-auto max-w-3xl"><MarkdownRenderer {content} /></div>
</div>
@@ -8,7 +8,7 @@
import MessageTimestamp from './MessageTimestamp.svelte';
import ReasoningCollapsible from './ReasoningCollapsible.svelte';
import ToolCallCollapsible from './ToolCallCollapsible.svelte';
import { currentWorkspace, openFileTab } from '$lib/stores';
import { currentWorkspace, openArtifactTab, openFileTab } from '$lib/stores';
import { ttsConfigured, ttsEnabled } from '$lib/stores/audio';
import { tooltip } from '$lib/tooltip';
import { fileIconName } from '$lib/utils/fileIcon';
@@ -158,6 +158,10 @@
collapsedFiles = { ...collapsedFiles, [key]: !collapsedFiles[key] };
}
function openArtifact(artifact: any) {
openArtifactTab(artifact.title || 'Artifact', artifact.content || '');
}
/** Human-readable label for a tool call */
function toolLabel(name: string, args: any): string {
const _t = $t;
@@ -464,13 +468,7 @@
hover:border-gray-300 dark:hover:border-white/12
hover:bg-gray-50/50 dark:hover:bg-white/[0.03]
transition-colors duration-150 {preview ? 'h-[4.375rem]' : 'h-[2.375rem]'}"
onclick={() => {
const ws = get(currentWorkspace);
if (ws && artifact.path) {
const fullPath = ws.path.replace(/\/$/, '') + '/' + artifact.path;
openFileTab(fullPath);
}
}}
onclick={() => openArtifact(artifact)}
>
<div class="h-full min-w-0 overflow-hidden px-3 py-2.5">
<div
+33 -1
View File
@@ -53,9 +53,19 @@ export interface FileSearchTarget {
export interface Tab {
id: string;
type: 'home' | 'files' | 'terminal' | 'file' | 'git' | 'chat' | 'preview' | 'browser'; // preview is migrated on load
type:
| 'home'
| 'files'
| 'terminal'
| 'file'
| 'artifact'
| 'git'
| 'chat'
| 'preview'
| 'browser'; // preview is migrated on load
label: string;
filePath?: string;
content?: string;
edit?: boolean;
path?: string; // generic path (e.g. for chat)
sessionId?: string;
@@ -985,6 +995,28 @@ export function openFileTab(
}));
}
export function openArtifactTab(title: string, content: string): void {
const workspace = get(currentWorkspace);
const state = workspace ?? get(homeState);
const group = state.groups.find((item) => item.id === state.activeGroupId);
if (!group) return;
const existing = group.tabs.find((tab) => tab.type === 'artifact' && tab.content === content);
const tab: Tab = existing ?? { id: nextId(), type: 'artifact', label: title, content };
const updateGroup = (group: EditorGroup) =>
group.id === state.activeGroupId
? { ...group, tabs: existing ? group.tabs : [...group.tabs, tab], activeTabId: tab.id }
: group;
if (workspace) {
currentWorkspace.update((current) =>
current ? { ...current, groups: current.groups.map(updateGroup) } : current
);
} else {
homeState.update((current) => ({ ...current, groups: current.groups.map(updateGroup) }));
}
}
export function openUntitledFileTab(targetGroupId?: string): void {
// Find the lowest unused number across ALL groups
const ws = get(currentWorkspace);
+11
View File
@@ -43,6 +43,7 @@
import FileEditor from '$lib/components/FileEditor.svelte';
import GitView from '$lib/components/GitView.svelte';
import Terminal from '$lib/components/Terminal.svelte';
import ArtifactViewer from '$lib/components/ArtifactViewer.svelte';
import BrowserPreview from '$lib/components/BrowserPreview.svelte';
import ChatPanel from '$lib/components/chat/ChatPanel.svelte';
import DirectoryPicker from '$lib/components/DirectoryPicker.svelte';
@@ -1049,6 +1050,11 @@
/>
</div>
{/each}
{#each homePane.tabs.filter((tab) => tab.type === 'artifact') as tab (tab.id)}
<div class="persisted-tab" class:persisted-tab-hidden={tab.id !== homePane.activeTabId}>
<ArtifactViewer content={tab.content || ''} />
</div>
{/each}
{#each homePane.tabs.filter((tab) => tab.type === 'terminal' && tab.sessionId) as tab (tab.id)}
<div class="persisted-tab" class:persisted-tab-hidden={tab.id !== homePane.activeTabId}>
<Terminal sessionId={tab.sessionId!} />
@@ -1366,6 +1372,11 @@
/>
</div>
{/each}
{#each group.tabs.filter((tab) => tab.type === 'artifact') as tab (tab.id)}
<div class="persisted-tab" class:persisted-tab-hidden={tab.id !== group.activeTabId}>
<ArtifactViewer content={tab.content || ''} />
</div>
{/each}
{#each group.tabs.filter((tab) => tab.type === 'chat') as tab (tab.id)}
<div class="persisted-tab" class:persisted-tab-hidden={tab.id !== group.activeTabId}>
<ChatPanel