Dialogue loop
This commit is contained in:
parent
4b1c33bf98
commit
6598a84e48
@ -42,8 +42,9 @@ class Model:
|
||||
self.dp = DP(self.state)
|
||||
self.nlg = NLG(self.state)
|
||||
|
||||
def __call__(self, prompt) -> Any:
|
||||
print(prompt)
|
||||
def __call__(self, prompt, debug=True) -> Any:
|
||||
if debug:
|
||||
print(prompt)
|
||||
msg = prompt.lower()
|
||||
|
||||
r = self.nlu(msg)
|
||||
@ -54,7 +55,10 @@ class Model:
|
||||
r = self.dp()
|
||||
#print(r)
|
||||
r = self.nlg(r, slots)
|
||||
print(r)
|
||||
if debug:
|
||||
print(r)
|
||||
else:
|
||||
print(f"JARVIS: {r}")
|
||||
|
||||
return r
|
||||
|
||||
@ -253,8 +257,7 @@ class NLG():
|
||||
elif act == "offer":
|
||||
return "Proszę oto menu zeskanuj kod QR aby je zobaczyć."
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def dialogue_test():
|
||||
model = Model()
|
||||
|
||||
# jezeli sie przywita to przywitaj uzytkownika (i pokaz menu)
|
||||
@ -320,4 +323,12 @@ if __name__ == "__main__":
|
||||
response = model("Zapłacę kartą przy odbiorze")
|
||||
print()
|
||||
response = model("Dobrze, nie mogę się już doczekać.")
|
||||
print()
|
||||
print()
|
||||
|
||||
if __name__ == "__main__":
|
||||
model = Model()
|
||||
print("Chatbot Jarvis\n--------------")
|
||||
while True:
|
||||
print("\nUżytkownik: ")
|
||||
user_input = input()
|
||||
response = model(user_input, debug=False)
|
Loading…
Reference in New Issue
Block a user