Skip to content

Commit

Permalink
Reinstate markdown rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
codewithcheese committed May 18, 2024
1 parent 364aec6 commit 01441cd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import CodeBlock from "./CodeBlock.svelte";
type Props = {
message: { role: string; content: string };
content: string;
};
let { message }: Props = $props();
let { content }: Props = $props();
let contentEl: HTMLElement | undefined = $state();
Expand Down Expand Up @@ -60,7 +60,7 @@
return md.replaceAll("&lt;", "<");
}
let tokens = $derived(marked.lexer(sanitizeMd(message.content)));
let tokens = $derived(marked.lexer(sanitizeMd(content)));
</script>

<div
Expand Down
20 changes: 12 additions & 8 deletions src/routes/(app)/project/[id]/responses/ResponseCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import { updateResponsePrompt } from "../$data";
import { removeResponse, type ResponsesView, updateMessages } from "./$data.svelte";
import { invalidateModel } from "@/database";
import MessageMarkdown from "./MessageMarkdown.svelte";
export let response: ResponsesView[number];
export let initialMessages: ResponseMessage[];
Expand Down Expand Up @@ -93,10 +94,14 @@
<LoaderCircleIcon
onclick={stop}
size={16}
class="loading-icon text-gray-500 hover:bg-accent"
class="loading-icon cursor-pointer text-gray-500 hover:bg-accent"
/>
{:else}
<RefreshCwIcon onclick={refresh} size={16} class="text-gray-500 hover:bg-accent" />
<RefreshCwIcon
onclick={refresh}
size={16}
class="cursor-pointer text-gray-500 hover:bg-accent"
/>
{/if}

<div class="pr-2 text-xs text-gray-500">{response.model.name}</div>
Expand All @@ -120,11 +125,10 @@
<Label class="text-red-500">{response.error}</Label>
{/if}

<!--{#if format === "markdown"}-->
<!-- <MessageMarkdown {message} />-->
<!--{:else}-->
<!-- -->
<!--{/if}-->
{content}
{#if format === "markdown"}
<MessageMarkdown {content} />
{:else}
{content}
{/if}
</CardContent>
</Card>

0 comments on commit 01441cd

Please sign in to comment.