diff --git a/src/server/app.py b/src/server/app.py
index b455be0..a623bd4 100644
--- a/src/server/app.py
+++ b/src/server/app.py
@@ -61,8 +61,15 @@ async def lifespan(app: FastAPI):
yield
+from fastapi.staticfiles import StaticFiles
+
app = FastAPI(title="md-vector-db", version="0.1.0", lifespan=lifespan)
+# 挂载 Web 管理界面
+web_dir = Path(__file__).parent.parent / "web"
+if web_dir.exists():
+ app.mount("/admin", StaticFiles(directory=str(web_dir), html=True), name="admin")
+
# CORS 中间件
app.add_middleware(
CORSMiddleware,
diff --git a/src/web/index.html b/src/web/index.html
new file mode 100644
index 0000000..4e9423f
--- /dev/null
+++ b/src/web/index.html
@@ -0,0 +1,147 @@
+
+
+
+
+
+md-vector-db 管理面板
+
+
+
+
+
+
+
📚 md-vector-db 管理面板
+
+
+
+
{{ toast.message }}
+
+
+
+
语义检索
+
+
+
+
+
{{ searchResults.length }} 条结果
+
+
相似度: {{ (r.score || 0).toFixed(4) }}
+
📄 {{ r.source_file }}
+
📑 {{ r.section_title }}
+
{{ (r.content||'').substring(0,300) }}{{ (r.content||'').length > 300 ? '...' : '' }}
+
+
+
+
+
+
+
入库文档
+
+
+
+
+
{{ ingestResult }}
+
+
+
+
+
集合列表
+
+
+ | 名称 | Chunks |
+ | {{ c.name }} | {{ c.count }} |
+
+
+
+
+
+
服务状态 {{ health.status }}
+
{{ JSON.stringify(health.checks, null, 2) }}
+
+
+
+
+
+
+
diff --git a/tests/test_api.py b/tests/test_api.py
index c9f9122..0c0a0cd 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -138,3 +138,16 @@ class TestDeleteEndpoint:
results = search_resp.json()["results"]
sources = [r["source_file"] for r in results]
assert "delete-test.md" not in sources
+
+
+def test_admin_ui_served(client):
+ """管理界面可访问."""
+ response = client.get("/admin")
+ assert response.status_code == 200
+
+
+def test_health_skips_rate_limit(client):
+ """健康检查多次访问不触发速率限制."""
+ for _ in range(5):
+ resp = client.get("/api/v1/health")
+ assert resp.status_code == 200