Upgrade: Keyword-Match β LLM Intent Detection
Backend: LLM Intent Detector
- Add
detect_intent(query)β calls LLM β returns{intent, entities} - Define intent types: trace_order, show_orders, billing_analysis, explain, fraud_check, etc.
- Add
Backend: Intent-Based SQL
- Replace keyword
generate_sql()withgenerate_sql_from_intent(intent, entities) - Deterministic SQL per intent, no more
if "trace" in q
- Replace keyword
Backend: LLM Summary
- Add
generate_llm_summary(query, result)for clean natural language answers - Fallback to rule-based if LLM fails
- Add
Backend: Conditional Highlights
- Only return
highlightsfor trace/graph intents - Empty highlights for show_orders, billing_analysis, etc.
- Only return
Frontend: Smart Graph Control
- Only highlight when highlights array is non-empty
- Clear previous highlights for non-graph queries
Verification
- curl test all intents
- Browser demo
Feature: Visual Flow Trace in Chat
- Add
renderFlowTracecomponent toChatPanel.jsx - Render document chain with arrows (Order β Delivery β Billing β Journal)
- Support clicking on IDs in the flow to highlight them in the graph
- Sync
main.pyandmain_OPENROUTER_FINAL.pyfor correct flow data output
- Add
Feature: Resizable Chat Panel
- Add
chatWidthstate toApp.jsx - Implement draggable resize handle between Graph and Chat panels
- Update
ChatPanel.jsxto accept and use dynamic width - Add min/max width constraints for better UX
- Add
Feature: Monorepo Refactor for Deployment
- Create
backend/andfrontend/directories - Move backend logic and DB to
backend/ - Create
backend/requirements.txt - Update frontend to use
import.meta.env.VITE_API_URL - Create
frontend/.envfor local development - Verify local run in browser
- Commit all changes locally (Monorepo + Updates)
- Final Push to GitHub (Success π)
- Fix Vercel 404: Add
frontend/vercel.jsonand push - Fix API 422: Refactor
/queryfrom GET to POST
- Create