From 41f41cc692e90dbec45d68127e01356bdee78d88 Mon Sep 17 00:00:00 2001 From: s495724 Date: Wed, 12 Jun 2024 16:02:39 +0200 Subject: [PATCH] Update src/main.py --- src/main.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main.py b/src/main.py index f0954ac..1a7aaad 100644 --- a/src/main.py +++ b/src/main.py @@ -10,6 +10,12 @@ monitor = DialogStateMonitor() # DSM dialog_policy = DialogPolicy() # DP language_generation = NaturalLanguageGeneration(templates) # NLG +def frame_to_dict(frame): + return { + "act": frame.act, + "slots": [{"name": slot.name, "value": slot.value} for slot in frame.slots] + } + # Main loop dial_num = 0 @@ -17,8 +23,8 @@ print("CTRL+C aby zakończyć program.") while True: monitor.reset() - print(f"\n==== Rozpoczynasz rozmowę nr {dial_num} ====\n") - user_input = input("Możesz zacząć pisać.\n") +# print(f"\n==== Rozpoczynasz rozmowę nr {dial_num} ====\n") + user_input = input("Witamy w naszej pizzerii. W czym mogę pomóc?\n") while True: # NLU @@ -30,14 +36,15 @@ while True: # DP system_action = dialog_policy.predict(monitor) + system_action = frame_to_dict(system_action) # Ensure system_action is a dictionary print("System action: ", system_action) # NLG - act, slots = parse_frame(frame) - response = language_generation.generate(act, slots) + response = language_generation.generate(frame, system_action) print(response) if frame.act == "bye": break - user_input = input(">\n") \ No newline at end of file + user_input = input(">\n") +# dial_num += 1 \ No newline at end of file