File size: 1,084 Bytes
503f7bf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import requests
import sys
chat_history = []
max_chat_history = 8
url = sys.argv[1]
system_prompt = sys.argv[2]
def respond(prompt):
prompt = prompt.strip()
global chat_history
chat_history=chat_history[-max_chat_history:]
if prompt=="clear conversation":
chat_history = []
return "Cleared Conversation."
else:
chat_history.append(prompt if len(chat_history) < 2 else "# User Instruction: " + prompt)
response = requests.post(url, json={
"data": [
system_prompt,
"\n".join(chat_history),
"",
"",
0.77,
0.9,
22,
192,
True,
0.0,
1.11,
"\n\n",
]
}).json()
data = response["data"][0]
chat_history.append("# You gave this response: " + data)
print()
return "(Aurora): " + data
username = input("Username: ")
while True:
print()
print(respond(input(f'({username}): '))) |