2022-06-08 12:09:36 +02:00
|
|
|
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': (
|
|
|
|
),
|
|
|
|
}
|
|
|
|
|
2022-04-19 23:22:44 +02:00
|
|
|
|
2022-06-08 10:23:01 +02:00
|
|
|
def taktyka_dialogu(state, frame):
|
2022-06-08 12:09:36 +02:00
|
|
|
if frame['act'] == 'null':
|
|
|
|
print("Nie rozumiem :/")
|
|
|
|
return 'null'
|
2022-06-08 10:23:01 +02:00
|
|
|
if state['current_context'] in ['hello', 'pomoc', 'bye']:
|
|
|
|
return short_thread(state)
|
|
|
|
else:
|
|
|
|
return long_thread(state)
|
2022-04-19 23:22:44 +02:00
|
|
|
|
2022-06-08 10:23:01 +02:00
|
|
|
def short_thread(state):
|
|
|
|
if state['current_context'] == 'pomoc':
|
2022-06-08 12:09:36 +02:00
|
|
|
print(state['current_context'])
|
2022-06-08 10:23:01 +02:00
|
|
|
pass
|
|
|
|
#TODO
|
|
|
|
else:
|
2022-06-08 12:09:36 +02:00
|
|
|
print(state['current_context'])
|
2022-06-08 10:23:01 +02:00
|
|
|
return state['current_context']
|
2022-04-19 23:22:44 +02:00
|
|
|
|
2022-06-08 10:23:01 +02:00
|
|
|
def long_thread(state):
|
2022-06-08 12:09:36 +02:00
|
|
|
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'
|
|
|
|
|
|
|
|
|
2022-04-19 23:22:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-01 12:53:12 +02:00
|
|
|
|
2022-06-08 10:23:01 +02:00
|
|
|
#todo dodać mock github api
|