diff --git a/README.md b/README.md index 3a36cf8..c931301 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Un agente configurabile basato su DeepAgents che supporta più provider LLM. - **Test completi**: Suite di test per garantire la qualità del codice - **Docker support**: Containerizzazione per deployment facile - **API REST**: Server API per accesso remoto +- **Web UI**: Interfaccia web per gestione configurazioni ## Installazione @@ -98,7 +99,7 @@ export OPENROUTER_API_KEY="la-tua-chiave-api-openrouter" ### 2. Configurazione Persistente (Consigliato) -Utilizza la CLI o la TUI per gestire le configurazioni che persistono tra le sessioni. +Utilizza la CLI, la TUI o l'interfaccia web per gestire le configurazioni che persistono tra le sessioni. #### Utilizzo della CLI ```bash @@ -147,6 +148,24 @@ La TUI ora include: - Test di connessione diretto - Navigazione migliorata +#### Utilizzo dell'Interfaccia Web + +Avvia il server API e accedi all'interfaccia web: + +```bash +# Avvia il server API +python api_server.py + +# Accedi all'interfaccia web +# http://localhost:8000 +``` + +L'interfaccia web include: +- Gestione completa delle configurazioni +- Chat con l'agente +- Monitoraggio dello stato del sistema +- Test di connessione + ## Utilizzo ### Utilizzo Locale @@ -182,7 +201,7 @@ L'API sarà disponibile su http://localhost:8000 #### Endpoint API Disponibili -- `GET /`: Informazioni sull'API +- `GET /`: Interfaccia web - `GET /health`: Health check - `POST /chat`: Chat con l'agente - `GET /configurations`: Elenca tutte le configurazioni diff --git a/api_server.py b/api_server.py index 5f66fea..8d3be8f 100644 --- a/api_server.py +++ b/api_server.py @@ -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") diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..45caa8c --- /dev/null +++ b/web/index.html @@ -0,0 +1,691 @@ + + +
+ + +Interfaccia di configurazione per l'agente AI
+Nessun provider configurato
+Nessun modello configurato
+Verifica in corso...
+