From 82e2c593401a3003e148a2c779a07553590a5388 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 6 Jun 2026 10:14:02 +0100 Subject: [PATCH] refac --- .../src/lib/components/chat/ChatInput.svelte | 2 +- .../lib/components/chat/UserMessage.svelte | 4 ++-- .../components/markdown/InlineRenderer.svelte | 22 +++++++++++++------ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/cptr/frontend/src/lib/components/chat/ChatInput.svelte b/cptr/frontend/src/lib/components/chat/ChatInput.svelte index 0e4ecfc..2435fc8 100644 --- a/cptr/frontend/src/lib/components/chat/ChatInput.svelte +++ b/cptr/frontend/src/lib/components/chat/ChatInput.svelte @@ -69,7 +69,7 @@ const data = await searchFiles(query || '', workspace); const results = (data as any).results ?? []; return results.slice(0, 10).map((r: any) => ({ - id: r.path, + id: r.type === 'directory' && !r.path.endsWith('/') ? r.path + '/' : r.path, label: r.name, type: r.type === 'directory' ? 'directory' : 'file', })); diff --git a/cptr/frontend/src/lib/components/chat/UserMessage.svelte b/cptr/frontend/src/lib/components/chat/UserMessage.svelte index 3efa126..42dadf8 100644 --- a/cptr/frontend/src/lib/components/chat/UserMessage.svelte +++ b/cptr/frontend/src/lib/components/chat/UserMessage.svelte @@ -2,7 +2,7 @@ import { tick } from 'svelte'; import Icon from '../Icon.svelte'; import { fileIconName } from '$lib/utils/fileIcon'; - import { openFileTab } from '$lib/stores'; + import { openFileTab, setFileBrowserCwd, setActiveTab } from '$lib/stores'; interface Props { content: string; @@ -125,7 +125,7 @@
-
{#each parsedContent as segment}{#if segment.type === 'text'}{segment.value}{:else}{/if}{/each}
+
{#each parsedContent as segment}{#if segment.type === 'text'}{segment.value}{:else}{@const isDir = segment.path.endsWith('/')}{@const cleanPath = isDir ? segment.path.slice(0, -1) : segment.path}{/if}{/each}
{#if siblingTotal > 1 || onedit} diff --git a/cptr/frontend/src/lib/components/markdown/InlineRenderer.svelte b/cptr/frontend/src/lib/components/markdown/InlineRenderer.svelte index 56803e7..a652765 100644 --- a/cptr/frontend/src/lib/components/markdown/InlineRenderer.svelte +++ b/cptr/frontend/src/lib/components/markdown/InlineRenderer.svelte @@ -1,6 +1,6 @@