refactor: 更新API路由参数解析,使用Body获取请求数据,简化请求处理逻辑
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import json
|
||||
from typing import Optional, List
|
||||
|
||||
from fastapi import APIRouter, Request, HTTPException, Path
|
||||
from fastapi import APIRouter, Body, HTTPException, Path
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
from workflow_service import comfyui_client
|
||||
@@ -15,12 +15,11 @@ workflow_router = APIRouter(
|
||||
|
||||
|
||||
@workflow_router.post("", status_code=201)
|
||||
async def publish_workflow_endpoint(request: Request):
|
||||
async def publish_workflow_endpoint(data: dict = Body(...)):
|
||||
"""
|
||||
发布工作流
|
||||
"""
|
||||
try:
|
||||
data = await request.json()
|
||||
name, wf_json = data.get("name"), data.get("workflow")
|
||||
if not name or not wf_json:
|
||||
raise HTTPException(
|
||||
|
||||
Reference in New Issue
Block a user