- Updated docker-compose.yml to allow disabling embedded Ollama via environment variable. - Refactored Dockerfile and Dockerfile.dev for improved dependency management and installation process. - Enhanced FastAPI migration scripts to handle orphaned Alembic revisions and added new database migration logic. - Improved error handling in background tasks and Codex authentication endpoints. - Added support for font file uploads with better validation and extraction of font names. - Introduced new image search functionality with support for Pexels and Pixabay APIs.
21 lines
760 B
Python
21 lines
760 B
Python
"""Paths relative to the FastAPI process working directory (Docker / local dev).
|
|
|
|
The API is always started with cwd set to the `servers/fastapi` package root
|
|
(see start.js). No Electron, PyInstaller, or OS-specific layout handling.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
|
|
def get_resource_path(relative_path: str) -> str:
|
|
"""Absolute path to bundled read-only assets (e.g. ``static/``, ``assets/``)."""
|
|
return os.path.abspath(os.path.join(os.getcwd(), relative_path))
|
|
|
|
|
|
def get_writable_path(relative_path: str) -> str:
|
|
"""Absolute path under cwd for caches and generated files; ensures the directory exists."""
|
|
path = os.path.abspath(os.path.join(os.getcwd(), relative_path))
|
|
os.makedirs(path, exist_ok=True)
|
|
return path
|