MBG0903 commited on
Commit
2169248
·
verified ·
1 Parent(s): aa5dfe0

Update agents/planner.py

Browse files
Files changed (1) hide show
  1. agents/planner.py +27 -49
agents/planner.py CHANGED
@@ -1,58 +1,36 @@
1
- # ---------------------------------------------------------
2
- # PLANNER: CLASSIFIES USER INTENT AND SUB-SCENARIOS
3
- # ---------------------------------------------------------
4
-
5
  def detect_intent(message: str) -> str:
6
  """
7
- Classifies the high-level warehouse task:
8
- - slotting
9
- - picking
10
- - full_report
11
- - unknown
12
  """
13
- msg = message.lower()
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
- if any(k in msg for k in ["slot", "re-slot", "sku", "velocity", "fast mover", "slow mover"]):
 
 
 
 
 
 
16
  return "slotting"
17
 
18
- if any(k in msg for k in ["pick", "picking", "pick path", "walking route", "picker route"]):
19
- return "picking"
20
-
21
- if any(k in msg for k in ["report", "summary", "analysis", "warehouse report"]):
22
  return "report"
23
 
24
  return "unknown"
25
-
26
-
27
- def detect_slotting_scenario(message: str) -> str:
28
- """ Detects which slotting scenario the agent should optimize for. """
29
- msg = message.lower()
30
-
31
- if "congestion" in msg or "traffic" in msg:
32
- return "reduce_congestion"
33
- if "fast mover" in msg or "priority" in msg:
34
- return "prioritize_fast"
35
- if "slow mover" in msg or "free space" in msg or "prime space" in msg:
36
- return "move_slow_out"
37
- if "balance" in msg or "even" in msg:
38
- return "balance_zones"
39
- if "efficiency" in msg or "walking" in msg:
40
- return "improve_efficiency"
41
-
42
- return "generic_slotting"
43
-
44
-
45
- def detect_picking_scenario(message: str) -> str:
46
- """ Detects specialized picking scenarios for adaptive behavior. """
47
- msg = message.lower()
48
-
49
- if "inefficient" in msg or "better path" in msg:
50
- return "fix_inefficiency"
51
- if "dispatch" in msg or "start from" in msg:
52
- return "new_dispatch_location"
53
- if "avoid" in msg or "block" in msg:
54
- return "avoid_aisles"
55
- if "batch" in msg or "multi-order" in msg:
56
- return "batch_picking"
57
-
58
- return "generic_picking"
 
 
 
 
 
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"