This commit is contained in:
s495727 2024-06-13 15:30:23 +02:00
parent 10fc617cad
commit 4ce52466a2
2 changed files with 34 additions and 2 deletions

View File

@ -35,7 +35,13 @@ class DialogStateMonitor:
total_cost=0,
stages=[
{'completed': False, 'name': 'collect_food', "confirmed": False},
<<<<<<< Updated upstream
{'completed': False, 'name': 'collect_drinks', "confirmed": False},
=======
{'completed': False, 'name': 'more_food', "confirmed": False},
{'completed': False, 'name': 'collect_drinks', "confirmed": False},
{'completed': False, 'name': 'more_drinks', "confirmed": False},
>>>>>>> Stashed changes
{'completed': False, 'name': 'collect_address', "confirmed": False},
{'completed': False, 'name': 'collect_phone', "confirmed": False},
],
@ -56,6 +62,7 @@ class DialogStateMonitor:
def mark_current_stage_completed(self) -> None:
for stage in self.state['stages']:
<<<<<<< Updated upstream
if stage['completed'] is False: # and stage['confirmed']:
print("Stage completed: ", stage['name'])
stage['completed'] = True
@ -81,6 +88,33 @@ class DialogStateMonitor:
return
stage['completed'] = True
return
=======
if stage['completed'] is False:
print("Stage completed: ", stage['name'])
stage['completed'] = True
return
def complete_stage_if_valid(self, stage_name):
for stage in self.state['stages']:
if stage['name'] != stage_name:
continue
if stage['name'] == "collect_food":
for order in self.state['belief_state']['order']:
if order.get("pizza"):
stage['completed'] = True
return
elif stage["name"] == "collect_drinks":
for order in self.state['belief_state']['order']:
if order.get("drink"):
stage['completed'] = True
return
elif stage["name"] == "collect_address":
if not len(self.state['belief_state']['address']):
return
stage['completed'] = True
return
>>>>>>> Stashed changes
elif stage["name"] == "collect_phone":
if self.state['belief_state']["phone"].get("phone"):
stage['completed'] = True

View File

@ -39,8 +39,6 @@ def generate_ingredients_response(slots):
def generate_drinks_response(slots):
drinks = [slot['value'] for slot in slots if slot['name'] == 'drink']
print(slots)
print(drinks)
if drinks:
drink_details = []
for drink in drinks: