Changed how the data is tokenised
This commit is contained in:
+18
-11
@@ -1,23 +1,30 @@
|
||||
import requests
|
||||
import os
|
||||
import time
|
||||
|
||||
# Loop and get new api
|
||||
def main():
|
||||
response = {}
|
||||
id = -1
|
||||
while True:
|
||||
try:
|
||||
response = api_get()
|
||||
print(response)
|
||||
match response["action_type"]:
|
||||
case "output":
|
||||
character = get_character(response["character"])
|
||||
output(character, response["content"])
|
||||
case "choice":
|
||||
user_choice = choice(response["choices"])
|
||||
continue
|
||||
case "end":
|
||||
print("Exitting successfully")
|
||||
os._exit(0)
|
||||
if response["id"] != id:
|
||||
id = response["id"]
|
||||
print(response)
|
||||
match response["action_type"]:
|
||||
case "output":
|
||||
character = get_character(response["character"])
|
||||
output(character, response["content"])
|
||||
case "choice":
|
||||
user_choice = choice(response["choices"])
|
||||
time.sleep(0.5)
|
||||
continue
|
||||
case "end":
|
||||
print("Exitting successfully")
|
||||
os._exit(0)
|
||||
else:
|
||||
continue
|
||||
except:
|
||||
print("Server not up or cannot be reached")
|
||||
input() # Enter to go to next loop (testing)
|
||||
|
||||
Reference in New Issue
Block a user