const COPILOT_SEED = [ { role: "user", text: "Why is profit decreasing in Q2?" }, { role: "assistant", streaming: false, text: "Q2 net profit is down **4.2%** vs Q1, but the story is nuanced — this is a **margin compression story, not a revenue story**. Here's the decomposition:", charts: ["waterfall"], sources: ["gem_transactions", "state_revenue_daily", "vendor_master"], followups: ["Which department contributed most?", "Show forecast for Q3", "Compare with FY25 Q2"] }, ]; function CopilotScreen() { const [messages, setMessages] = useState(COPILOT_SEED); const [input, setInput] = useState(""); const [streaming, setStreaming] = useState(false); const scrollRef = useRef(null); useEffect(() => { scrollRef.current?.scrollTo({ top: scrollRef.current.scrollHeight, behavior: 'smooth' }); }, [messages, streaming]); const send = (text) => { const q = text || input; if (!q.trim()) return; setMessages(m => [...m, { role: "user", text: q }]); setInput(""); setStreaming(true); setTimeout(() => { setMessages(m => [...m, { role: "assistant", text: "Analyzing across **3 datasets**, executing federated query on ClickHouse + PostgreSQL…", charts: ["line"], sources: ["gem_transactions", "vendor_master"], followups: ["Break this down by department", "Forecast next 90 days", "Export as PDF report"] }]); setStreaming(false); }, 900); }; return (
{/* Left: history / examples */}
Recent
{[ "Q2 profit decrease analysis", "State-wise procurement report", "Vendor risk assessment", "GeM Q1 vs Q2 comparison", "Predict Q3 tender volumes", ].map((h, i) => (
{h}
))}
Data Scope
4 datasets selected
gem_transactions · vendor_master · state_revenue_daily · scheme_disbursement
{/* Main chat */}
VyaparBI Copilot
Multi-agent · RAG over 12 datasets · Multilingual (हिन्दी, English, 22 Indian langs)
XAI Enabled
{messages.map((m, i) => ( ))} {streaming && (
Planning query… routing to ClickHouse and Postgres
)}
{["Try:", "Explain revenue anomalies", "Compare states YoY", "Predict Q3 volumes", "Vendor risk scores"].map((c, i) => ( i === 0 ? {c} : ))}