MBG0903 commited on
Commit
2fcbbcc
·
verified ·
1 Parent(s): ef25e70

Update agents/planner.py

Browse files
Files changed (1) hide show
  1. agents/planner.py +44 -25
agents/planner.py CHANGED
@@ -1,36 +1,55 @@
1
- def detect_intent(message: str) -> str:
2
  """
3
- Detects whether the user is asking for:
4
- - slotting optimization
5
- - picking route optimization
6
- - full warehouse report
 
7
  """
8
- if not message:
9
- return "unknown"
10
 
11
  msg = message.lower().strip()
12
 
13
- # --- PICKING FIRST (stronger keywords) ---
14
- picking_kw = [
15
- "picking", "pick route", "picking route",
16
- "optimize picking", "path", "shortest path",
17
- "picker travel"
 
 
18
  ]
19
- if any(k in msg for k in picking_kw):
20
- return "picking"
21
 
22
- # --- SLOTTING ---
23
- slotting_kw = [
24
- "slotting", "slot", "sku placement",
25
- "velocity", "fast mover", "slow mover",
26
- "optimize slots", "slot plan"
 
 
 
 
 
 
 
 
 
 
 
27
  ]
28
- if any(k in msg for k in slotting_kw):
29
- return "slotting"
30
 
31
- # --- FULL REPORT ---
32
- report_kw = ["full report", "warehouse report", "summary", "complete analysis"]
33
- if any(k in msg for k in report_kw):
 
 
34
  return "report"
35
 
36
- return "unknown"
 
 
 
 
 
 
 
 
 
 
1
+ def detect_intent(message: str):
2
  """
3
+ A robust, rule-based classifier for warehouse tasks.
4
+ Returns one of:
5
+ - "slotting"
6
+ - "picking"
7
+ - "report"
8
  """
 
 
9
 
10
  msg = message.lower().strip()
11
 
12
+ # -----------------------------
13
+ # SLOTING KEYWORDS
14
+ # -----------------------------
15
+ slot_keywords = [
16
+ "slot", "slotting", "putaway", "storage location",
17
+ "rearrange items", "reorganize racks", "optimize space",
18
+ "velocity", "sku placement", "bin allocation"
19
  ]
 
 
20
 
21
+ # -----------------------------
22
+ # PICKING KEYWORDS
23
+ # -----------------------------
24
+ pick_keywords = [
25
+ "pick", "picking", "route", "path", "walk sequence",
26
+ "shortest path", "aisle", "rack", "order fulfillment",
27
+ "picklist"
28
+ ]
29
+
30
+ # -----------------------------
31
+ # FULL REPORT KEYWORDS
32
+ # -----------------------------
33
+ report_keywords = [
34
+ "full report", "overall performance", "warehouse report",
35
+ "summary", "end to end", "combined", "complete report",
36
+ "all optimizations"
37
  ]
 
 
38
 
39
+ # -----------------------------
40
+ # PRIORITY: Full Report Slotting Picking
41
+ # (Prevents overlap confusion)
42
+ # -----------------------------
43
+ if any(k in msg for k in report_keywords):
44
  return "report"
45
 
46
+ if any(k in msg for k in slot_keywords):
47
+ return "slotting"
48
+
49
+ if any(k in msg for k in pick_keywords):
50
+ return "picking"
51
+
52
+ # -----------------------------
53
+ # UNKNOWN → DEFAULT TO REPORT
54
+ # -----------------------------
55
+ return "report"