45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
"""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
|
|
|
|
from dashboard import theme # noqa: E402
|
|
from dashboard.components import ui # noqa: E402
|
|
|
|
st.set_page_config(page_title="Демо-консоль", page_icon="🎬", layout="wide")
|
|
|
|
st.html(theme.CSS)
|
|
st.html(
|
|
ui.page_header(
|
|
"Демо-консоль",
|
|
"Чат пациента и сценарий сопровождения. Прототип на синтетических данных.",
|
|
kicker="Демонстрация",
|
|
)
|
|
)
|
|
|
|
persona = w.select_persona()
|
|
w.render_connect_hero()
|
|
w.show_flash()
|
|
st.sidebar.caption(f"API: {w.get_api().base_url}")
|
|
|
|
with st.container(border=True, key="panel-console-clock"):
|
|
w.render_clock_bar(persona, key="console-clock")
|
|
|
|
chat_col, play_col = st.columns([1.05, 1], gap="large")
|
|
with chat_col, st.container(border=True, key="panel-console-chat"):
|
|
st.subheader(f"Чат пациента — {persona.get('display_name') or persona['token']}")
|
|
w.render_chat(persona["token"], height=560, key="console-chat")
|
|
with play_col, st.container(border=True, key="panel-console-scenario"):
|
|
render_playback_panel(persona)
|