Merge pull request #1148 from city-unit/patch/collab

Fix collab to generate an api key
This commit is contained in:
RossAscends 2023-09-18 13:23:48 +09:00 committed by GitHub
commit 1189734c62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -73,6 +73,7 @@
"#@markdown Enables ChromaDB for Infinity Context plugin\n",
"\n",
"import subprocess\n",
"import secrets\n",
"\n",
"# ---\n",
"# SillyTavern extras\n",
@ -130,6 +131,13 @@
"!wget https://github.com/cloudflare/cloudflared/releases/download/2023.5.0/cloudflared-linux-amd64 -O /tmp/cloudflared-linux-amd64\n",
"!chmod +x /tmp/cloudflared-linux-amd64\n",
"\n",
"# Generate a random API key\n",
"api_key = secrets.token_hex(5)\n",
"\n",
"# Write the API key to api_key.txt\n",
"with open('./api_key.txt', 'w') as f:\n",
" f.write(api_key)\n",
"print(f\"API Key generated: {api_key}\")\n",
"\n",
"cmd = f\"python server.py {' '.join(params)}\"\n",
"print(cmd)\n",