feat: complete image console and add verified REST and MCP workflows
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
"""画廊 API。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
from ..services import gallery as svc
|
||||
from ..providers import ProviderError
|
||||
|
||||
router = APIRouter(prefix="/api/galleries", tags=["gallery"])
|
||||
|
||||
|
||||
@router.get("")
|
||||
def list_galleries():
|
||||
return svc.list_galleries()
|
||||
|
||||
|
||||
@router.get("/{profile_name}")
|
||||
def list_gallery(profile_name: str):
|
||||
try:
|
||||
return svc.list_gallery(profile_name)
|
||||
except ProviderError as exc:
|
||||
raise HTTPException(status_code=exc.status, detail=exc.message)
|
||||
|
||||
|
||||
@router.delete("/{profile_name}/{filename}")
|
||||
def delete_gallery_item(profile_name: str, filename: str):
|
||||
try:
|
||||
svc.delete_gallery_item(profile_name, filename)
|
||||
except FileNotFoundError as exc:
|
||||
raise HTTPException(status_code=404, detail=str(exc))
|
||||
except ProviderError as exc:
|
||||
raise HTTPException(status_code=exc.status, detail=exc.message)
|
||||
return {"ok": True}
|
||||
Reference in New Issue
Block a user