feat: complete image console and add verified REST and MCP workflows
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""出图 API。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, HTTPException
|
||||
|
||||
from ..providers import ProviderError
|
||||
from ..schemas import GenerateIn
|
||||
from ..services import generation as svc
|
||||
|
||||
router = APIRouter(prefix="/api", tags=["generate"])
|
||||
|
||||
|
||||
@router.post("/generate")
|
||||
def generate(payload: GenerateIn):
|
||||
try:
|
||||
return svc.generate(
|
||||
provider_id=payload.provider_id,
|
||||
model=payload.model,
|
||||
prompt=payload.prompt,
|
||||
size=payload.size,
|
||||
ratio=payload.ratio,
|
||||
n=payload.n,
|
||||
images=payload.images,
|
||||
profile_name=payload.profile_name,
|
||||
)
|
||||
except ProviderError as exc:
|
||||
raise HTTPException(status_code=exc.status, detail=exc.message)
|
||||
|
||||
|
||||
@router.get("/generations")
|
||||
def list_generations():
|
||||
return svc.list_generations()
|
||||
Reference in New Issue
Block a user