File size: 794 Bytes
c59fd93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<script lang="ts">
	import ChatMessageCwdChange from './ChatMessageCwdChange.svelte';
	import type { DatabaseMessage } from '$lib/types';
	import { parseCwdMessage } from '$lib/utils';

	interface Props {
		class?: string;
		message: DatabaseMessage;
	}

	let { class: className = '', message }: Props = $props();

	// Synthetic messages render a dedicated UI, never a user bubble. The only
	// kind today is the working-directory change; parse the content so the
	// row reuses the exact synthetic text (and future kinds slot in here).
	let isCwdChange = $derived(parseCwdMessage(message.content) !== null);
</script>

{#if isCwdChange}
	<ChatMessageCwdChange class={className} {message} />
{:else}
	<span class="text-muted-foreground block text-sm {className}">{message.content}</span>
{/if}