refactor(pipeline): 路径直接传输 — 统一 ctx 字段名/panel key/step 形参名

This commit is contained in:
DXC
2026-06-03 17:29:41 +08:00
parent 517bb28611
commit 343e316799
99 changed files with 9127 additions and 91 deletions

62
new/app/main.py Normal file
View File

@ -0,0 +1,62 @@
"""
WQ_GUI FastAPI 后端入口
=======================
应用启动与全局中间件配置:
- CORS开发阶段允许所有来源方便本地前端Vite / Webpack dev server联调
- 路由:通过 include_router 挂载 app/api/endpoints.py 中的业务接口
业务接口说明:
POST /api/process/deglint 提交去耀斑处理任务,立即返回 task_id
GET /api/tasks/{task_id} 查询指定任务的状态与结果
"""
from typing import Dict
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.api.endpoints import router as deglint_router
from app.api.modeling import router as modeling_router
# ---------------------------------------------------------------------------
# FastAPI 应用实例
# ---------------------------------------------------------------------------
app = FastAPI(
title="WQ_GUI Backend",
description="高光谱影像去耀斑处理 API",
version="0.2.0",
)
# ---------------------------------------------------------------------------
# CORS 中间件
# ---------------------------------------------------------------------------
# 开发阶段:放开所有来源、方法和头部,方便本地前端(任意端口)联调。
# 生产环境务必收敛 allow_origins 为前端真实域名,避免安全风险。
# ---------------------------------------------------------------------------
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# ---------------------------------------------------------------------------
# 路由注册
# ---------------------------------------------------------------------------
# 统一以 /api 为前缀,便于将来做版本管理(如 /api/v1、/api/v2
# ---------------------------------------------------------------------------
app.include_router(deglint_router, prefix="/api")
app.include_router(modeling_router, prefix="/api")
# ---------------------------------------------------------------------------
# 根路径健康检查(方便本地调试,非业务必需)
# ---------------------------------------------------------------------------
@app.get("/")
async def root() -> Dict[str, str]:
return {"service": "WQ_GUI Backend", "status": "ok"}