nagasurendra commited on
Commit
e23474e
·
verified ·
1 Parent(s): 59916bf

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +38 -38
templates/index.html CHANGED
@@ -500,45 +500,45 @@
500
  displayCart();
501
  }
502
 
503
- function resetToPreviousStep() {
504
- console.log('Resetting to previous step. Current step:', currentStep);
505
-
506
- // Based on the currentStep, go back to the previous step
507
- if (currentStep === 'food_type') {
508
- currentStep = 'greeting';
509
- conversation.push({ role: 'bot', message: "Hi there! I'm Chef Bot! May I know your name?" });
510
- console.log('Step changed to greeting. Conversation updated.');
511
- } else if (currentStep === 'select_ingredients') {
512
- currentStep = 'food_type';
513
- conversation.push({ role: 'bot', message: 'What type of food would you prefer?' });
514
- console.log('Step changed to food_type. Conversation updated.');
515
- } else if (currentStep === 'customization') {
516
- currentStep = 'menu_display';
517
- console.log('Step changed to menu_display.');
518
- fetchMenuItems({ ingredient_names: ingredientNames });
519
- } else if (currentStep === 'post_cart') {
520
- currentStep = 'food_type';
521
- conversation.push({ role: 'bot', message: 'What type of food would you prefer?' });
522
- console.log('Step changed to food_type after post_cart. Conversation updated.');
523
- } else {
524
- console.error('Unexpected currentStep value:', currentStep);
525
- }
526
-
527
- // After going back to 'select_ingredients', trigger the fetchIngredients again
528
- if (currentStep === 'select_ingredients') {
529
- const lastMessage = conversation[conversation.length - 1].message.toLowerCase();
530
- if (lastMessage.includes('vegetarian')) {
531
- console.log('Fetching vegetarian ingredients again after back.');
532
- fetchIngredients('vegetarian');
533
- } else if (lastMessage.includes('non-vegetarian')) {
534
- console.log('Fetching non-vegetarian ingredients again after back.');
535
- fetchIngredients('non-vegetarian');
 
 
 
 
 
536
  }
537
- }
538
-
539
- // Ensure the bot message is updated according to the previous step
540
- setTimeout(() => handleResponse(conversation[conversation.length - 1].message), 500);
541
- }
542
 
543
 
544
  function handleYesResponse() {
 
500
  displayCart();
501
  }
502
 
503
+ function resetToPreviousStep() {
504
+ console.log('Resetting to previous step. Current step:', currentStep);
505
+
506
+ // Based on the currentStep, go back to the previous step
507
+ if (currentStep === 'food_type') {
508
+ currentStep = 'greeting';
509
+ conversation.push({ role: 'bot', message: "Hi there! I'm Chef Bot! May I know your name?" });
510
+ console.log('Step changed to greeting. Conversation updated.');
511
+ } else if (currentStep === 'select_ingredients') {
512
+ currentStep = 'food_type';
513
+ conversation.push({ role: 'bot', message: 'What type of food would you prefer?' });
514
+ console.log('Step changed to food_type. Conversation updated.');
515
+ } else if (currentStep === 'customization') {
516
+ currentStep = 'menu_display';
517
+ console.log('Step changed to menu_display.');
518
+ //fetchMenuItems({ ingredient_names: ingredientNames });
519
+ } else if (currentStep === 'post_cart') {
520
+ currentStep = 'food_type';
521
+ conversation.push({ role: 'bot', message: 'What type of food would you prefer?' });
522
+ console.log('Step changed to food_type after post_cart. Conversation updated.');
523
+ } else {
524
+ console.error('Unexpected currentStep value:', currentStep);
525
+ }
526
+
527
+ // After going back to 'select_ingredients', trigger the fetchIngredients again
528
+ if (currentStep === 'select_ingredients') {
529
+ const lastMessage = conversation[conversation.length - 1].message.toLowerCase();
530
+ if (lastMessage.includes('vegetarian')) {
531
+ console.log('Fetching vegetarian ingredients again after back.');
532
+ fetchIngredients('vegetarian');
533
+ } else if (lastMessage.includes('non-vegetarian')) {
534
+ console.log('Fetching non-vegetarian ingredients again after back.');
535
+ fetchIngredients('non-vegetarian');
536
+ }
537
+ }
538
+
539
+ // Ensure the bot message is updated according to the previous step
540
+ setTimeout(() => handleResponse(conversation[conversation.length - 1].message), 500);
541
  }
 
 
 
 
 
542
 
543
 
544
  function handleYesResponse() {