Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -165,6 +165,20 @@ def process_command(command):
|
|
| 165 |
if "menu" in command:
|
| 166 |
menu = ", ".join([f"{category}: {', '.join(items.keys())}" for category, items in MENU.items()])
|
| 167 |
return f"Here is our menu: {menu}."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
elif any(item in command for item in all_items.keys()):
|
| 169 |
item = next((item for item in all_items.keys() if item in command), None)
|
| 170 |
if item:
|
|
|
|
| 165 |
if "menu" in command:
|
| 166 |
menu = ", ".join([f"{category}: {', '.join(items.keys())}" for category, items in MENU.items()])
|
| 167 |
return f"Here is our menu: {menu}."
|
| 168 |
+
elif "remove" in command:
|
| 169 |
+
if len(cart) == 0:
|
| 170 |
+
return "Your cart is empty. There is nothing to remove."
|
| 171 |
+
item_to_remove = next((item for item, _ in cart if item.lower() in command), None)
|
| 172 |
+
if item_to_remove:
|
| 173 |
+
cart[:] = [i for i in cart if i[0].lower() != item_to_remove.lower()]
|
| 174 |
+
total = sum(item[1] for item in cart)
|
| 175 |
+
if cart:
|
| 176 |
+
cart_summary = ", ".join([f"{i[0]} (₹{i[1]})" for i in cart])
|
| 177 |
+
return f"{item_to_remove} has been removed. Your cart: {cart_summary}. Total: ₹{total}. Do you want to order anything else?"
|
| 178 |
+
else:
|
| 179 |
+
return f"{item_to_remove} has been removed. Your cart is now empty."
|
| 180 |
+
else:
|
| 181 |
+
return "The item you want to remove is not in your cart."
|
| 182 |
elif any(item in command for item in all_items.keys()):
|
| 183 |
item = next((item for item in all_items.keys() if item in command), None)
|
| 184 |
if item:
|