refacto: dashboard Flask Blueprints + templates Jinja2, engine run/lore_enricher mis a jour
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
SIM_CONFIGS_DIR = os.getenv("SIM_CONFIGS_DIR", "/app/src/config")
|
||||
|
||||
_REFERENCE_CONFIG_ID = 1
|
||||
|
||||
|
||||
def load_sim_config(session_id: int) -> dict | None:
|
||||
path = os.path.join(SIM_CONFIGS_DIR, f"sim_{session_id:03d}.json")
|
||||
try:
|
||||
with open(path) as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def save_sim_config(session_id: int, cfg: dict):
|
||||
path = os.path.join(SIM_CONFIGS_DIR, f"sim_{session_id:03d}.json")
|
||||
with open(path, "w") as f:
|
||||
json.dump(cfg, f, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
def load_all_modes() -> dict:
|
||||
cfg = load_sim_config(_REFERENCE_CONFIG_ID) or {}
|
||||
return cfg.get("modes", {})
|
||||
Reference in New Issue
Block a user