Update app.py
Browse files
app.py
CHANGED
|
@@ -238,10 +238,11 @@ def process_command(command):
|
|
| 238 |
|
| 239 |
command = command.lower()
|
| 240 |
|
|
|
|
| 241 |
if "hello" in command or "hi" in command or "hey" in command:
|
| 242 |
-
return
|
| 243 |
-
|
| 244 |
-
|
| 245 |
elif "show me the menu" in command or "what’s the menu" in command:
|
| 246 |
return (
|
| 247 |
"Here are the options: \n"
|
|
@@ -251,32 +252,40 @@ def process_command(command):
|
|
| 251 |
"Desserts: Gulab Jamun, Kheer, Ice Cream, Ras Malai\n"
|
| 252 |
"Please let me know what you'd like to add to your order."
|
| 253 |
)
|
|
|
|
|
|
|
| 254 |
elif "add" in command:
|
| 255 |
item_to_add = command.split("add")[-1].strip()
|
| 256 |
if item_to_add:
|
| 257 |
user_order.append(item_to_add)
|
| 258 |
return f"{item_to_add} has been added to your order. Would you like to add more items?"
|
|
|
|
|
|
|
| 259 |
elif "remove" in command:
|
| 260 |
item_to_remove = command.split("remove")[-1].strip()
|
| 261 |
if item_to_remove in user_order:
|
| 262 |
user_order.remove(item_to_remove)
|
| 263 |
return f"{item_to_remove} has been removed from your order. Would you like to add or remove anything else?"
|
|
|
|
|
|
|
| 264 |
elif "show my order" in command or "what's my order" in command:
|
| 265 |
if user_order:
|
| 266 |
return "Your current order includes: " + ", ".join(user_order)
|
| 267 |
else:
|
| 268 |
return "You haven't added anything to your order yet."
|
|
|
|
|
|
|
| 269 |
elif "place order" in command or "confirm order" in command:
|
| 270 |
if user_order:
|
| 271 |
-
return (
|
| 272 |
-
"You have the following items in your order: " + ", ".join(user_order) +
|
| 273 |
-
". Would you like to confirm your order?"
|
| 274 |
-
)
|
| 275 |
else:
|
| 276 |
return "You haven't added anything to your order yet. Please add some items."
|
|
|
|
|
|
|
| 277 |
elif "yes" in command or "place order" in command:
|
| 278 |
return "Your order has been confirmed and sent to the kitchen. Thank you for ordering!"
|
| 279 |
-
|
|
|
|
| 280 |
return (
|
| 281 |
"Sorry, I didn’t understand your request. You can say things like:\n"
|
| 282 |
"- Show me the menu\n"
|
|
|
|
| 238 |
|
| 239 |
command = command.lower()
|
| 240 |
|
| 241 |
+
# Greetings
|
| 242 |
if "hello" in command or "hi" in command or "hey" in command:
|
| 243 |
+
return "Welcome! How can I assist you today? You can ask to see the menu or place an order."
|
| 244 |
+
|
| 245 |
+
# Show menu
|
| 246 |
elif "show me the menu" in command or "what’s the menu" in command:
|
| 247 |
return (
|
| 248 |
"Here are the options: \n"
|
|
|
|
| 252 |
"Desserts: Gulab Jamun, Kheer, Ice Cream, Ras Malai\n"
|
| 253 |
"Please let me know what you'd like to add to your order."
|
| 254 |
)
|
| 255 |
+
|
| 256 |
+
# Add item to order
|
| 257 |
elif "add" in command:
|
| 258 |
item_to_add = command.split("add")[-1].strip()
|
| 259 |
if item_to_add:
|
| 260 |
user_order.append(item_to_add)
|
| 261 |
return f"{item_to_add} has been added to your order. Would you like to add more items?"
|
| 262 |
+
|
| 263 |
+
# Remove item from order
|
| 264 |
elif "remove" in command:
|
| 265 |
item_to_remove = command.split("remove")[-1].strip()
|
| 266 |
if item_to_remove in user_order:
|
| 267 |
user_order.remove(item_to_remove)
|
| 268 |
return f"{item_to_remove} has been removed from your order. Would you like to add or remove anything else?"
|
| 269 |
+
|
| 270 |
+
# Show current order
|
| 271 |
elif "show my order" in command or "what's my order" in command:
|
| 272 |
if user_order:
|
| 273 |
return "Your current order includes: " + ", ".join(user_order)
|
| 274 |
else:
|
| 275 |
return "You haven't added anything to your order yet."
|
| 276 |
+
|
| 277 |
+
# Place order
|
| 278 |
elif "place order" in command or "confirm order" in command:
|
| 279 |
if user_order:
|
| 280 |
+
return f"You have the following items in your order: {', '.join(user_order)}. Would you like to confirm?"
|
|
|
|
|
|
|
|
|
|
| 281 |
else:
|
| 282 |
return "You haven't added anything to your order yet. Please add some items."
|
| 283 |
+
|
| 284 |
+
# Final confirmation
|
| 285 |
elif "yes" in command or "place order" in command:
|
| 286 |
return "Your order has been confirmed and sent to the kitchen. Thank you for ordering!"
|
| 287 |
+
|
| 288 |
+
# Help if unrecognized
|
| 289 |
return (
|
| 290 |
"Sorry, I didn’t understand your request. You can say things like:\n"
|
| 291 |
"- Show me the menu\n"
|