refactor(dashboard): switch a NiceGUI, rimuovi legacy Streamlit

NiceGUI è la dashboard ufficiale (port 8080, dark/neon palette, 3 pagine:
/, /convergence, /genomes). La porta è ora parametrica via env
SWARM_DASHBOARD_PORT, letta in ui.run() — Docker la usa anche per
healthcheck e label Traefik.

docker-compose.yml: entrypoint del servizio dashboard cambiato da
streamlit a python -m multi_swarm.dashboard.nicegui_app. Default porta
8080 ovunque (.env, .env.example, compose, healthcheck).

Rimossi i file legacy della vecchia GUI Streamlit:
- src/multi_swarm/dashboard/streamlit_app.py
- src/multi_swarm/dashboard/aquarium.py (helper canvas HTML5)
- src/multi_swarm/dashboard/pages/{01_overview,02_ga_convergence,
  03_genomes,04_aquarium}.py
- tests/integration/test_streamlit_smoke.py

pyproject.toml: rimossa la dep streamlit; uv.lock rigenerato (10 deps
transitive eliminate: pydeck, watchdog, jsonschema, pillow, ecc.).
README aggiornato (architettura, comando dashboard, sezione Dashboard
ora descrive NiceGUI con riferimento al deploy Docker via Traefik).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adriano Dal Pastro
2026-05-14 12:15:11 +00:00
parent 8e5efde219
commit 03f723f7fc
13 changed files with 24 additions and 1569 deletions
+10 -15
View File
@@ -75,17 +75,11 @@ src/multi_swarm/
├── orchestrator/
│ └── run.py End-to-end pipeline + persistence
└── dashboard/
├── streamlit_app.py Hub multipage
── data.py Lettura runs.db per le pagine
├── aquarium.py Helper canvas HTML5 (fish data + JS template)
└── pages/
├── 01_overview.py Run + metriche aggregate
├── 02_ga_convergence.py Fitness convergence + entropy plot
├── 03_genomes.py Top-10 + ispezione system_prompt
└── 04_aquarium.py Acquario 2D con click → info + lineage
├── nicegui_app.py NiceGUI dashboard (overview / convergence / genomes)
── data.py Lettura runs.db per le pagine
```
Stack: Python 3.13, uv, pytest+pytest-mock+responses, openai SDK (verso OpenRouter), requests+tenacity, pandas+numpy+scipy, sqlmodel+sqlite, streamlit+plotly.
Stack: Python 3.13, uv, pytest+pytest-mock+responses, openai SDK (verso OpenRouter), requests+tenacity, pandas+numpy+scipy, sqlmodel+sqlite, nicegui+plotly.
## Setup
@@ -150,17 +144,18 @@ uv run python scripts/run_phase1.py \
--population-size 20 --n-generations 10
# Dashboard
DB_PATH=./runs.db uv run streamlit run src/multi_swarm/dashboard/streamlit_app.py
DB_PATH=./runs.db uv run python -m multi_swarm.dashboard.nicegui_app
```
## Dashboard
Streamlit multipage su `http://localhost:8501` (override con `--server.port`):
NiceGUI dashboard (dark/neon palette) su `http://localhost:8080` (override con env `SWARM_DASHBOARD_PORT`):
- **Overview**: lista runs, status, costo, metriche aggregate evaluations (parse success %, top fitness, median).
- **GA Convergence**: fitness median/max/p90 per generazione, entropy con hline a soglia gate (0.5).
- **Genomes**: top-10 ordinati per fitness, click su row per ispezione system_prompt + raw_text JSON strategy.
- **Aquarium**: visualizzazione 2D canvas HTML5 con un pesce per agente; dimensione ∝ fitness, colore per cognitive_style, halo sui top-3, click su pesce → panel info completo + lineage BFS (parents → grandparents → ...).
- **Overview** (`/`): lista runs, status, costo, metriche aggregate evaluations (parse success %, top fitness, median).
- **GA Convergence** (`/convergence`): fitness median/max/p90 per generazione, entropy con hline a soglia gate (0.5).
- **Genomes** (`/genomes`): top-K ordinati per fitness, click su riga per ispezione system_prompt + raw_text JSON strategy.
In produzione gira dentro Docker dietro Traefik su `https://swarm.${DOMAIN_NAME}` — vedi `docker-compose.yml`.
## Costi tipici Phase 1