Usunięcie sprawdzania poprawności zamówienia

This commit is contained in:
Patryk Osiński 2024-06-10 00:46:52 +02:00
parent abc098e498
commit 3d820e8d6d
2 changed files with 0 additions and 19 deletions

View File

@ -29,27 +29,10 @@ class DialogStateMonitor:
{'completed': False, 'name': 'collect_address'},
],
was_previous_order_invalid=False,
constraints={
'order': [
'sauce',
'pizza',
],
},
constants=constants,
history=[])
self.state = copy.deepcopy(self.__initial_state)
def get_last_order_missing_fields(self) -> list[str]:
result = []
try:
last_order = self.state['belief_state']['order'][-1]
except IndexError:
raise RuntimeError('No orders are placed')
for constraint in self.state['constraints']['order']:
if constraint not in last_order:
result.append(constraint)
return result
def get_current_active_stage(self) -> str | None:
for stage in self.state['stages']:
if stage['completed'] is False:

View File

@ -9,11 +9,9 @@ assert dsm.state['was_previous_order_invalid'] is False
frame1 = Frame('user', 'inform/order', [Slot('pizza', 'margarita'), Slot('sauce', 'ketchup')])
dsm.update(frame1)
assert dsm.get_last_order_missing_fields() == []
assert dsm.get_total_cost() == 20
frame2 = Frame('user', 'inform/order', [Slot('pizza', 'tuna')])
dsm.update(frame2)
assert dsm.get_last_order_missing_fields() == ['sauce']
assert dsm.get_total_cost() == 60
frame3 = Frame('user', 'inform/order-complete', [])
dsm.update(frame3)