From 042bb519de699c0e715fd6f4f62dee68fbb51ca0 Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Tue, 3 Mar 2026 15:04:18 -0800 Subject: [PATCH] fix: llm_backend reads fallback_order, logs tee'd to data/.streamlit.log in Docker --- compose.yml | 6 ++++++ scripts/feedback_api.py | 10 +++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/compose.yml b/compose.yml index b744f0b..8f2fc9e 100644 --- a/compose.yml +++ b/compose.yml @@ -4,6 +4,12 @@ services: app: build: . + command: > + bash -c "streamlit run app/app.py + --server.port=8501 + --server.headless=true + --server.fileWatcherType=none + 2>&1 | tee /app/data/.streamlit.log" ports: - "${STREAMLIT_PORT:-8501}:8501" volumes: diff --git a/scripts/feedback_api.py b/scripts/feedback_api.py index 1649585..0c8129a 100644 --- a/scripts/feedback_api.py +++ b/scripts/feedback_api.py @@ -45,11 +45,15 @@ def collect_context(page: str) -> dict: except Exception: pass - # LLM backend from llm.yaml + # LLM backend from llm.yaml — report first entry in fallback_order that's enabled llm_backend = "unknown" try: llm = yaml.safe_load((_ROOT / "config" / "llm.yaml").read_text()) or {} - llm_backend = llm.get("provider", "unknown") + backends = llm.get("backends", {}) + for name in llm.get("fallback_order", []): + if backends.get(name, {}).get("enabled", False): + llm_backend = name + break except Exception: pass @@ -65,7 +69,7 @@ def collect_context(page: str) -> dict: def collect_logs(n: int = 100, log_path: Path | None = None) -> str: """Return last n lines of the Streamlit log, with PII masked.""" - path = log_path or (_ROOT / ".streamlit.log") + path = log_path or (_ROOT / "data" / ".streamlit.log") if not path.exists(): return "(no log file found)" lines = path.read_text(errors="replace").splitlines()