Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -220,16 +220,42 @@ def process_command(command):
|
|
| 220 |
return f"Removed {item[0]} from your cart. Updated cart: {cart_summary}. Total: ₹{total}."
|
| 221 |
return "The item you are trying to remove is not in your cart."
|
| 222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
# Handle final order
|
| 224 |
if "final order" in command or "submit" in command:
|
| 225 |
if cart:
|
| 226 |
order_details = ", ".join([f"{item[0]} x{item[2]} (₹{item[1] * item[2]})" for item in cart])
|
| 227 |
total = sum(item[1] * item[2] for item in cart)
|
| 228 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
return f"Your final order is: {order_details}. Total price: ₹{total}. Thank you for visiting Biryani Hub!"
|
| 230 |
else:
|
| 231 |
return "Your cart is empty. Please add items before placing the final order."
|
| 232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
# Handle cart details
|
| 234 |
if "cart details" in command:
|
| 235 |
if cart:
|
|
|
|
| 220 |
return f"Removed {item[0]} from your cart. Updated cart: {cart_summary}. Total: ₹{total}."
|
| 221 |
return "The item you are trying to remove is not in your cart."
|
| 222 |
|
| 223 |
+
# Handle viewing cart details
|
| 224 |
+
if "cart details" in command:
|
| 225 |
+
if cart:
|
| 226 |
+
cart_summary = "\n".join([f"{i[0]} x{i[2]} (₹{i[1] * i[2]})" for i in cart])
|
| 227 |
+
total = sum(i[1] * i[2] for i in cart)
|
| 228 |
+
return f"Your cart contains:\n{cart_summary}\nTotal: ₹{total}. Would you like to add or remove items?"
|
| 229 |
+
|
| 230 |
# Handle final order
|
| 231 |
if "final order" in command or "submit" in command:
|
| 232 |
if cart:
|
| 233 |
order_details = ", ".join([f"{item[0]} x{item[2]} (₹{item[1] * item[2]})" for item in cart])
|
| 234 |
total = sum(item[1] * item[2] for item in cart)
|
| 235 |
+
return (
|
| 236 |
+
f"Your final order is: {order_details}. Total price: ₹{total}. "
|
| 237 |
+
f"Would you like to proceed with the order? (Say 'yes' to proceed or 'no' to add/remove food items.)"
|
| 238 |
+
)
|
| 239 |
+
else:
|
| 240 |
+
return "Your cart is empty. Please add items before placing the final order."
|
| 241 |
+
|
| 242 |
+
# Handle user response for proceeding with the order
|
| 243 |
+
if "yes" in command:
|
| 244 |
+
if cart:
|
| 245 |
+
order_details = ", ".join([f"{item[0]} x{item[2]} (₹{item[1] * item[2]})" for item in cart])
|
| 246 |
+
total = sum(item[1] * item[2] for item in cart)
|
| 247 |
+
cart.clear() # Clear cart after confirming the order
|
| 248 |
return f"Your final order is: {order_details}. Total price: ₹{total}. Thank you for visiting Biryani Hub!"
|
| 249 |
else:
|
| 250 |
return "Your cart is empty. Please add items before placing the final order."
|
| 251 |
|
| 252 |
+
# Handle user response for modifying the cart (add/remove items)
|
| 253 |
+
if "no" in command:
|
| 254 |
+
return "Would you like to add more items or remove any existing ones from your cart?"
|
| 255 |
+
|
| 256 |
+
# Default response
|
| 257 |
+
return "Sorry, I didn't understand that. Please try again."
|
| 258 |
+
|
| 259 |
# Handle cart details
|
| 260 |
if "cart details" in command:
|
| 261 |
if cart:
|