File size: 2,252 Bytes
ed895b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Upgrade: Keyword-Match โ†’ LLM Intent Detection

- [x] **Backend: LLM Intent Detector**
  - [x] Add `detect_intent(query)` โ†’ calls LLM โ†’ returns `{intent, entities}`
  - [x] Define intent types: trace_order, show_orders, billing_analysis, explain, fraud_check, etc.

- [x] **Backend: Intent-Based SQL**
  - [x] Replace keyword `generate_sql()` with `generate_sql_from_intent(intent, entities)`
  - [x] Deterministic SQL per intent, no more `if "trace" in q`

- [x] **Backend: LLM Summary**
  - [x] Add `generate_llm_summary(query, result)` for clean natural language answers
  - [x] Fallback to rule-based if LLM fails

- [x] **Backend: Conditional Highlights**
  - [x] Only return `highlights` for trace/graph intents
  - [x] Empty highlights for show_orders, billing_analysis, etc.

- [x] **Frontend: Smart Graph Control**
  - [x] Only highlight when highlights array is non-empty
  - [x] Clear previous highlights for non-graph queries

- [x] **Verification**
  - [x] curl test all intents
  - [x] Browser demo

- [x] **Feature: Visual Flow Trace in Chat**
  - [x] Add `renderFlowTrace` component to `ChatPanel.jsx`
  - [x] Render document chain with arrows (Order โ†’ Delivery โ†’ Billing โ†’ Journal)
  - [x] Support clicking on IDs in the flow to highlight them in the graph
  - [x] Sync `main.py` and `main_OPENROUTER_FINAL.py` for correct flow data output
- [x] **Feature: Resizable Chat Panel**
  - [x] Add `chatWidth` state to `App.jsx`
  - [x] Implement draggable resize handle between Graph and Chat panels
  - [x] Update `ChatPanel.jsx` to accept and use dynamic width
  - [x] Add min/max width constraints for better UX

- [x] **Feature: Monorepo Refactor for Deployment**
  - [x] Create `backend/` and `frontend/` directories
  - [x] Move backend logic and DB to `backend/`
  - [x] Create `backend/requirements.txt`
  - [x] Update frontend to use `import.meta.env.VITE_API_URL`
  - [x] Create `frontend/.env` for local development
  - [x] Verify local run in browser
  - [x] Commit all changes locally (Monorepo + Updates)
  - [x] Final Push to GitHub (Success ๐Ÿš€)
  - [x] Fix Vercel 404: Add `frontend/vercel.json` and push
  - [x] Fix API 422: Refactor `/query` from GET to POST