Changed how the data is tokenised

This commit is contained in:
2026-05-17 12:47:22 +01:00
parent 0c28bc113d
commit 13049309b2
10 changed files with 303 additions and 164 deletions
+18 -11
View File
@@ -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)