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

View file

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

View file

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