nagasurendra commited on
Commit
a8fce64
·
verified ·
1 Parent(s): 06188c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -48,13 +48,13 @@ def restaurant_voice_assistant(audio, state_json):
48
  response += f"{item}: ${price:.2f}\n"
49
  response += "\nPlease tell me the item you would like to add to your cart."
50
  state["menu_shown"] = True
51
- elif "add to cart" in input_text.lower():
52
- item = input_text.replace("add to cart", "").strip()
53
- if item in menu_items:
54
- cart.append(item)
55
- response = f"{item} has been added to your cart. Would you like to add anything else?"
56
- else:
57
- response = f"Sorry, {item} is not on the menu. Please choose an item from the menu."
58
  elif "menu" in input_text.lower():
59
  response = "Here is our menu again:\n"
60
  for item, price in menu_items.items():
 
48
  response += f"{item}: ${price:.2f}\n"
49
  response += "\nPlease tell me the item you would like to add to your cart."
50
  state["menu_shown"] = True
51
+ elif any(item.lower() in input_text.lower() for item in menu_items):
52
+ # Check if input matches a menu item
53
+ for item in menu_items:
54
+ if item.lower() in input_text.lower():
55
+ cart.append(item)
56
+ response = f"{item} has been added to your cart. Would you like to add anything else?"
57
+ break
58
  elif "menu" in input_text.lower():
59
  response = "Here is our menu again:\n"
60
  for item, price in menu_items.items():