diff --git a/src/lib/components/CodeBlock.svelte b/src/lib/components/CodeBlock.svelte index 585050cf5be..db8513825d6 100644 --- a/src/lib/components/CodeBlock.svelte +++ b/src/lib/components/CodeBlock.svelte @@ -4,10 +4,10 @@ interface Props { code?: string; - lang?: string; + rawCode?: string; } - let { code = "" }: Props = $props(); + let { code = "", rawCode = "" }: Props = $props();
@@ -17,6 +17,6 @@ >
diff --git a/src/lib/components/chat/ChatWindow.svelte b/src/lib/components/chat/ChatWindow.svelte index 55c388c7d2e..b56bc2d2a2b 100644 --- a/src/lib/components/chat/ChatWindow.svelte +++ b/src/lib/components/chat/ChatWindow.svelte @@ -276,8 +276,8 @@ {/if} {#if messages.length > 0} -
- {#each messages.toReversed() as message, idx (message.id)} +
+ {#each messages as message, idx (message.id)} + {/if} {/each} diff --git a/src/lib/utils/marked.ts b/src/lib/utils/marked.ts index ee1c47290d2..84fa7bc5081 100644 --- a/src/lib/utils/marked.ts +++ b/src/lib/utils/marked.ts @@ -172,6 +172,7 @@ type CodeToken = { type: "code"; lang: string; code: string; + rawCode: string; }; type TextToken = { @@ -190,6 +191,7 @@ export async function processTokens(content: string, sources: WebSearchSource[]) type: "code" as const, lang: token.lang, code: hljs.highlightAuto(token.text, hljs.getLanguage(token.lang)?.aliases).value, + rawCode: token.text, }; } else { return { @@ -212,6 +214,7 @@ export function processTokensSync(content: string, sources: WebSearchSource[]): type: "code" as const, lang: token.lang, code: hljs.highlightAuto(token.text, hljs.getLanguage(token.lang)?.aliases).value, + rawCode: token.text, }; } return { type: "text" as const, html: marked.parse(token.raw) };