|
@@ -4,6 +4,7 @@ from pathlib import Path
|
|
|
import black
|
|
|
import markdown
|
|
|
from open_webui.config import DATA_DIR, ENABLE_ADMIN_EXPORT
|
|
|
+from open_webui.env import FONTS_DIR
|
|
|
from open_webui.constants import ERROR_MESSAGES
|
|
|
from fastapi import APIRouter, Depends, HTTPException, Response, status
|
|
|
from fpdf import FPDF
|
|
@@ -57,14 +58,10 @@ class ChatForm(BaseModel):
|
|
|
async def download_chat_as_pdf(
|
|
|
form_data: ChatForm,
|
|
|
):
|
|
|
+ global FONTS_DIR
|
|
|
pdf = FPDF()
|
|
|
pdf.add_page()
|
|
|
|
|
|
- # When running in docker, workdir is /app/backend, so fonts is in /app/backend/static/fonts
|
|
|
- FONTS_DIR = Path("./static/fonts")
|
|
|
-
|
|
|
- # Non Docker Installation
|
|
|
-
|
|
|
# When running using `pip install` the static directory is in the site packages.
|
|
|
if not FONTS_DIR.exists():
|
|
|
FONTS_DIR = Path(site.getsitepackages()[0]) / "static/fonts"
|