diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 54e14d984..6950910cd 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1935,7 +1935,17 @@ {/if} - - {#if shareEnabled && chat && chat.id} + {#if shareEnabled && chat && (chat.id || $temporaryChatEnabled)} {}; const getChatAsText = async () => { - const _chat = chat.chat; - - const messages = createMessagesList(_chat.history, _chat.history.currentId); + const history = chat.chat.history; + const messages = createMessagesList(history, history.currentId); const chatText = messages.reduce((a, message, i, arr) => { return `${a}### ${message.role.toUpperCase()}\n${message.content}\n\n`; }, ''); @@ -52,12 +57,9 @@ }; const downloadPdf = async () => { - const _chat = chat.chat; - const messages = createMessagesList(_chat.history, _chat.history.currentId); - - console.log('download', chat); - - const blob = await downloadChatAsPDF(_chat.title, messages); + const history = chat.chat.history; + const messages = createMessagesList(history, history.currentId); + const blob = await downloadChatAsPDF(chat.chat.title, messages); // Create a URL for the blob const url = window.URL.createObjectURL(blob); @@ -65,7 +67,7 @@ // Create a link element to trigger the download const a = document.createElement('a'); a.href = url; - a.download = `chat-${_chat.title}.pdf`; + a.download = `chat-${chat.chat.title}.pdf`; // Append the link to the body and click it programmatically document.body.appendChild(a); @@ -189,27 +191,29 @@
{$i18n.t('Copy')}
- { - shareHandler(); - }} - > - { + shareHandler(); + }} > - - -
{$i18n.t('Share')}
-
+ + + +
{$i18n.t('Share')}
+ + {/if} -
+ {#if !$temporaryChatEnabled} +
-
- -
+
+ +
+ {/if}