import streamlit as st
import os
from src.langgraphagenticai.ui.uiconfigfile import Config
class LoadStreamlitUI:
def __init__(self):
self.config = Config()
self.user_controls = {}
def _inject_custom_css(self):
"""Inject custom CSS with elegant dark and light purple two-tone design"""
st.markdown("""
""", unsafe_allow_html=True)
def load_streamlit_ui(self):
# Page config
st.set_page_config(
page_title="🤖 " + self.config.get_page_title(),
layout="wide",
initial_sidebar_state="expanded"
)
# Inject custom CSS
self._inject_custom_css()
# Custom header with HTML - elegant and refined
st.markdown(f"""
""", unsafe_allow_html=True)
with st.sidebar:
# Get options from config
llm_options = self.config.get_llm_options()
usecase_options = self.config.get_usecase_options()
# AI Configuration section header
st.markdown("", unsafe_allow_html=True)
# LLM selection
self.user_controls["selected_llm"] = st.selectbox(
"Select LLM",
llm_options,
help="Choose your preferred Language Model"
)
if self.user_controls["selected_llm"] == 'Groq':
# Model selection
model_options = self.config.get_groq_model_options()
self.user_controls["selected_groq_model"] = st.selectbox(
"Select Model",
model_options,
help="Choose a Groq model variant"
)
self.user_controls["GROQ_API_KEY"] = st.session_state["GROQ_API_KEY"] = st.text_input(
"API Key",
type="password",
placeholder="Enter your Groq API key"
)
# Validate API key
if not self.user_controls["GROQ_API_KEY"]:
st.warning("⚠️ Please enter your GROQ API key to proceed. Don't have one? Get it here: [Groq Console](https://console.groq.com/keys)")
# Divider
st.markdown("", unsafe_allow_html=True)
# Use Case section header
st.markdown("", unsafe_allow_html=True)
# Usecase selection
self.user_controls["selected_usecase"] = st.selectbox(
"Select Usecases",
usecase_options,
help="Choose your application use case"
)
return self.user_controls