"""
Config page — displays pipeline configuration in a terminal-style layout.
Read-only view of scanners, pipelines, and data source configuration.
"""
import streamlit as st
from tradingagents.default_config import DEFAULT_CONFIG
from tradingagents.ui.theme import COLORS, page_header
def render() -> None:
"""Render the configuration page."""
st.markdown(
page_header("Config", "Pipeline & scanner configuration (read-only)"),
unsafe_allow_html=True,
)
config = DEFAULT_CONFIG
discovery_config = config.get("discovery", {})
# ---- Top-level settings ----
st.markdown(
'
Discovery Settings // core
',
unsafe_allow_html=True,
)
settings_grid = [
("Discovery Mode", discovery_config.get("discovery_mode", "N/A")),
("Max Candidates", str(discovery_config.get("max_candidates_to_analyze", "N/A"))),
("Final Recommendations", str(discovery_config.get("final_recommendations", "N/A"))),
("Deep Dive Workers", str(discovery_config.get("deep_dive_max_workers", "N/A"))),
]
cols = st.columns(len(settings_grid))
for col, (label, val) in zip(cols, settings_grid):
with col:
st.markdown(
f"""
""",
unsafe_allow_html=True,
)
st.markdown("", unsafe_allow_html=True)
# ---- Pipelines ----
left_col, right_col = st.columns(2)
with left_col:
st.markdown(
'Pipelines // routing
',
unsafe_allow_html=True,
)
pipelines = discovery_config.get("pipelines", {})
for name, cfg in pipelines.items():
enabled = cfg.get("enabled", False)
priority = cfg.get("priority", "N/A")
budget = cfg.get("deep_dive_budget", "N/A")
status_color = COLORS["green"] if enabled else COLORS["red"]
status_dot = f''
st.markdown(
f"""
{status_dot}{name}
P:{priority}
B:{budget}
""",
unsafe_allow_html=True,
)
with right_col:
st.markdown(
'Scanners // sources
',
unsafe_allow_html=True,
)
scanners = discovery_config.get("scanners", {})
for name, cfg in scanners.items():
enabled = cfg.get("enabled", False)
pipeline = cfg.get("pipeline", "N/A")
limit = cfg.get("limit", "N/A")
status_color = COLORS["green"] if enabled else COLORS["red"]
status_dot = f''
st.markdown(
f"""
{status_dot}{name.replace('_', ' ')}
{pipeline}
limit:{limit}
""",
unsafe_allow_html=True,
)
# ---- Data Sources ----
st.markdown("", unsafe_allow_html=True)
st.markdown(
'Data Sources // vendors
',
unsafe_allow_html=True,
)
data_vendors = config.get("data_vendors", {})
if data_vendors:
cols = st.columns(3)
for i, (vendor_type, vendor_name) in enumerate(data_vendors.items()):
with cols[i % 3]:
st.markdown(
f"""
{vendor_type.replace('_', ' ')}
{vendor_name}
""",
unsafe_allow_html=True,
)
else:
st.info("No data sources configured.")