Skip to content

Commit b6f6d93

Browse files
committed
Update to oicana 0.1.0
1 parent bcd2384 commit b6f6d93

3 files changed

Lines changed: 22 additions & 16 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license = { text = "MIT" }
88
dependencies = [
99
"fastapi>=0.115.0",
1010
"uvicorn[standard]>=0.32.0",
11-
"oicana>=0.1.0a5",
11+
"oicana>=0.1.0",
1212
"python-multipart>=0.0.12",
1313
]
1414

routers/templates.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from uuid import UUID
55

66
from fastapi import APIRouter, HTTPException, Response
7+
from fastapi import Path as PathParam
78
from fastapi.responses import FileResponse
89
from oicana import BlobInput, CompilationMode, Template
910
from pydantic import BaseModel, Field
@@ -131,7 +132,10 @@ def warm_up_templates():
131132
},
132133
description="Compile a template with given inputs.",
133134
)
134-
async def compile_template(template_id: str, payload: CompilationPayload):
135+
async def compile_template(
136+
payload: CompilationPayload,
137+
template_id: str = PathParam(example="table"),
138+
):
135139
if template_id not in template_cache:
136140
raise HTTPException(status_code=404, detail=f"Template '{template_id}' not found!")
137141

@@ -186,7 +190,10 @@ async def compile_template(template_id: str, payload: CompilationPayload):
186190
},
187191
description="Generate a PNG preview of the template with given inputs.",
188192
)
189-
async def preview_template(template_id: str, payload: CompilationPayload):
193+
async def preview_template(
194+
payload: CompilationPayload,
195+
template_id: str = PathParam(example="table"),
196+
):
190197
if template_id not in template_cache:
191198
raise HTTPException(status_code=404, detail=f"Template '{template_id}' not found!")
192199

@@ -238,7 +245,7 @@ async def preview_template(template_id: str, payload: CompilationPayload):
238245
"Reset (remove) a template from the cache. The template will be reloaded on next use."
239246
),
240247
)
241-
async def reset_template(template_id: str):
248+
async def reset_template(template_id: str = PathParam(example="table")):
242249
if template_id in template_cache:
243250
del template_cache[template_id]
244251
logger.info(f"Template '{template_id}' removed from cache")
@@ -259,7 +266,7 @@ async def reset_template(template_id: str):
259266
},
260267
description="Download a packed template.",
261268
)
262-
async def get_template(template_id: str):
269+
async def get_template(template_id: str = PathParam(example="table")):
263270
template_path = Path(f"templates/{template_id}-0.1.0.zip")
264271
if not template_path.exists():
265272
raise HTTPException(status_code=404, detail="Template not found")

uv.lock

Lines changed: 10 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)