Spaces:
Running
Running
Bohaska
commited on
Commit
·
150da08
1
Parent(s):
ce20d7c
Standardize all puppet passwords to one single password
Browse files
app.py
CHANGED
|
@@ -545,22 +545,22 @@ import threading
|
|
| 545 |
|
| 546 |
USER_AGENT = os.environ.get("USER_AGENT")
|
| 547 |
print(os.environ["AI_NATIONS"])
|
| 548 |
-
print(os.environ["
|
| 549 |
print(os.environ["AI_PROMPTS"])
|
| 550 |
AI_NATIONS = json.loads(os.environ["AI_NATIONS"])
|
| 551 |
-
|
| 552 |
AI_PROMPTS = json.loads(os.environ["AI_PROMPTS"])
|
| 553 |
|
| 554 |
def get_ai_coroutines(
|
| 555 |
-
user_agent, compare_func,
|
| 556 |
):
|
| 557 |
ns_ai_coroutines = []
|
| 558 |
counter = 0
|
| 559 |
-
for index in range(len(
|
| 560 |
ns_ai_coroutines.append(
|
| 561 |
ns_ai_bot(
|
| 562 |
nations[index],
|
| 563 |
-
|
| 564 |
compare_func,
|
| 565 |
prompts[index],
|
| 566 |
user_agent,
|
|
@@ -573,7 +573,7 @@ def run_ai_coroutines():
|
|
| 573 |
print("Starting NationStates AI...")
|
| 574 |
loop = asyncio.new_event_loop()
|
| 575 |
asyncio.set_event_loop(loop)
|
| 576 |
-
ai_coroutines = get_ai_coroutines(USER_AGENT, embedding_compare,
|
| 577 |
results = loop.run_until_complete(asyncio.gather(*ai_coroutines))
|
| 578 |
print(f"NationStates AI finished (This should NOT happen, something went wrong if you see this)")
|
| 579 |
loop.close()
|
|
|
|
| 545 |
|
| 546 |
USER_AGENT = os.environ.get("USER_AGENT")
|
| 547 |
print(os.environ["AI_NATIONS"])
|
| 548 |
+
print(os.environ["AI_NATIONSTATES_PASSWORD"])
|
| 549 |
print(os.environ["AI_PROMPTS"])
|
| 550 |
AI_NATIONS = json.loads(os.environ["AI_NATIONS"])
|
| 551 |
+
AI_NATIONSTATES_PASSWORD = os.environ["AI_NATIONSTATES_PASSWORD"]
|
| 552 |
AI_PROMPTS = json.loads(os.environ["AI_PROMPTS"])
|
| 553 |
|
| 554 |
def get_ai_coroutines(
|
| 555 |
+
user_agent, compare_func, ns_password, nations, prompts
|
| 556 |
):
|
| 557 |
ns_ai_coroutines = []
|
| 558 |
counter = 0
|
| 559 |
+
for index in range(len(nations)):
|
| 560 |
ns_ai_coroutines.append(
|
| 561 |
ns_ai_bot(
|
| 562 |
nations[index],
|
| 563 |
+
ns_password,
|
| 564 |
compare_func,
|
| 565 |
prompts[index],
|
| 566 |
user_agent,
|
|
|
|
| 573 |
print("Starting NationStates AI...")
|
| 574 |
loop = asyncio.new_event_loop()
|
| 575 |
asyncio.set_event_loop(loop)
|
| 576 |
+
ai_coroutines = get_ai_coroutines(USER_AGENT, embedding_compare, AI_NATIONSTATES_PASSWORD, AI_NATIONS, AI_PROMPTS)
|
| 577 |
results = loop.run_until_complete(asyncio.gather(*ai_coroutines))
|
| 578 |
print(f"NationStates AI finished (This should NOT happen, something went wrong if you see this)")
|
| 579 |
loop.close()
|