mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 09:33:10 -07:00
reduce windows metrics performance cost, more consistent bottom stickiness on the terminal tab, better error reporting when a frontend fails to start
This commit is contained in:
parent
f4fd72c0e8
commit
5571edadda
3 changed files with 32 additions and 4 deletions
|
|
@ -54,10 +54,18 @@ export const TerminalTab = forwardRef<TerminalTabRef>((_props, ref) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const cleanup = window.electronAPI.kobold.onKoboldOutput((data: string) => {
|
const cleanup = window.electronAPI.kobold.onKoboldOutput((data: string) => {
|
||||||
setTerminalContent((prev) => handleTerminalOutput(prev, data.toString()));
|
setTerminalContent((prev) => handleTerminalOutput(prev, data.toString()));
|
||||||
|
|
||||||
|
if (shouldAutoScroll && !isUserScrolling && viewportRef.current) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
if (viewportRef.current) {
|
||||||
|
viewportRef.current.scrollTop = viewportRef.current.scrollHeight;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return cleanup;
|
return cleanup;
|
||||||
}, []);
|
}, [shouldAutoScroll, isUserScrolling]);
|
||||||
|
|
||||||
const scrollToBottom = () => {
|
const scrollToBottom = () => {
|
||||||
if (viewportRef.current) {
|
if (viewportRef.current) {
|
||||||
|
|
|
||||||
|
|
@ -348,9 +348,19 @@ export const launchKoboldCppWithCustomFrontends = async (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frontendPreference === 'sillytavern') {
|
if (frontendPreference === 'sillytavern') {
|
||||||
void startSillyTavernFrontend(args);
|
startSillyTavernFrontend(args).catch((error) => {
|
||||||
|
logError('Failed to start SillyTavern frontend:', error);
|
||||||
|
sendKoboldOutput(
|
||||||
|
`Failed to start SillyTavern: ${error instanceof Error ? error.message : String(error)}`
|
||||||
|
);
|
||||||
|
});
|
||||||
} else if (frontendPreference === 'openwebui') {
|
} else if (frontendPreference === 'openwebui') {
|
||||||
void startOpenWebUIFrontend(args);
|
startOpenWebUIFrontend(args).catch((error) => {
|
||||||
|
logError('Failed to start OpenWebUI frontend:', error);
|
||||||
|
sendKoboldOutput(
|
||||||
|
`Failed to start OpenWebUI: ${error instanceof Error ? error.message : String(error)}`
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
import { spawn } from 'node:child_process';
|
import { spawn } from 'node:child_process';
|
||||||
import { platform } from 'node:process';
|
import { platform } from 'node:process';
|
||||||
import type { BrowserWindow } from 'electron';
|
import type { BrowserWindow } from 'electron';
|
||||||
import { cpuTemperature, currentLoad, mem } from 'systeminformation';
|
import {
|
||||||
|
cpuTemperature,
|
||||||
|
currentLoad,
|
||||||
|
mem,
|
||||||
|
powerShellRelease,
|
||||||
|
powerShellStart,
|
||||||
|
} from 'systeminformation';
|
||||||
import { getGPUData } from '@/utils/node/gpu';
|
import { getGPUData } from '@/utils/node/gpu';
|
||||||
import { safeExecute, tryExecute } from '@/utils/node/logging';
|
import { safeExecute, tryExecute } from '@/utils/node/logging';
|
||||||
import { detectGPU } from './hardware';
|
import { detectGPU } from './hardware';
|
||||||
|
|
@ -64,6 +70,8 @@ export function startMonitoring(window: BrowserWindow) {
|
||||||
mainWindow = window;
|
mainWindow = window;
|
||||||
isRunning = true;
|
isRunning = true;
|
||||||
|
|
||||||
|
powerShellStart();
|
||||||
|
|
||||||
void collectAndSendCpuMetrics();
|
void collectAndSendCpuMetrics();
|
||||||
cpuInterval = setInterval(() => {
|
cpuInterval = setInterval(() => {
|
||||||
void collectAndSendCpuMetrics();
|
void collectAndSendCpuMetrics();
|
||||||
|
|
@ -96,6 +104,8 @@ export function stopMonitoring() {
|
||||||
gpuInterval = null;
|
gpuInterval = null;
|
||||||
}
|
}
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
|
|
||||||
|
powerShellRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTrayWithMetrics() {
|
function updateTrayWithMetrics() {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue