Update app.py
Browse files
app.py
CHANGED
|
@@ -212,15 +212,21 @@ def process_audio():
|
|
| 212 |
os.unlink(converted_file.name)
|
| 213 |
|
| 214 |
# Updated Email Handling
|
| 215 |
-
|
| 216 |
global awaiting_preference, current_category, awaiting_quantity, cart, awaiting_item_selection, user_email, user_name
|
| 217 |
|
| 218 |
-
logging.info(f"Processing command: {command}")
|
| 219 |
|
| 220 |
try:
|
|
|
|
| 221 |
if user_name is None and "my name is" in command:
|
| 222 |
user_name = command.replace("my name is", "").strip()
|
| 223 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
|
| 225 |
if awaiting_preference:
|
| 226 |
if "veg" in command:
|
|
|
|
| 212 |
os.unlink(converted_file.name)
|
| 213 |
|
| 214 |
# Updated Email Handling
|
| 215 |
+
ddef process_command(command):
|
| 216 |
global awaiting_preference, current_category, awaiting_quantity, cart, awaiting_item_selection, user_email, user_name
|
| 217 |
|
| 218 |
+
logging.info(f"Processing command: {command}") # Indentation fixed
|
| 219 |
|
| 220 |
try:
|
| 221 |
+
# Step 1: Handle user name input (personalize the greeting)
|
| 222 |
if user_name is None and "my name is" in command:
|
| 223 |
user_name = command.replace("my name is", "").strip()
|
| 224 |
+
return jsonify({"response": f"Hello {user_name}! Nice to meet you. Please choose your preference: Veg, Non-Veg, or All."})
|
| 225 |
+
|
| 226 |
+
# Additional logic continues...
|
| 227 |
+
except Exception as e:
|
| 228 |
+
logging.error(f"An error occurred while processing the command: {str(e)}")
|
| 229 |
+
return jsonify({"response": "Sorry, there was an error processing your request."}), 500
|
| 230 |
|
| 231 |
if awaiting_preference:
|
| 232 |
if "veg" in command:
|