gabrielaltay's picture
faster
c75f2fc
"""Sidebar components for LegisQA"""
import streamlit as st
import os
from legisqa_local.config.settings import get_chroma_config
from legisqa_local.core.vectorstore import get_vectorstore
def render_chromadb_status():
"""Render ChromaDB status in sidebar"""
st.subheader("πŸ—„οΈ Vector Database")
vectorstore = get_vectorstore()
if vectorstore is not None:
# Use cached count from session state to avoid network calls on every rerun
count = st.session_state.get("vectorstore_count")
if count is not None:
st.success("βœ… ChromaDB Ready")
st.caption(f"πŸ“Š {count:,} documents loaded")
config = get_chroma_config()
st.caption(f"πŸ“ Collection: {config['collection_name']}")
else:
st.warning("⚠️ ChromaDB Loaded (verification failed)")
st.caption("Could not retrieve document count")
else:
st.info("⏳ ChromaDB Loading...")
st.caption("Vectorstore is being initialized")
def render_outreach_links():
"""Render links to external resources"""
nomic_base_url = "https://atlas.nomic.ai/data/gabrielhyperdemocracy"
nomic_map_name = "us-congressional-legislation-s1024o256nomic-1"
nomic_url = f"{nomic_base_url}/{nomic_map_name}/map"
hf_url = "https://huggingface.co/hyperdemocracy"
chroma_url = "https://www.trychroma.com/"
together_url = "https://www.together.ai/"
google_gemini_url = "https://ai.google.dev/gemini-api"
anthropic_url = "https://www.anthropic.com/api"
openai_url = "https://platform.openai.com/docs/overview"
langchain_url = "https://www.langchain.com/"
st.subheader(f":world_map: Visualize [nomic atlas]({nomic_url})")
st.subheader(f":hugging_face: Raw [huggingface datasets]({hf_url})")
st.subheader(f":card_file_box: Vector DB [chromadb]({chroma_url})")
st.subheader(f":pancakes: Inference [together.ai]({together_url})")
st.subheader(f":eyeglasses: Inference [google-gemini]({google_gemini_url})")
st.subheader(f":hut: Inference [anthropic]({anthropic_url})")
st.subheader(f":sparkles: Inference [openai]({openai_url})")
st.subheader(f":parrot: Orchestration [langchain]({langchain_url})")
def render_sidebar():
"""Render the complete sidebar"""
with st.container(border=True):
render_chromadb_status()
with st.container(border=True):
render_outreach_links()