mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Model for cross-module globals
This commit is contained in:
@ -245,9 +245,10 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"# ---\n",
|
"# ---\n",
|
||||||
"# TavernAI extras\n",
|
"# TavernAI extras\n",
|
||||||
"extras_url = '(disabled)'\n",
|
"import globals\n",
|
||||||
"params = []\n",
|
"globals.extras_url = '(disabled)'\n",
|
||||||
"params.append('--cpu')\n",
|
"globals.params = []\n",
|
||||||
|
"globals.params.append('--cpu')\n",
|
||||||
"ExtrasModules = []\n",
|
"ExtrasModules = []\n",
|
||||||
"\n",
|
"\n",
|
||||||
"if (extras_enable_captioning):\n",
|
"if (extras_enable_captioning):\n",
|
||||||
@ -257,10 +258,10 @@
|
|||||||
"if (extras_enable_emotions):\n",
|
"if (extras_enable_emotions):\n",
|
||||||
" ExtrasModules.append('classify')\n",
|
" ExtrasModules.append('classify')\n",
|
||||||
"\n",
|
"\n",
|
||||||
"params.append(f'--classification-model={Emotions_Model}')\n",
|
"globals.params.append(f'--classification-model={Emotions_Model}')\n",
|
||||||
"params.append(f'--summarization-model={Memory_Model}')\n",
|
"globals.params.append(f'--summarization-model={Memory_Model}')\n",
|
||||||
"params.append(f'--captioning-model={Captions_Model}')\n",
|
"globals.params.append(f'--captioning-model={Captions_Model}')\n",
|
||||||
"params.append(f'--enable-modules={\",\".join(ExtrasModules)}')\n",
|
"globals.params.append(f'--enable-modules={\",\".join(ExtrasModules)}')\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"if UseExtrasExtensions:\n",
|
"if UseExtrasExtensions:\n",
|
||||||
@ -315,7 +316,7 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"%env colaburl=$url\n",
|
"%env colaburl=$url\n",
|
||||||
"%env SILLY_TAVERN_PORT=5001\n",
|
"%env SILLY_TAVERN_PORT=5001\n",
|
||||||
"print(\"KoboldAI LINK:\", url, '###Extensions API LINK###', extras_url, \"###SillyTavern LINK###\", sep=\"\\n\")\n",
|
"print(\"KoboldAI LINK:\", url, '###Extensions API LINK###', globals.extras_url, \"###SillyTavern LINK###\", sep=\"\\n\")\n",
|
||||||
"p = subprocess.Popen([\"lt\", \"--port\", \"5001\"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n",
|
"p = subprocess.Popen([\"lt\", \"--port\", \"5001\"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n",
|
||||||
"print(p.stdout.readline().decode().strip())\n",
|
"print(p.stdout.readline().decode().strip())\n",
|
||||||
"!node server.js"
|
"!node server.js"
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import globals
|
||||||
|
|
||||||
def runServer():
|
def runServer():
|
||||||
global params
|
cmd = f"python server.py {' '.join(globals.params)}"
|
||||||
cmd = f"python server.py {' '.join(params)}"
|
|
||||||
print(cmd)
|
print(cmd)
|
||||||
extras_process = subprocess.Popen(
|
extras_process = subprocess.Popen(
|
||||||
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd='/TavernAI-extras', shell=True)
|
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd='/TavernAI-extras', shell=True)
|
||||||
@ -21,7 +20,6 @@ def runServer():
|
|||||||
|
|
||||||
|
|
||||||
def extractUrl():
|
def extractUrl():
|
||||||
global extras_url
|
|
||||||
subprocess.call(
|
subprocess.call(
|
||||||
'nohup lt --port 5100 > ./extras.out 2> ./extras.err &', shell=True)
|
'nohup lt --port 5100 > ./extras.out 2> ./extras.err &', shell=True)
|
||||||
print('Waiting for lt init...')
|
print('Waiting for lt init...')
|
||||||
@ -33,8 +31,8 @@ def extractUrl():
|
|||||||
for x in range(len(lines)):
|
for x in range(len(lines)):
|
||||||
if ('your url is: ' in lines[x]):
|
if ('your url is: ' in lines[x]):
|
||||||
print('TavernAI Extensions URL:')
|
print('TavernAI Extensions URL:')
|
||||||
extras_url = lines[x].split('your url is: ')[1]
|
globals.extras_url = lines[x].split('your url is: ')[1]
|
||||||
print(extras_url)
|
print(globals.extras_url)
|
||||||
break
|
break
|
||||||
if (os.path.getsize('./extras.err') > 0):
|
if (os.path.getsize('./extras.err') > 0):
|
||||||
with open('./extras.err', 'r') as f:
|
with open('./extras.err', 'r') as f:
|
||||||
|
2
colab/globals.py
Normal file
2
colab/globals.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
extras_url = '(disabled)'
|
||||||
|
params = []
|
Reference in New Issue
Block a user