gramar_slots = { # 'act': ((slot0, 'required'), # (slot1, 'optional') # ) 'pullrequest': (('action', 'optional'), ('repo', 'required') ), 'brefing': (('action', 'optional'), ('repo', 'required') ), 'notifications': (('liczba', 'optional'), # ('repo', 'required') ), 'tests': (('test', 'optional'), # ('repo', 'required') ), 'time': (('time_when', 'required'), ('timeunit', 'required') ), 'issues': ( ), } def taktyka_dialogu(state, frame): if frame['act'] == 'null': print("Nie rozumiem :/") return 'null' if state['current_context'] in ['hello', 'pomoc', 'bye']: return short_thread(state) else: return long_thread(state) def short_thread(state): if state['current_context'] == 'pomoc': print(state['current_context']) pass #TODO else: print(state['current_context']) return state['current_context'] def long_thread(state): act = state['current_context'] slots = [] for topic in state['topics']: if act == topic['act']: slots = topic['slots'] required = gramar_slots[act] for item in required: if item[1] == 'required': for slot in slots: if slot[0] == item[0] and slot[1] == '': if slot[0] == 'repo': state['facts']['repo'] == '' print('dopytaj') print(item[0]) elif slot[0] == 'time': state['facts']['time'] == '' print('dopytaj') print(item[0]) else: print('dopytaj') print(item[0]) #pokaz #powiedz, że może dopytać o... 'optional' #todo dodać mock github api