diff --git a/cptr/frontend/src/lib/components/chat/AssistantMessage.svelte b/cptr/frontend/src/lib/components/chat/AssistantMessage.svelte index 15b0df9..37f406f 100644 --- a/cptr/frontend/src/lib/components/chat/AssistantMessage.svelte +++ b/cptr/frontend/src/lib/components/chat/AssistantMessage.svelte @@ -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} -
-
- + {@const preview = (artifact.content || '').replace(/^#.*\n*/m, '').trim().slice(0, 200)} +
+ - {artifact.title || 'Artifact'} + {artifact.title || 'Artifact'}
-
- -
-
+ {#if preview} +

{preview}{preview.length >= 200 ? '...' : ''}

+ {/if} + {:else if displayItem.type === 'tool_group'} {@const calls = displayItem.calls} diff --git a/cptr/frontend/src/lib/components/markdown/BlockRenderer.svelte b/cptr/frontend/src/lib/components/markdown/BlockRenderer.svelte index 630e196..0ab89e3 100644 --- a/cptr/frontend/src/lib/components/markdown/BlockRenderer.svelte +++ b/cptr/frontend/src/lib/components/markdown/BlockRenderer.svelte @@ -51,28 +51,75 @@ {:else if token.type === 'table'} {@const table = token as Tokens.Table} - - - - {#each table.header as cell, i} - - {/each} - - - - {#each table.rows as row} - - {#each row as cell, i} - +
+
+
- -
- -
+ + + {#each table.header as cell, i} + + {/each} + + + + {#each table.rows as row, rowIdx} + + {#each row as cell, i} + + {/each} + {/each} - - {/each} - -
+ +
+ +
+ + +
+ + + + {:else if token.type === 'hr'}
diff --git a/cptr/frontend/src/lib/components/markdown/MarkdownRenderer.svelte b/cptr/frontend/src/lib/components/markdown/MarkdownRenderer.svelte index a6e364b..93956f1 100644 --- a/cptr/frontend/src/lib/components/markdown/MarkdownRenderer.svelte +++ b/cptr/frontend/src/lib/components/markdown/MarkdownRenderer.svelte @@ -41,6 +41,6 @@ }); -
+