File size: 3,048 Bytes
7d60f73 300ca07 7d60f73 300ca07 ef25e70 300ca07 7d60f73 ef25e70 300ca07 ef25e70 300ca07 ef25e70 7d60f73 ef25e70 300ca07 ef25e70 7d60f73 300ca07 ef25e70 7d60f73 9e58632 7d60f73 300ca07 ef25e70 |
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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
from agents.planner import detect_intent
from agents.reasoner import (
run_slotting_analysis,
run_picking_optimization
)
import pandas as pd
class AutoWarehouseAgent:
def run(self, message, slotting_df, picking_df):
"""
Returns a structured dictionary:
{
"report": markdown text,
"route_image": image or None,
"slotting_table": dataframe or empty df
}
"""
task = detect_intent(message.lower().strip())
# Debug prints
print(f"π§ DETECTED TASK: {task}")
print("π¦ Slotting DF:", slotting_df)
print("π Picking DF:", picking_df)
# ------------------------------------------------------
# 1οΈβ£ SLOTTING
# ------------------------------------------------------
if task == "slotting":
explanation, slot_plan = run_slotting_analysis(message, slotting_df)
return {
"report": f"### π¦ Slotting Optimization Report\n\n{explanation}",
"route_image": None,
"slotting_table": slot_plan
}
# ------------------------------------------------------
# 2οΈβ£ PICKING
# ------------------------------------------------------
if task == "picking":
explanation, route_img = run_picking_optimization(message, picking_df)
return {
"report": f"### π Picking Route Optimization\n\n{explanation}",
"route_image": route_img,
"slotting_table": pd.DataFrame()
}
# ------------------------------------------------------
# 3οΈβ£ FULL REPORT (both slotting + picking)
# ------------------------------------------------------
if task == "report":
exp1, slot_plan = run_slotting_analysis(message, slotting_df)
exp2, route_img = run_picking_optimization(message, picking_df)
combined_report = (
"### π§Ύ Full Warehouse Intelligence Report\n\n"
"#### π¦ Slotting Optimization\n"
+ exp1 +
"\n\n---\n\n"
"#### π Picking Optimization\n"
+ exp2
)
return {
"report": combined_report,
"route_image": route_img,
"slotting_table": slot_plan
}
# ------------------------------------------------------
# β FALLBACK
# ------------------------------------------------------
return {
"report": (
"### β Unable to Understand Request\n"
"I couldn't determine whether your request is about:\n"
"- Slotting optimization\n"
"- Picking route planning\n"
"- Full warehouse report\n\n"
"Try rewriting your query."
),
"route_image": None,
"slotting_table": pd.DataFrame()
}
|