Skip to content
This repository was archived by the owner on Aug 10, 2023. It is now read-only.

Commit d5daf76

Browse files
author
Antonio Cheong
committed
Multiline input
1 parent 9334838 commit d5daf76

5 files changed

Lines changed: 22 additions & 93 deletions

File tree

ChatGPT.example.py

Lines changed: 0 additions & 12 deletions
This file was deleted.

prompts.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

revChatGPT.py

Lines changed: 0 additions & 74 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from setuptools import setup, find_packages
22
setup(
33
name = "revChatGPT",
4-
version = "0.0.8",
4+
version = "0.0.9",
55
license = "GNU General Public License v2.0",
66
author = "Antonio Cheong",
77
author_email = "acheong@student.dalat.org",

src/revChatGPT/__main__.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
1-
from revChatGPT import Chatbot
1+
from revChatGPT.revChatGPT import Chatbot
2+
import json
3+
4+
def get_input(prompt):
5+
# prompt for input
6+
lines = []
7+
print(prompt,end="")
8+
while True:
9+
line = input()
10+
if line == "":
11+
break
12+
lines.append(line)
13+
14+
# Join the lines, separated by newlines, and print the result
15+
user_input = "\n".join(lines)
16+
#print(user_input)
17+
return user_input
18+
219
if __name__ == "__main__":
320
print("""
421
ChatGPT - A simple chatbot using OpenAI's GPT-3 API
522
By: github.com/acheong08
623
""")
724
print("Type '!exit' to exit")
25+
print("Press enter twice to submit your question.\n")
826
with open("config.json", "r") as f:
927
config = json.load(f)
1028
chatbot = Chatbot(config)
1129
while True:
12-
prompt = input("You: ")
30+
prompt = get_input("You: ")
1331
if prompt == "!exit":
1432
break
1533
try:
34+
print("Please wait for ChatGPT to formulate its full response...")
1635
response = chatbot.get_chat_response(prompt)
1736
except Exception as e:
1837
print("Something went wrong!")

0 commit comments

Comments
 (0)