"""Demo console (#17, ADR-004/005): web chat of the patient, demo clock and scenario playback. Everything goes through the HTTP API (`API_BASE_URL`); the page keeps working when the backend serves fixtures. """ import sys from pathlib import Path import streamlit as st # `streamlit run dashboard/app.py` already puts dashboard/ on sys.path; this keeps the page runnable on its own. sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from console import widgets as w # noqa: E402 from console.playback_ui import render_playback_panel # noqa: E402 st.set_page_config(page_title="Демо-консоль", page_icon="🎬", layout="wide") persona = w.select_persona() w.render_connect_hero() w.show_flash() st.sidebar.caption(f"API: {w.get_api().base_url}") st.title("Демо-консоль") st.caption("Прототип на синтетических данных. Время — виртуальные демо-часы (ADR-005).") w.render_clock_bar(persona, key="console-clock") st.divider() chat_col, play_col = st.columns([1.05, 1], gap="large") with chat_col: st.subheader(f"💬 Чат пациента — {persona.get('display_name') or persona['token']}") w.render_chat(persona["token"], height=560, key="console-chat") with play_col: render_playback_panel(persona)