mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 19:54:44 -07:00
more sillytavern integration fixes
This commit is contained in:
parent
6597d1f417
commit
c00b97a3f6
5 changed files with 39 additions and 38 deletions
|
|
@ -55,7 +55,7 @@
|
|||
"@eslint/js": "^9.34.0",
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/react": "^19.1.12",
|
||||
"@types/react-dom": "^19.1.8",
|
||||
"@types/react-dom": "^19.1.9",
|
||||
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
||||
"@typescript-eslint/parser": "^8.41.0",
|
||||
"@vitejs/plugin-react": "^5.0.2",
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export const ServerTab = ({
|
|||
justifyContent: 'center',
|
||||
}}
|
||||
>
|
||||
<Stack align="center" gap="md">
|
||||
<Stack align="center" gap="md" mt="xl">
|
||||
<Text c="dimmed" size="lg">
|
||||
Waiting for the KoboldCpp server to start...
|
||||
</Text>
|
||||
|
|
|
|||
|
|
@ -43,13 +43,18 @@ export class IPCHandlers {
|
|||
error?: string;
|
||||
}> {
|
||||
try {
|
||||
const finalArgs = [...args];
|
||||
const frontendPreference = (await this.configManager.get(
|
||||
'frontendPreference'
|
||||
)) as FrontendPreference | undefined;
|
||||
|
||||
if (frontendPreference !== 'koboldcpp' && !finalArgs.includes('--cli')) {
|
||||
finalArgs.push('--cli');
|
||||
}
|
||||
|
||||
if (frontendPreference === 'sillytavern') {
|
||||
try {
|
||||
await this.sillyTavernManager.startFrontend(args);
|
||||
await this.sillyTavernManager.startFrontend(finalArgs);
|
||||
} catch (error) {
|
||||
this.logManager.logError(
|
||||
'Failed to setup SillyTavern:',
|
||||
|
|
@ -58,7 +63,7 @@ export class IPCHandlers {
|
|||
}
|
||||
}
|
||||
|
||||
return await this.koboldManager.launchKoboldCpp(args);
|
||||
return await this.koboldManager.launchKoboldCpp(finalArgs);
|
||||
} catch (error) {
|
||||
this.logManager.logError('Error in enhanced launch:', error as Error);
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -77,6 +77,17 @@ export class SillyTavernManager {
|
|||
}
|
||||
}
|
||||
|
||||
private getSillyTavernBaseArgs(): string[] {
|
||||
return [
|
||||
'sillytavern',
|
||||
'--listen',
|
||||
'--browserLaunchEnabled',
|
||||
'false',
|
||||
'--securityOverride',
|
||||
'true',
|
||||
];
|
||||
}
|
||||
|
||||
async isNpxAvailable(): Promise<boolean> {
|
||||
try {
|
||||
const testProcess = spawn('npx', ['--version'], { stdio: 'pipe' });
|
||||
|
|
@ -114,7 +125,7 @@ export class SillyTavernManager {
|
|||
'SillyTavern settings not found, starting SillyTavern briefly to generate config...'
|
||||
);
|
||||
|
||||
const spawnArgs = ['sillytavern', '--browserLaunchEnabled', 'false'];
|
||||
const spawnArgs = this.getSillyTavernBaseArgs();
|
||||
|
||||
this.windowManager.sendKoboldOutput(
|
||||
`Running command: npx ${spawnArgs.join(' ')}`
|
||||
|
|
@ -143,7 +154,7 @@ export class SillyTavernManager {
|
|||
initProcess.kill('SIGTERM');
|
||||
}
|
||||
cleanupAndResolve();
|
||||
}, 20000);
|
||||
}, 90000);
|
||||
|
||||
initProcess.on('exit', (code: number | null, signal: string | null) => {
|
||||
clearTimeout(timeout);
|
||||
|
|
@ -156,6 +167,7 @@ export class SillyTavernManager {
|
|||
|
||||
initProcess.on('error', (error) => {
|
||||
clearTimeout(timeout);
|
||||
|
||||
if (!hasResolved) {
|
||||
hasResolved = true;
|
||||
this.logManager.logError(
|
||||
|
|
@ -172,9 +184,7 @@ export class SillyTavernManager {
|
|||
if (initProcess.stdout) {
|
||||
initProcess.stdout.on('data', (data: Buffer) => {
|
||||
const output = data.toString();
|
||||
this.windowManager.sendKoboldOutput(
|
||||
`[SillyTavern stdout]: ${output.trim()}`
|
||||
);
|
||||
|
||||
if (output.includes('SillyTavern is listening')) {
|
||||
setTimeout(() => {
|
||||
if (!initProcess.killed && !hasResolved) {
|
||||
|
|
@ -189,21 +199,17 @@ export class SillyTavernManager {
|
|||
if (initProcess.stderr) {
|
||||
initProcess.stderr.on('data', (data: Buffer) => {
|
||||
const output = data.toString();
|
||||
this.windowManager.sendKoboldOutput(
|
||||
`[SillyTavern stderr]: ${output.trim()}`
|
||||
);
|
||||
this.windowManager.sendKoboldOutput(output.trim());
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (!initProcess.killed && !hasResolved) {
|
||||
this.windowManager.sendKoboldOutput(
|
||||
'SillyTavern initialization taking longer than expected, proceeding...'
|
||||
'SillyTavern initialization taking longer than expected, please wait...'
|
||||
);
|
||||
initProcess.kill('SIGTERM');
|
||||
cleanupAndResolve();
|
||||
}
|
||||
}, 10000);
|
||||
}, 30000);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -329,17 +335,13 @@ export class SillyTavernManager {
|
|||
});
|
||||
}
|
||||
|
||||
getDefaultSillyTavernConfig(): SillyTavernConfig {
|
||||
return {
|
||||
async startFrontend(args: string[]): Promise<void> {
|
||||
try {
|
||||
const config = {
|
||||
name: 'sillytavern',
|
||||
port: SILLYTAVERN.PORT,
|
||||
proxyPort: SILLYTAVERN.PROXY_PORT,
|
||||
};
|
||||
}
|
||||
|
||||
async startFrontend(args: string[]): Promise<void> {
|
||||
try {
|
||||
const config = this.getDefaultSillyTavernConfig();
|
||||
const { host: koboldHost, port: koboldPort } =
|
||||
this.parseKoboldConfig(args);
|
||||
|
||||
|
|
@ -357,14 +359,9 @@ export class SillyTavernManager {
|
|||
);
|
||||
|
||||
const sillyTavernArgs = [
|
||||
'sillytavern',
|
||||
...this.getSillyTavernBaseArgs(),
|
||||
'--port',
|
||||
config.port.toString(),
|
||||
'--listen',
|
||||
'--browserLaunchEnabled',
|
||||
'false',
|
||||
'--dataRoot',
|
||||
this.getSillyTavernSettingsPath().replace('/settings.json', ''),
|
||||
];
|
||||
|
||||
this.sillyTavernProcess = spawn('npx', sillyTavernArgs, {
|
||||
|
|
@ -381,8 +378,7 @@ export class SillyTavernManager {
|
|||
|
||||
if (this.sillyTavernProcess.stderr) {
|
||||
this.sillyTavernProcess.stderr.on('data', (data: Buffer) => {
|
||||
const output = data.toString();
|
||||
this.windowManager.sendKoboldOutput(output, true);
|
||||
this.windowManager.sendKoboldOutput(data.toString(), true);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
10
yarn.lock
10
yarn.lock
|
|
@ -1324,12 +1324,12 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/react-dom@npm:^19.1.8":
|
||||
version: 19.1.8
|
||||
resolution: "@types/react-dom@npm:19.1.8"
|
||||
"@types/react-dom@npm:^19.1.9":
|
||||
version: 19.1.9
|
||||
resolution: "@types/react-dom@npm:19.1.9"
|
||||
peerDependencies:
|
||||
"@types/react": ^19.0.0
|
||||
checksum: 10c0/561f9679c99e93adba8ecdf7d5ad69cc9d5e35837fa996246a83713f0ce498fc5b871f9a2a3342c7d440fc02159abe10f29c4a4004527d5d38b2e84f21840793
|
||||
checksum: 10c0/34c8dda86c1590b3ef0e7ecd38f9663a66ba2dd69113ba74fb0adc36b83bbfb8c94c1487a2505282a5f7e5e000d2ebf36f4c0fd41b3b672f5178fd1d4f1f8f58
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
|
@ -3603,7 +3603,7 @@ __metadata:
|
|||
"@mantine/hooks": "npm:^8.2.7"
|
||||
"@types/node": "npm:^24.3.0"
|
||||
"@types/react": "npm:^19.1.12"
|
||||
"@types/react-dom": "npm:^19.1.8"
|
||||
"@types/react-dom": "npm:^19.1.9"
|
||||
"@typescript-eslint/eslint-plugin": "npm:^8.41.0"
|
||||
"@typescript-eslint/parser": "npm:^8.41.0"
|
||||
"@vitejs/plugin-react": "npm:^5.0.2"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue