- 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.
26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
from fastapi import APIRouter, HTTPException
|
|
import aiohttp
|
|
from utils.get_layout_by_name import get_layout_by_name
|
|
from models.presentation_layout import PresentationLayoutModel
|
|
|
|
LAYOUTS_ROUTER = APIRouter(prefix="/layouts", tags=["Layouts"])
|
|
|
|
@LAYOUTS_ROUTER.get("/", summary="Get available layouts")
|
|
async def get_layouts():
|
|
url = "http://localhost:3000/api/layouts" # Adjust port if needed
|
|
async with aiohttp.ClientSession() as session:
|
|
async with session.get(url) as response:
|
|
if response.status != 200:
|
|
error_text = await response.text()
|
|
raise HTTPException(
|
|
status_code=response.status,
|
|
detail=f"Failed to fetch layouts: {error_text}"
|
|
)
|
|
layouts_json = await response.json()
|
|
# Optionally, parse into a Pydantic model if you have one matching the structure
|
|
return layouts_json
|
|
|
|
|
|
@LAYOUTS_ROUTER.get("/{layout_name}", summary="Get layout details by ID")
|
|
async def get_layout_detail(layout_name: str) -> PresentationLayoutModel:
|
|
return await get_layout_by_name(layout_name)
|