mirror of
https://github.com/open-webui/computer.git
synced 2026-12-06 11:37:58 -05:00
refac
This commit is contained in:
1 parent
e0badc879c
commit
cdbd446813
3 files changed
+94
-30
No files matched your search
@@ -2,8 +2,10 @@
|
||||
import { tick } from 'svelte';
|
||||
import { slide } from 'svelte/transition';
|
||||
import { quintOut } from 'svelte/easing';
|
||||
import { get } from 'svelte/store';
|
||||
import MarkdownRenderer from '$lib/components/markdown/MarkdownRenderer.svelte';
|
||||
import OutputEditView from './OutputEditView.svelte';
|
||||
import { currentWorkspace, openFileTab } from '$lib/stores';
|
||||
|
||||
interface Props {
|
||||
content: string;
|
||||
@@ -279,17 +281,32 @@
|
||||
|
||||
{:else if displayItem.type === 'artifact_item'}
|
||||
{@const artifact = displayItem.item}
|
||||
<div class="w-full my-2 rounded-xl border border-gray-200 dark:border-white/10">
|
||||
<div class="flex items-center gap-2 px-4 py-2.5 border-b border-gray-200 dark:border-white/10">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-4 text-gray-400 dark:text-gray-500 shrink-0">
|
||||
{@const preview = (artifact.content || '').replace(/^#.*\n*/m, '').trim().slice(0, 200)}
|
||||
<button
|
||||
class="w-full text-left my-2 rounded-xl
|
||||
border border-gray-200 dark:border-white/10
|
||||
hover:border-gray-300 dark:hover:border-white/15
|
||||
bg-gray-50/50 dark:bg-white/[0.02]
|
||||
hover:bg-gray-50 dark:hover:bg-white/[0.04]
|
||||
transition-colors duration-150 cursor-pointer"
|
||||
onclick={() => {
|
||||
const ws = get(currentWorkspace);
|
||||
if (ws && artifact.path) {
|
||||
const fullPath = ws.path.replace(/\/$/, '') + '/' + artifact.path;
|
||||
openFileTab(fullPath);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div class="flex items-center gap-1.5 px-3 pt-2 pb-0.5">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-3.5 text-gray-400 dark:text-gray-500 shrink-0">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" />
|
||||
</svg>
|
||||
<span class="text-sm font-medium text-gray-700 dark:text-gray-200">{artifact.title || 'Artifact'}</span>
|
||||
<span class="text-sm font-medium text-gray-800 dark:text-gray-100">{artifact.title || 'Artifact'}</span>
|
||||
</div>
|
||||
<div class="px-4 py-3 max-h-[32rem] overflow-y-auto">
|
||||
<MarkdownRenderer content={artifact.content || ''} />
|
||||
</div>
|
||||
</div>
|
||||
{#if preview}
|
||||
<p class="px-3 pb-2 pt-0.5 text-xs text-gray-500 dark:text-gray-400 line-clamp-2 leading-relaxed">{preview}{preview.length >= 200 ? '...' : ''}</p>
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
{:else if displayItem.type === 'tool_group'}
|
||||
{@const calls = displayItem.calls}
|
||||
|
||||
Reference in new issue
Block a user