import streamlit as st
from typing import Dict, Any
from src.langgraphagenticai.ui.uiconfigfile import Config
class LoadStreamlitUI:
def __init__(self):
self.config = Config()
self.user_controls: Dict[str, Any] = {}
def _inject_css(self):
st.markdown(
"""
""",
unsafe_allow_html=True,
)
def load_streamlit_ui(self):
st.set_page_config(
page_title=f"🤖 {self.config.get_page_title()}",
layout="wide",
page_icon="🤖",
)
self._inject_css()
# ---- Header (beautiful, minimal) ----
st.markdown(
f"""
🤖 {self.config.get_page_title()}
""",
unsafe_allow_html=True,
)
# ---- Sidebar (your same controls; just styled) ----
with st.sidebar:
st.markdown('', unsafe_allow_html=True)
st.markdown('
⚙️ Configuration
', unsafe_allow_html=True)
llm_options = self.config.get_llm_options()
usecase_options = self.config.get_usecase_options()
self.user_controls["selected_llm"] = st.selectbox("Select LLM", llm_options)
if self.user_controls["selected_llm"] == "Groq":
model_options = self.config.get_groq_model_options()
self.user_controls["selected_groq_model"] = st.selectbox("Select Groq Model", model_options)
show_key = st.toggle("Show API key", value=False)
self.user_controls["GROQ_API_KEY"] = st.text_input(
"GROQ API Key",
type="default" if show_key else "password",
placeholder="Enter your GROQ_API_KEY",
)
st.warning("⚠️ Please enter your GROQ API key to proceed, Get it from https://console.groq.com/keys")
# if not self.user_controls["GROQ_API_KEY"]:
# st.warning("Please enter your GROQ API key to proceed.")
self.user_controls["selected_usecase"] = st.selectbox("Select Use Case", usecase_options)
# st.markdown('
Selections apply instantly. No extra sections or tabs.
', unsafe_allow_html=True)
st.markdown('
', unsafe_allow_html=True)
# ---- Optional slim content frame (kept minimal) ----
st.markdown('', unsafe_allow_html=True)
st.markdown('', unsafe_allow_html=True)
st.write("Ask anything, Keep it simple and elegant ✨")
st.markdown('
', unsafe_allow_html=True)
st.markdown('', unsafe_allow_html=True)
return self.user_controls
# --- Optional direct run ---
if __name__ == "__main__":
ui = LoadStreamlitUI()
controls = ui.load_streamlit_ui()