Spaces:
Sleeping
Sleeping
Commit ·
89e2c52
1
Parent(s): f97b9fe
feat: show KB overview summary on welcome page in both CLI and web UI
Browse filesLoads the KB meta overview (generated during ingestion) and displays it
when the chatbot starts, so users immediately see what is in their
knowledge base.
- CLI: KB summary shown in the welcome panel (truncated to ~600 chars)
- Web: KB summary shown in an expandable section before the first message
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Files changed (2)
- app_cli.py+15
- app_web.py+12
8 unmodified lines91011121314198 unmodified lines2132142152162172188 unmodified linesfrom src.config_loader import load_config, get_api_keyfrom src.ingest import ingest_documentsfrom src.query_engine import understand_queryfrom src.retriever import retrievefrom src.verifier import verify_and_respond198 unmodified lineswelcome.append("OFF", style="bold red")welcome.append(". Use /websearch on to enable.\n\n")welcome.append("Type your question, or /help for commands.\n", style="italic")welcome.append("Type /quit to exit.", style="italic dim")console.print(Panel(welcome, title="Welcome", border_style="cyan"))8 unmodified lines9101112131415198 unmodified lines2142152162172182192202212222232242252262272282292302312322338 unmodified linesfrom src.config_loader import load_config, get_api_keyfrom src.ingest import ingest_documentsfrom src.kb_meta import load_kb_metafrom src.query_engine import understand_queryfrom src.retriever import retrievefrom src.verifier import verify_and_respond198 unmodified lineswelcome.append("OFF", style="bold red")welcome.append(". Use /websearch on to enable.\n\n")# KB overview summarykb_overview = load_kb_meta(cfg)if kb_overview:welcome.append("Knowledge Base Contents:\n", style="bold")# Strip the === markers and show the bodyoverview_body = kb_overviewfor marker in ("=== KNOWLEDGE BASE OVERVIEW ===", "=== END OVERVIEW ==="):overview_body = overview_body.replace(marker, "")overview_body = overview_body.strip()# Truncate for the welcome panel (keep first ~600 chars)if len(overview_body) > 600:overview_body = overview_body[:600].rsplit("\n", 1)[0] + "\n..."welcome.append(overview_body + "\n\n", style="dim")welcome.append("Type your question, or /help for commands.\n", style="italic")welcome.append("Type /quit to exit.", style="italic dim")console.print(Panel(welcome, title="Welcome", border_style="cyan"))
3 unmodified lines456789278 unmodified lines2882892902912922933 unmodified linesfrom src.config_loader import load_config, get_api_keyfrom src.ingest import get_chroma_collection, ingest_documentsfrom src.query_engine import understand_queryfrom src.retriever import retrievefrom src.verifier import verify_and_respond278 unmodified linesst.title(bot_name)render_sidebar()render_chat()3 unmodified lines45678910278 unmodified lines2892902912922932942952962972982993003013023033043053 unmodified linesfrom src.config_loader import load_config, get_api_keyfrom src.ingest import get_chroma_collection, ingest_documentsfrom src.kb_meta import load_kb_metafrom src.query_engine import understand_queryfrom src.retriever import retrievefrom src.verifier import verify_and_respond278 unmodified linesst.title(bot_name)# Show KB overview on first visit (no messages yet)if not st.session_state.messages:kb_overview = load_kb_meta(cfg)if kb_overview:overview_body = kb_overviewfor marker in ("=== KNOWLEDGE BASE OVERVIEW ===", "=== END OVERVIEW ==="):overview_body = overview_body.replace(marker, "")overview_body = overview_body.strip()with st.expander("Knowledge Base Contents", expanded=True):st.markdown(overview_body)render_sidebar()render_chat()
app_cli.py+15
app_web.py+12