mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-14 13:25:20 +00:00
feat: adjust export quality to 0.95
This commit is contained in:
parent
2cde5022b4
commit
333cbb8a27
1 changed files with 13 additions and 13 deletions
|
|
@ -60,7 +60,7 @@ const DEFAULT_VIRTUAL_WIDTH = 800;
|
|||
/** Canvas scale factor for increased resolution */
|
||||
const CANVAS_SCALE = 2;
|
||||
/** JPEG quality for image compression (0.0 to 1.0) */
|
||||
const JPEG_QUALITY = 0.7;
|
||||
const JPEG_QUALITY = 0.95;
|
||||
|
||||
// ==================== Shared Utility Functions ====================
|
||||
|
||||
|
|
@ -384,7 +384,7 @@ export const downloadNotePdf = async (note: NoteData): Promise<void> => {
|
|||
* @throws Error if PDF generation fails or if chatText is missing in plain text mode
|
||||
*/
|
||||
export const downloadChatPdf = async (options: ChatPdfOptions): Promise<void> => {
|
||||
console.log('Downloading PDF', options);
|
||||
console.log('Downloading PDF', options);
|
||||
|
||||
if (options.stylizedPdfExport ?? true) {
|
||||
await options.onBeforeRender?.();
|
||||
|
|
@ -392,8 +392,8 @@ export const downloadChatPdf = async (options: ChatPdfOptions): Promise<void> =>
|
|||
const containerElement = document.getElementById(
|
||||
options.containerElementId || 'full-messages-container'
|
||||
);
|
||||
if (containerElement) {
|
||||
try {
|
||||
try {
|
||||
if (containerElement) {
|
||||
const virtualWidth = DEFAULT_VIRTUAL_WIDTH;
|
||||
|
||||
// Clone and style element for rendering
|
||||
|
|
@ -415,18 +415,18 @@ export const downloadChatPdf = async (options: ChatPdfOptions): Promise<void> =>
|
|||
canvasToPdfWithSlicing(pdf, canvas, virtualWidth, A4_PAGE_WIDTH_MM, A4_PAGE_HEIGHT_MM);
|
||||
|
||||
pdf.save(`chat-${options.title}.pdf`);
|
||||
} catch (error) {
|
||||
console.error('Error generating PDF', error);
|
||||
}
|
||||
} finally {
|
||||
await options.onAfterRender?.();
|
||||
}
|
||||
await options.onAfterRender?.();
|
||||
return;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!options.chatText) {
|
||||
console.error('chatText is required for plain text PDF export');
|
||||
return;
|
||||
}
|
||||
if (!options.chatText) {
|
||||
console.error('chatText is required for plain text PDF export');
|
||||
return;
|
||||
}
|
||||
|
||||
await exportPlainTextToPdf(options.chatText, `chat-${options.title}.pdf`);
|
||||
await exportPlainTextToPdf(options.chatText, `chat-${options.title}.pdf`);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue