fix:仅使用包内WebUI静态资源

暂时注释本地dashboard/dist回退逻辑,并同步调整WebUI静态路径解析测试,确保仅从maibot_dashboard包加载前端资源。
This commit is contained in:
DawnARC
2026-04-17 08:33:01 +08:00
parent f71034ba36
commit 46a9b817e7
2 changed files with 9 additions and 8 deletions

View File

@@ -205,11 +205,12 @@ def _setup_static_files(app: FastAPI):
def _resolve_static_path() -> Path | None:
# 开发环境优先允许复用仓库里的现成 dist
base_dir = _get_project_root()
static_path = base_dir / "dashboard" / "dist"
if static_path.is_dir() and (static_path / "index.html").exists():
return static_path
# 临时仅允许使用已安装的 maibot-dashboard 包,不使用仓库本地 dashboard/dist
# 如需恢复本地回退逻辑,可取消下方注释。
# base_dir = _get_project_root()
# static_path = base_dir / "dashboard" / "dist"
# if static_path.is_dir() and (static_path / "index.html").exists():
# return static_path
try:
module = import_module("maibot_dashboard")