mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 19:54:44 -07:00
shorten sillytavern code, reduce npm install spam
This commit is contained in:
parent
5e62210ec1
commit
336b1755bc
3 changed files with 19 additions and 29 deletions
|
|
@ -58,7 +58,7 @@
|
||||||
"rehype-raw": "^7.0.0",
|
"rehype-raw": "^7.0.0",
|
||||||
"rehype-sanitize": "^6.0.0",
|
"rehype-sanitize": "^6.0.0",
|
||||||
"remark-gfm": "^4.0.1",
|
"remark-gfm": "^4.0.1",
|
||||||
"systeminformation": "^5.27.16",
|
"systeminformation": "^5.27.17",
|
||||||
"winston": "^3.19.0",
|
"winston": "^3.19.0",
|
||||||
"winston-daily-rotate-file": "^5.0.0",
|
"winston-daily-rotate-file": "^5.0.0",
|
||||||
"yauzl": "^3.2.0",
|
"yauzl": "^3.2.0",
|
||||||
|
|
|
||||||
|
|
@ -32,26 +32,16 @@ on('SIGTERM', () => {
|
||||||
void stopFrontend();
|
void stopFrontend();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getSillyTavernDataDir() {
|
const getSillyTavernDataDir = () => join(getInstallDir(), 'sillytavern-data');
|
||||||
return join(getInstallDir(), 'sillytavern-data');
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSillyTavernInstallDir() {
|
const getSillyTavernInstallDir = () =>
|
||||||
return join(getInstallDir(), 'sillytavern-server');
|
join(getInstallDir(), 'sillytavern-server');
|
||||||
}
|
|
||||||
|
|
||||||
function getSillyTavernServerPath() {
|
const getSillyTavernServerPath = () =>
|
||||||
return join(
|
join(getSillyTavernInstallDir(), 'node_modules', 'sillytavern', 'server.js');
|
||||||
getSillyTavernInstallDir(),
|
|
||||||
'node_modules',
|
|
||||||
'sillytavern',
|
|
||||||
'server.js'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSillyTavernSettingsPath() {
|
const getSillyTavernSettingsPath = () =>
|
||||||
return join(getSillyTavernDataDir(), 'default-user', 'settings.json');
|
join(getSillyTavernDataDir(), 'default-user', 'settings.json');
|
||||||
}
|
|
||||||
|
|
||||||
async function ensureSillyTavernInstalled() {
|
async function ensureSillyTavernInstalled() {
|
||||||
const serverPath = getSillyTavernServerPath();
|
const serverPath = getSillyTavernServerPath();
|
||||||
|
|
@ -101,6 +91,7 @@ async function ensureSillyTavernInstalled() {
|
||||||
installDir,
|
installDir,
|
||||||
'--no-save',
|
'--no-save',
|
||||||
'--install-strategy=nested',
|
'--install-strategy=nested',
|
||||||
|
'--silent',
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
stdio: ['pipe', 'pipe', 'pipe'],
|
stdio: ['pipe', 'pipe', 'pipe'],
|
||||||
|
|
@ -109,15 +100,11 @@ async function ensureSillyTavernInstalled() {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (npmProcess.stdout) {
|
let errorOutput = '';
|
||||||
npmProcess.stdout.on('data', (data: Buffer) => {
|
|
||||||
sendKoboldOutput(data.toString().trim());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (npmProcess.stderr) {
|
if (npmProcess.stderr) {
|
||||||
npmProcess.stderr.on('data', (data: Buffer) => {
|
npmProcess.stderr.on('data', (data: Buffer) => {
|
||||||
sendKoboldOutput(data.toString().trim());
|
errorOutput += data.toString();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,6 +113,9 @@ async function ensureSillyTavernInstalled() {
|
||||||
sendKoboldOutput('SillyTavern is ready');
|
sendKoboldOutput('SillyTavern is ready');
|
||||||
resolve();
|
resolve();
|
||||||
} else {
|
} else {
|
||||||
|
if (errorOutput) {
|
||||||
|
sendKoboldOutput(`npm install error: ${errorOutput.trim()}`);
|
||||||
|
}
|
||||||
reject(new Error(`npm install failed with code ${code}`));
|
reject(new Error(`npm install failed with code ${code}`));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
10
yarn.lock
10
yarn.lock
|
|
@ -4165,7 +4165,7 @@ __metadata:
|
||||||
rehype-sanitize: "npm:^6.0.0"
|
rehype-sanitize: "npm:^6.0.0"
|
||||||
remark-gfm: "npm:^4.0.1"
|
remark-gfm: "npm:^4.0.1"
|
||||||
rollup-plugin-visualizer: "npm:^6.0.5"
|
rollup-plugin-visualizer: "npm:^6.0.5"
|
||||||
systeminformation: "npm:^5.27.16"
|
systeminformation: "npm:^5.27.17"
|
||||||
typescript: "npm:^5.9.3"
|
typescript: "npm:^5.9.3"
|
||||||
vite: "npm:^7.3.0"
|
vite: "npm:^7.3.0"
|
||||||
winston: "npm:^3.19.0"
|
winston: "npm:^3.19.0"
|
||||||
|
|
@ -7840,12 +7840,12 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"systeminformation@npm:^5.27.16":
|
"systeminformation@npm:^5.27.17":
|
||||||
version: 5.27.16
|
version: 5.27.17
|
||||||
resolution: "systeminformation@npm:5.27.16"
|
resolution: "systeminformation@npm:5.27.17"
|
||||||
bin:
|
bin:
|
||||||
systeminformation: lib/cli.js
|
systeminformation: lib/cli.js
|
||||||
checksum: 10c0/2fc5fe3d081aeafff02ab89fa516df47559f15d017790f018208f75926e402df7f6e383c1a1716429093558545d4c8d57dd8fc2cf9aa568c4edc2f8e2dd0423f
|
checksum: 10c0/5cb508a0789d005d6d2f9084ff2567a078039c38723ac95a4ba2657f7808ee564d34c2d17bd67fe7747b820b375f837628c928a4a39b1702bf173072a48c74c6
|
||||||
conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android)
|
conditions: (os=darwin | os=linux | os=win32 | os=freebsd | os=openbsd | os=netbsd | os=sunos | os=android)
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue