1. 让AI修改了一些bug
This commit is contained in:
@@ -190,9 +190,8 @@ def setup_routes(app: FastAPI):
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
"""根路径 - 重定向到前端监控界面"""
|
||||
from fastapi.responses import RedirectResponse
|
||||
return RedirectResponse(url="/dashboard")
|
||||
"""根路径 - 返回主界面"""
|
||||
return FileResponse("../web/main.html")
|
||||
|
||||
@app.get("/dashboard")
|
||||
async def dashboard():
|
||||
@@ -307,12 +306,6 @@ def setup_routes(app: FastAPI):
|
||||
# 挂载静态文件目录
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
# 为前端页面创建特定路由
|
||||
@app.get("/dashboard")
|
||||
async def dashboard():
|
||||
"""前端监控界面"""
|
||||
return FileResponse("static/index.html")
|
||||
|
||||
# 只挂载静态资源(CSS, JS, 图片等)- 如果目录存在
|
||||
import os
|
||||
if os.path.exists("static"):
|
||||
|
||||
Reference in New Issue
Block a user