geethareddy commited on
Commit
e84dcc3
·
verified ·
1 Parent(s): a3745bb

Update static/script.js

Browse files
Files changed (1) hide show
  1. static/script.js +7 -7
static/script.js CHANGED
@@ -52,13 +52,13 @@ function handleResponse(userInput) {
52
  botResponse = 'Great choice! 🍽️ Fetching non-vegetarian ingredients...';
53
  fetchIngredients('non-vegetarian');
54
  } else if (selectedIngredients.length > 0 && lastMessage === 'suggest') {
55
- botResponse = 'Generating food suggestions based on your ingredients...';
56
  getFoodSuggestions();
57
  } else if (lastMessage === 'done') {
58
- botResponse = 'Thank you! Would you like to start over or suggest recipes with your selected ingredients?';
59
  options = [
60
- { text: 'Start Over', class: '' },
61
- { text: 'Suggest', class: '' }
62
  ];
63
  }
64
 
@@ -157,9 +157,9 @@ function getFoodSuggestions() {
157
  .then(response => response.json())
158
  .then(data => {
159
  if (data.error) {
160
- addMessage('bot', `Sorry, there was an error getting suggestions: ${data.error}`);
161
  } else {
162
- addMessage('bot', 'Here are some food suggestions based on your ingredients:');
163
  data.suggestions.forEach(suggestion => addMessage('bot', suggestion));
164
  addMessage('bot', 'Would you like to start over or select more ingredients?');
165
  displayOptions([
@@ -169,7 +169,7 @@ function getFoodSuggestions() {
169
  }
170
  })
171
  .catch(error => {
172
- addMessage('bot', `Error: Unable to get food suggestions. ${error.message}`);
173
  });
174
  }
175
 
 
52
  botResponse = 'Great choice! 🍽️ Fetching non-vegetarian ingredients...';
53
  fetchIngredients('non-vegetarian');
54
  } else if (selectedIngredients.length > 0 && lastMessage === 'suggest') {
55
+ botResponse = 'Generating recipe ideas based on your selected ingredients...';
56
  getFoodSuggestions();
57
  } else if (lastMessage === 'done') {
58
+ botResponse = 'Thank you! Please type "suggest" to get recipe ideas based on your selected ingredients, or "start over" to begin again.';
59
  options = [
60
+ { text: 'Suggest', class: '' },
61
+ { text: 'Start Over', class: '' }
62
  ];
63
  }
64
 
 
157
  .then(response => response.json())
158
  .then(data => {
159
  if (data.error) {
160
+ addMessage('bot', `Sorry, there was an error getting recipe ideas: ${data.error}`);
161
  } else {
162
+ addMessage('bot', 'Here are some recipe ideas based on your selected ingredients:');
163
  data.suggestions.forEach(suggestion => addMessage('bot', suggestion));
164
  addMessage('bot', 'Would you like to start over or select more ingredients?');
165
  displayOptions([
 
169
  }
170
  })
171
  .catch(error => {
172
+ addMessage('bot', `Error: Unable to get recipe ideas. ${error.message}`);
173
  });
174
  }
175