Skip to content

Solution application#21

Merged
abdratsd merged 7 commits into
mainfrom
solution-application
Jul 20, 2026
Merged

Solution application#21
abdratsd merged 7 commits into
mainfrom
solution-application

Conversation

@abdratsd

Copy link
Copy Markdown
Collaborator

Merge solution-application: PowerGrid apply flow + nginx proxy + sim UX overhaul, Railway KPI sorting, shared i18n, and deploy ConfigMap.

abdratsd added 7 commits July 20, 2026 04:11
Add sncf_recommender with four ordering strategies and wire them into
RailwayManager via request_data.event.mode:

- basic: best-first ordering (SNCF_RECO3)
- deontic: filter by a KPI threshold, then sort ascending
- risk: sort all recommendations by a KPI ascending
- risk_tie_break: primary KPI with a secondary KPI as tie-breaker

Supported KPIs: passengers, delay (parsed from strings like "1h30"),
cost, total_cost. Catalog lookup errors are surfaced as an empty list
instead of crashing the transform step.
Replace the eval-demo hack that faked a success response with the real
POST to VITE_POWERGRID_SIMU/api/v1/recommendations.

- api.ts: await the real request, detect when the response is the SPA
  index.html (request fell through to the nginx SPA fallback because no
  /powergrid-simu/ proxy is present) and log request/response details.
- Assistant.vue: make onSelection async; only mark the card resolved and
  close the assistant when the apply succeeds, and leave the card open on
  failure so the user can retry (the http plugin shows the error modal).
Route the apply POST through a /powergrid-simu/ location so the browser
stays same-origin and never triggers CORS against the grid2op simulator.

- frontend/default.conf and cab-standalone nginx-cors-permissive.conf:
  add the /powergrid-simu/ proxy_pass (LAN upstream, adjust per env).
- docker-compose.sh: default VITE_POWERGRID_SIMU=/powergrid-simu.
- env.d.ts: type the VITE_* env vars, including VITE_POWERGRID_SIMU.
Upgrade the PowerGrid grid2op simulator PoC with five related changes:

- Recommendation store: add an in-process RecommendationStore shared by
  the POST /api/v1/recommendations endpoint and the simulation loop. The
  loop now reads the applied recommendation directly instead of issuing
  an HTTP request back to itself, which was fragile behind a reverse
  proxy and returned 404.
- Action verification: add summarize_action / verify_action_applied /
  format_verdict_description in utils.py and wire them into Simulator so
  each InteractiveAI recommendation is checked against the grid state
  (APPLIED / NO_OP / NO_EFFECT / REJECTED / OVERRIDDEN) and reported.
- Pause/Resume: replace the one-shot 'Continue' button with a Pause/
  Resume toggle, add /pause_simulation, stream simulation-state and
  keepalive SSE events, and default IS_PAUSED to False.
- Reverse-proxy / CORS readiness: add CORS headers, ProxyFix, SocketIO
  cors_allowed_origins and X-Accel-Buffering so the simulator works
  behind the frontend nginx proxy and for direct cross-origin calls.
- Translate comments, log messages and dashboard UI from French to
  English; tune scenario timing and demo server config.
Name the created i18n instance and export it as the default, and have
setupEntitiesLocales default to that instance instead of requiring it to
be passed in, so entity locales register against the same instance the
app uses.
Add the Kubernetes ConfigMap for the cab namespace covering the
OperatorFabric businessconfig, cards, users, nginx and web-ui
configuration for the assistant platform deployment.
Drop the hardcoded LAN IP fallback that had been baked into the source
(and the built image). The machine-specific value is already supplied at
runtime via the RL_AGENT_API_URL env var (.secrets -> docker-compose.sh
-> .env for local Docker, extraEnv for k8s), so the code fallback only
needs to be the safe in-cluster default.
@abdratsd
abdratsd merged commit e24d9a0 into main Jul 20, 2026
4 of 8 checks passed
@abdratsd
abdratsd deleted the solution-application branch July 24, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant