This commit is contained in:
cjw
2026-02-16 01:32:13 +08:00
parent c7de90d774
commit 8cc92601a7
5 changed files with 42 additions and 4 deletions
+8
View File
@@ -33,6 +33,7 @@ tasks = {}
@router.get("/")
@router.post("/")
async def read_root(request: Request):
"""主页面"""
from fastapi.templating import Jinja2Templates
@@ -48,6 +49,7 @@ async def read_root(request: Request):
@router.get("/health")
@router.post("/health")
async def health():
return {
"status": "healthy",
@@ -113,6 +115,7 @@ async def upload_stp(
@router.get("/status/{task_id}")
@router.post("/status/{task_id}")
async def get_status(task_id: str):
"""获取任务状态"""
if task_id not in tasks:
@@ -124,6 +127,7 @@ async def get_status(task_id: str):
@router.get("/debug/tasks")
@router.post("/debug/tasks")
async def debug_tasks():
"""调试接口:查看所有任务"""
return {
@@ -133,6 +137,7 @@ async def debug_tasks():
@router.get("/api/history")
@router.post("/api/history")
async def get_file_history():
"""获取按文件名分组的文件历史记录"""
# 按文件名分组
@@ -166,6 +171,7 @@ async def get_file_history():
@router.get("/api/history/{filename}")
@router.post("/api/history/{filename}")
async def get_file_records(filename: str):
"""获取指定文件名的所有记录"""
# URL解码文件名
@@ -194,6 +200,7 @@ async def get_file_records(filename: str):
@router.get("/history")
@router.post("/history")
async def history_page(request: Request):
"""历史记录页面"""
from fastapi.templating import Jinja2Templates
@@ -209,6 +216,7 @@ async def history_page(request: Request):
@router.get("/result/{task_id}")
@router.post("/result/{task_id}")
async def result_page(request: Request, task_id: str):
"""结果详情页面"""
if task_id not in tasks: