feat: 挂载 WebUI 子目录的静态文件,更新 CSS 和 JS 引用路径
This commit is contained in:
@@ -144,9 +144,17 @@ app.add_middleware(
|
|||||||
if STATIC_DIR.exists():
|
if STATIC_DIR.exists():
|
||||||
app.mount("/static", StaticFiles(directory=str(STATIC_DIR)), name="static")
|
app.mount("/static", StaticFiles(directory=str(STATIC_DIR)), name="static")
|
||||||
|
|
||||||
# WebUI 静态文件
|
# WebUI 静态文件 - 挂载各子目录
|
||||||
if WEBUI_DIR.exists():
|
if WEBUI_DIR.exists():
|
||||||
app.mount("/webui/static", StaticFiles(directory=str(WEBUI_DIR)), name="webui_static")
|
# CSS 目录
|
||||||
|
css_dir = WEBUI_DIR / "css"
|
||||||
|
if css_dir.exists():
|
||||||
|
app.mount("/webui/css", StaticFiles(directory=str(css_dir)), name="webui_css")
|
||||||
|
|
||||||
|
# JS 目录
|
||||||
|
js_dir = WEBUI_DIR / "js"
|
||||||
|
if js_dir.exists():
|
||||||
|
app.mount("/webui/js", StaticFiles(directory=str(js_dir)), name="webui_js")
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<!-- xterm.js CSS -->
|
<!-- xterm.js CSS -->
|
||||||
<link rel="stylesheet" href="https://unpkg.com/xterm@5.3.0/css/xterm.css">
|
<link rel="stylesheet" href="https://unpkg.com/xterm@5.3.0/css/xterm.css">
|
||||||
<!-- 自定义样式 -->
|
<!-- 自定义样式 -->
|
||||||
<link rel="stylesheet" href="./css/webui.css">
|
<link rel="stylesheet" href="/webui/css/webui.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
@@ -127,17 +127,17 @@
|
|||||||
<script src="https://unpkg.com/xterm@5.3.0/lib/xterm.js"></script>
|
<script src="https://unpkg.com/xterm@5.3.0/lib/xterm.js"></script>
|
||||||
<script src="https://unpkg.com/xterm-addon-fit@0.8.0/lib/xterm-addon-fit.js"></script>
|
<script src="https://unpkg.com/xterm-addon-fit@0.8.0/lib/xterm-addon-fit.js"></script>
|
||||||
<!-- 主应用(创建 Vue 实例,但不挂载) -->
|
<!-- 主应用(创建 Vue 实例,但不挂载) -->
|
||||||
<script src="./js/app.js"></script>
|
<script src="/webui/js/app.js"></script>
|
||||||
<!-- 组件(注册到 app) -->
|
<!-- 组件(注册到 app) -->
|
||||||
<script src="./js/components/dashboard.js"></script>
|
<script src="/webui/js/components/dashboard.js"></script>
|
||||||
<script src="./js/components/llm-config.js"></script>
|
<script src="/webui/js/components/llm-config.js"></script>
|
||||||
<script src="./js/components/channels-config.js"></script>
|
<script src="/webui/js/components/channels-config.js"></script>
|
||||||
<script src="./js/components/proxy-config.js"></script>
|
<script src="/webui/js/components/proxy-config.js"></script>
|
||||||
<script src="./js/components/agents.js"></script>
|
<script src="/webui/js/components/agents.js"></script>
|
||||||
<script src="./js/components/scheduler.js"></script>
|
<script src="/webui/js/components/scheduler.js"></script>
|
||||||
<script src="./js/components/terminal.js"></script>
|
<script src="/webui/js/components/terminal.js"></script>
|
||||||
<script src="./js/components/logs.js"></script>
|
<script src="/webui/js/components/logs.js"></script>
|
||||||
<!-- 挂载应用 -->
|
<!-- 挂载应用 -->
|
||||||
<script src="./js/main.js"></script>
|
<script src="/webui/js/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user