-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
20 lines (16 loc) · 709 Bytes
/
Copy pathmain.py
File metadata and controls
20 lines (16 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from logic import generate_response, log_conversation, user_memory
print(f"Chatbot: Hello! My name is {user_memory['bot_name']}, the terminal chatbot! Ask me anything. Type 'bye' to exit.")
while True:
user_input = input("You: ")
if user_input.lower() in ["bye", "exit", "quit"]:
farewell = "Goodbye!"
if "name" in user_memory:
farewell = f"Goodbye, {user_memory['name']}!"
print(f"Chatbot: {farewell}")
log_conversation("You", user_input)
log_conversation("Bot", farewell)
break
response = generate_response(user_input)
print(f"Chatbot: {response}")
log_conversation("You", user_input)
log_conversation("Bot", response)