Meeting list functionality connected to DB

This commit is contained in:
Piotr Kopycki 2021-06-15 09:25:48 +02:00
parent 6e4e1271c4
commit af98dabec7

View File

@ -13,7 +13,7 @@ class NLG:
self.DST = dst self.DST = dst
def generateResponse(self, systemAct: SystemAct) -> str: def generateResponse(self, systemAct: SystemAct) -> str:
dialogue_state, last_user_act, _ = self.DST.get_dialogue_state() dialogue_state, _, last_system_act = self.DST.get_dialogue_state()
slots = self.DST.get_dialogue_slots() slots = self.DST.get_dialogue_slots()
if dialogue_state == UserActType.CREATE_MEETING: if dialogue_state == UserActType.CREATE_MEETING:
if systemAct.getActType() == SystemActType.REQUEST: if systemAct.getActType() == SystemActType.REQUEST:
@ -33,10 +33,13 @@ class NLG:
place = slots['place'] place = slots['place']
part_list = slots['participants'] part_list = slots['participants']
part = "" part = ""
for p in part_list: if part_list is None:
part += p part = None
part += ", " else:
part = part[:-2] for p in part_list:
part += p
part += ", "
part = part[:-2]
desc = slots['description'] desc = slots['description']
return f'Czy mam dodać te spotkanie do kalendarza?\n' \ return f'Czy mam dodać te spotkanie do kalendarza?\n' \
f'Dzień: {date}\nCzas: {time}\nMiejsce: {place}\nUczestnicy: {part}\nOpis: {desc}' f'Dzień: {date}\nCzas: {time}\nMiejsce: {place}\nUczestnicy: {part}\nOpis: {desc}'
@ -55,10 +58,13 @@ class NLG:
place = slots['place'] place = slots['place']
part_list = slots['participants'] part_list = slots['participants']
part = "" part = ""
for p in part_list: if part_list is None:
part += p part = None
part += ", " else:
part = part[:-2] for p in part_list:
part += p
part += ", "
part = part[:-2]
desc = slots['description'] desc = slots['description']
return f'Spotkanie:\n' \ return f'Spotkanie:\n' \
f'Dzień: {date}\nCzas: {time}\nMiejsce: {place}\nUczestnicy: {part}\nOpis: {desc}' f'Dzień: {date}\nCzas: {time}\nMiejsce: {place}\nUczestnicy: {part}\nOpis: {desc}'
@ -89,18 +95,21 @@ class NLG:
return "Z jakiego okresu chcesz przejrzeć spotkania?" return "Z jakiego okresu chcesz przejrzeć spotkania?"
if systemAct.getActType() == SystemActType.MEETING_LIST: if systemAct.getActType() == SystemActType.MEETING_LIST:
response = "" response = ""
for s in slots: for s in last_system_act.getActParams():
date = s['date'] date = s['date']
time = s['time'] time = s['time']
place = s['place'] place = s['place']
part_list = s['participants'] part_list = s['participants']
part = "" part = ""
for p in part_list: if part_list is None:
part += p part = None
part += ", " else:
part = part[:-2] for p in part_list:
part += p
part += ", "
part = part[:-2]
desc = s['description'] desc = s['description']
response += f'Spotkanie:\nDzień: {date}\nCzas: {time}\nMiejsce: {place}\nUczestnicy: {part}\nOpis: {desc}\n' response += f'\nSpotkanie:\nDzień: {date}\nCzas: {time}\nMiejsce: {place}\nUczestnicy: {part}\nOpis: {desc}\n'
response += "--------------------" response += "--------------------"
self.DST.clear_slots() self.DST.clear_slots()
return response return response