Phase 6: Web UI for configuration management and enhanced API server

This commit is contained in:
truetype committed 2026-03-20 18:25:22 +01:00
1 parent 5541770896
commit 6eace3abc0
3 files changed
+733 -11

No files matched your search

+21 -9
View File
@@ -7,6 +7,8 @@ import sys
from typing import Optional, Dict, Any, List
from fastapi import FastAPI, HTTPException, Depends
from fastapi.middleware.cors import CORSMiddleware
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
from pydantic import BaseModel
import uvicorn
@@ -33,6 +35,11 @@ app.add_middleware(
allow_headers=["*"],
)
# Mount static files for web UI
web_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "web")
if os.path.exists(web_dir):
app.mount("/static", StaticFiles(directory=web_dir), name="static")
# Global agent instance
agent = None
@@ -95,16 +102,21 @@ async def startup_event():
@app.get("/")
async def root():
"""Root endpoint"""
return {
"message": "MaxClaw Agent API",
"version": "1.0.0",
"endpoints": {
"chat": "/chat",
"configurations": "/configurations",
"health": "/health"
"""Root endpoint - serve web UI"""
web_index = os.path.join(web_dir, "index.html")
if os.path.exists(web_index):
return FileResponse(web_index)
else:
return {
"message": "MaxClaw Agent API",
"version": "1.0.0",
"endpoints": {
"chat": "/chat",
"configurations": "/configurations",
"health": "/health",
"web_ui": "/static/index.html"
}
}
}
@app.get("/health")