fixing sillytavern launch bugs

This commit is contained in:
lone-cloud 2025-08-28 02:39:01 -07:00
parent ced24dbe1f
commit 895739f12e
3 changed files with 30 additions and 18 deletions

View file

@ -12,12 +12,17 @@ import { UI } from '@/constants';
import { handleTerminalOutput } from '@/utils/terminal'; import { handleTerminalOutput } from '@/utils/terminal';
import { processTerminalContent } from '@/utils/linkifyTerminal'; import { processTerminalContent } from '@/utils/linkifyTerminal';
import { useLaunchConfigStore } from '@/stores/launchConfigStore'; import { useLaunchConfigStore } from '@/stores/launchConfigStore';
import type { FrontendPreference } from '@/types';
interface TerminalTabProps { interface TerminalTabProps {
onServerReady: (url: string) => void; onServerReady: (url: string) => void;
frontendPreference?: FrontendPreference;
} }
export const TerminalTab = ({ onServerReady }: TerminalTabProps) => { export const TerminalTab = ({
onServerReady,
frontendPreference = 'koboldcpp',
}: TerminalTabProps) => {
const { host, port } = useLaunchConfigStore(); const { host, port } = useLaunchConfigStore();
const computedColorScheme = useComputedColorScheme('light', { const computedColorScheme = useComputedColorScheme('light', {
getInitialValueInEffect: false, getInitialValueInEffect: false,
@ -61,18 +66,23 @@ export const TerminalTab = ({ onServerReady }: TerminalTabProps) => {
const newData = data.toString(); const newData = data.toString();
if (onServerReady) { if (onServerReady) {
if ( const serverHost = host || 'localhost';
newData.includes('Please connect to custom endpoint at') || const serverPort = port || 5001;
newData.includes(
'Now running KoboldCpp in Interactive Terminal Chat mode' if (frontendPreference === 'sillytavern') {
) if (newData.includes('SillyTavern is listening on')) {
) { setTimeout(
const serverHost = host || 'localhost'; () => onServerReady(`http://${serverHost}:${serverPort}`),
const serverPort = port || 5001; 1500
setTimeout( );
() => onServerReady(`http://${serverHost}:${serverPort}`), }
1500 } else {
); if (newData.includes('Please connect to custom endpoint at')) {
setTimeout(
() => onServerReady(`http://${serverHost}:${serverPort}`),
1500
);
}
} }
} }
@ -81,7 +91,7 @@ export const TerminalTab = ({ onServerReady }: TerminalTabProps) => {
}); });
return cleanup; return cleanup;
}, [onServerReady, host, port]); }, [onServerReady, host, port, frontendPreference]);
const scrollToBottom = () => { const scrollToBottom = () => {
if (viewportRef.current) { if (viewportRef.current) {

View file

@ -76,7 +76,10 @@ export const InterfaceScreen = ({
display: activeTab === 'terminal' ? 'block' : 'none', display: activeTab === 'terminal' ? 'block' : 'none',
}} }}
> >
<TerminalTab onServerReady={handleServerReady} /> <TerminalTab
onServerReady={handleServerReady}
frontendPreference={frontendPreference}
/>
</div> </div>
</div> </div>
); );

View file

@ -361,11 +361,10 @@ export class SillyTavernManager {
'--port', '--port',
config.port.toString(), config.port.toString(),
'--listen', '--listen',
'--corsProxy',
'--securityOverride',
'--disableCsrf',
'--browserLaunchEnabled', '--browserLaunchEnabled',
'false', 'false',
'--dataRoot',
this.getSillyTavernSettingsPath().replace('/settings.json', ''),
]; ];
this.sillyTavernProcess = spawn('npx', sillyTavernArgs, { this.sillyTavernProcess = spawn('npx', sillyTavernArgs, {