diff --git a/src/lib/components/chat/Messages/CodeBlock.svelte b/src/lib/components/chat/Messages/CodeBlock.svelte index 7c64e7446..53da03af8 100644 --- a/src/lib/components/chat/Messages/CodeBlock.svelte +++ b/src/lib/components/chat/Messages/CodeBlock.svelte @@ -17,6 +17,7 @@ const dispatch = createEventDispatcher(); export let id = ''; + export let save = false; export let token; export let lang = ''; @@ -316,9 +317,11 @@ __builtins__.input = input`); {/if} {/if} - + {#if save} + + {/if} { dispatch('update', e.detail); }} diff --git a/src/lib/components/chat/Messages/Markdown.svelte b/src/lib/components/chat/Messages/Markdown.svelte index cdf0d5f5a..8c24358fa 100644 --- a/src/lib/components/chat/Messages/Markdown.svelte +++ b/src/lib/components/chat/Messages/Markdown.svelte @@ -14,6 +14,7 @@ export let id; export let content; export let model = null; + export let save = false; let tokens = []; @@ -37,6 +38,7 @@ { dispatch('update', e.detail); }} diff --git a/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte b/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte index 931dea598..26acdcb66 100644 --- a/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte +++ b/src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte @@ -17,6 +17,8 @@ export let tokens: Token[]; export let top = true; + export let save = false; + const headerComponent = (depth: number) => { return 'h' + depth; }; @@ -36,6 +38,7 @@ {token} lang={token?.lang ?? ''} code={revertSanitizedResponseContent(token?.text ?? '')} + {save} on:save={(e) => { dispatch('update', { oldContent: token.text, diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index dbd247153..47a62c805 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -478,6 +478,7 @@ { const { oldContent, newContent } = e.detail;