Fixed merge conflict

This commit is contained in:
karoel2 2022-06-15 09:21:42 +02:00
parent c5cbfebcef
commit c2a9619ac7
3 changed files with 65 additions and 41 deletions

View File

@ -56,6 +56,11 @@ howmany = ["Ile ostatnich elemntów chcesz zobaczyć?", "Ile ostatnich elmentów
error_time = ["Podano nie prawidłowy czas, popraw ramy czasowe", "Czas jest nie prawidłowy, podaj ponownie", "Podaj przedział czasowy jeszcze raz"]
error_repo = ["Podano nieprawidłową nazwę repozytorium", "Podaj ponownie nazwę repozytorium, ponieważ podania nie prawidłową"]
def find(args, key):
for item in args:
if item[0] == key:
return item
def generator_jezyka_nautalnego(frame, tactic, state, text):
if tactic == 'null':
@ -64,41 +69,54 @@ def generator_jezyka_nautalnego(frame, tactic, state, text):
if len(beastMatch) > 0:
print(random.choice(other) + ', '.join(beastMatch))
elif tactic[1] == 'help':
elif tactic[0] == False: #ASK
_, required_empty, act, req_args, opt_args = tactic
print('DEBUG: ', act, req_args, opt_args,sep = '\n')
print(f'Proszę podaj {required_empty[0]}')
print()
elif tactic[0] == True:
_, act, req_args, opt_args = tactic
print('DEBUG: ', act, req_args, opt_args,sep = '\n')
if act == 'help':
print(random.choice(help))
print("Dostępne komendy: \n - " + '\n - '.join(commands))
elif tactic == 'bye':
elif act == 'bye':
print(random.choice(bye))
print()
sys.exit(0)
elif tactic[0] == 'ANSWER' and tactic[1] == 'issues':
print("Lista issues w repozytorium " + tactic[2][0][1] + ":")
issues = listRepositoryIssues(tactic[2][0][1])
elif tactic == 'hello':
print(random.choice(welcome))
elif act == 'issues':
print("Lista issues w repozytorium " + find(req_args, repo) + ":")
issues = listRepositoryIssues(find(req_args, repo))
for issue in issues:
print(issue['name'])
print(issue['description'])
print(issue['status'])
print()
elif tactic[0] == 'ANSWER' and tactic[1] == 'pullrequest':
print("Lista pull requestów w repozytorium " + tactic[2][0][1] + ":")
prs = listRepositoryPullRequests(tactic[2][0][1])
elif act == 'pullrequest':
print("Lista pull requestów w repozytorium " + find(req_args, repo) + ":")
prs = listRepositoryPullRequests(find(req_args, repo))
for pr in prs:
print(pr['name'])
print(pr['description'])
print(pr['state'])
print()
elif tactic == 'hello':
print(random.choice(welcome))
elif tactic[0] == 'QUESTION' and tactic[1][0] == 'repo':
print("Dodaj nazwę repozytorium na końcu komendy")
print("np. w nazwarepozytorium")
#
# elif tactic[0] == 'QUESTION' and act[0] == 'repo':
# print("Dodaj nazwę repozytorium na końcu komendy")
# print("np. w nazwarepozytorium")
else:
print(tactic)
else:
print('ERROR')
print()

View File

@ -12,6 +12,10 @@ dialogue_state = {
'counter': 0
}
def add_fact(key, value):
global dialogue_state
dialogue_state['facts'][key] = value
def monitor_stanu_dialogowego(frame):
not_pivot_acts = ['time',

View File

@ -1,4 +1,5 @@
from apimock import *
from monitor_stanu_dialogowego import add_fact
gramar_slots = {
'pullrequest': (('action', 'optional'),
@ -68,7 +69,7 @@ def long_thread(state):
opt_args = add_facts(opt_args, facts)
required_empty = check_req(req_args)
if required_empty:
return False, required_empty[0] #slot do uzupełnienia
return False, required_empty[0], act, req_args, opt_args #slot do uzupełnienia
return True, act, req_args, opt_args #wyświetl użytkownikowi
def check_req(req_args):
@ -81,12 +82,13 @@ def check_req(req_args):
def add_facts(args, facts):
for key, value in facts.items():
for idx, item in enumerate(args):
if key == item[0] and value != None and item[1] == None:
if key == item[0]:
if value != None and item[1] == None:
args[idx] = value
if key == 'repo':
validate_repo(value)
if value == None and item[1] != None:
add_fact(key, item[1])
return args
def agregate(grammar, slots):