mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 20:07:49 +01:00
fix: chat pdf, txt export issue
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
const { saveAs } = fileSaver;
|
||||
|
||||
import { downloadChatAsPDF } from '$lib/apis/utils';
|
||||
import { copyToClipboard } from '$lib/utils';
|
||||
import { copyToClipboard, createMessagesList } from '$lib/utils';
|
||||
|
||||
import { showOverview, showControls, mobile } from '$lib/stores';
|
||||
import { flyAndScale } from '$lib/utils/transitions';
|
||||
@@ -32,7 +32,9 @@
|
||||
|
||||
const getChatAsText = async () => {
|
||||
const _chat = chat.chat;
|
||||
const chatText = _chat.messages.reduce((a, message, i, arr) => {
|
||||
|
||||
const messages = createMessagesList(_chat.history, _chat.history.currentId);
|
||||
const chatText = messages.reduce((a, message, i, arr) => {
|
||||
return `${a}### ${message.role.toUpperCase()}\n${message.content}\n\n`;
|
||||
}, '');
|
||||
|
||||
@@ -51,9 +53,11 @@
|
||||
|
||||
const downloadPdf = async () => {
|
||||
const _chat = chat.chat;
|
||||
const messages = createMessagesList(_chat.history, _chat.history.currentId);
|
||||
|
||||
console.log('download', chat);
|
||||
|
||||
const blob = await downloadChatAsPDF(_chat);
|
||||
const blob = await downloadChatAsPDF(_chat.title, messages);
|
||||
|
||||
// Create a URL for the blob
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
|
||||
Reference in New Issue
Block a user