Spaces:
Sleeping
Sleeping
Update static/script.js
Browse files- static/script.js +4 -3
static/script.js
CHANGED
@@ -59,7 +59,7 @@ function handleResponse(userInput) {
|
|
59 |
{ text: 'Keto', class: '' },
|
60 |
{ text: 'Halal', class: '' }
|
61 |
];
|
62 |
-
} else if (lastMessage.includes('non-vegetarian')) {
|
63 |
botResponse = 'Great choice! 🍽️ We have some amazing non-vegetarian options! What\'s your dietary preference?';
|
64 |
options = [
|
65 |
{ text: 'Low Carb', class: '' },
|
@@ -68,8 +68,8 @@ function handleResponse(userInput) {
|
|
68 |
{ text: 'Halal', class: '' }
|
69 |
];
|
70 |
} else if (lastMessage.includes('low carb') || lastMessage.includes('dairy-free') || lastMessage.includes('keto') || lastMessage.includes('halal') || lastMessage.includes('gluten-free') || lastMessage.includes('vegan') || lastMessage.includes('vegetarian')) {
|
71 |
-
fetchIngredients(lastMessage);
|
72 |
-
return; // Exit early to
|
73 |
}
|
74 |
|
75 |
addMessage('bot', botResponse);
|
@@ -78,6 +78,7 @@ function handleResponse(userInput) {
|
|
78 |
}
|
79 |
}
|
80 |
|
|
|
81 |
function fetchIngredients(dietaryPreference) {
|
82 |
fetch('/get_ingredients', {
|
83 |
method: 'POST',
|
|
|
59 |
{ text: 'Keto', class: '' },
|
60 |
{ text: 'Halal', class: '' }
|
61 |
];
|
62 |
+
} else if (lastMessage.includes('non-vegetarian') || lastMessage.includes('non veg') || lastMessage.includes('nonveg')) {
|
63 |
botResponse = 'Great choice! 🍽️ We have some amazing non-vegetarian options! What\'s your dietary preference?';
|
64 |
options = [
|
65 |
{ text: 'Low Carb', class: '' },
|
|
|
68 |
{ text: 'Halal', class: '' }
|
69 |
];
|
70 |
} else if (lastMessage.includes('low carb') || lastMessage.includes('dairy-free') || lastMessage.includes('keto') || lastMessage.includes('halal') || lastMessage.includes('gluten-free') || lastMessage.includes('vegan') || lastMessage.includes('vegetarian')) {
|
71 |
+
fetchIngredients(lastMessage); // Handle ingredient fetch based on dietary preference
|
72 |
+
return; // Exit early to fetch ingredients
|
73 |
}
|
74 |
|
75 |
addMessage('bot', botResponse);
|
|
|
78 |
}
|
79 |
}
|
80 |
|
81 |
+
|
82 |
function fetchIngredients(dietaryPreference) {
|
83 |
fetch('/get_ingredients', {
|
84 |
method: 'POST',
|