mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 19:54:44 -07:00
minor code clean up
This commit is contained in:
parent
67af2e17e3
commit
173e306104
6 changed files with 6 additions and 21 deletions
|
|
@ -17,7 +17,7 @@ import { useLaunchConfigStore } from '@/stores/launchConfig';
|
||||||
import { usePreferencesStore } from '@/stores/preferences';
|
import { usePreferencesStore } from '@/stores/preferences';
|
||||||
|
|
||||||
interface TerminalTabProps {
|
interface TerminalTabProps {
|
||||||
onServerReady: (url: string) => void;
|
onServerReady: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TerminalTabRef {
|
export interface TerminalTabRef {
|
||||||
|
|
@ -26,8 +26,7 @@ export interface TerminalTabRef {
|
||||||
|
|
||||||
export const TerminalTab = forwardRef<TerminalTabRef, TerminalTabProps>(
|
export const TerminalTab = forwardRef<TerminalTabRef, TerminalTabProps>(
|
||||||
({ onServerReady }, ref) => {
|
({ onServerReady }, ref) => {
|
||||||
const { host, port, isImageGenerationMode, isTextMode } =
|
const { isImageGenerationMode, isTextMode } = useLaunchConfigStore();
|
||||||
useLaunchConfigStore();
|
|
||||||
const {
|
const {
|
||||||
frontendPreference,
|
frontendPreference,
|
||||||
imageGenerationFrontendPreference,
|
imageGenerationFrontendPreference,
|
||||||
|
|
@ -80,9 +79,6 @@ export const TerminalTab = forwardRef<TerminalTabRef, TerminalTabProps>(
|
||||||
const newData = data.toString();
|
const newData = data.toString();
|
||||||
|
|
||||||
if (onServerReady) {
|
if (onServerReady) {
|
||||||
const serverHost = host || 'localhost';
|
|
||||||
const serverPort = port || 5001;
|
|
||||||
|
|
||||||
const effectiveFrontend = isTextMode
|
const effectiveFrontend = isTextMode
|
||||||
? frontendPreference
|
? frontendPreference
|
||||||
: imageGenerationFrontendPreference === 'builtin'
|
: imageGenerationFrontendPreference === 'builtin'
|
||||||
|
|
@ -98,10 +94,7 @@ export const TerminalTab = forwardRef<TerminalTabRef, TerminalTabProps>(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newData.includes(signalToCheck)) {
|
if (newData.includes(signalToCheck)) {
|
||||||
setTimeout(
|
setTimeout(() => onServerReady(), 3000);
|
||||||
() => onServerReady(`http://${serverHost}:${serverPort}`),
|
|
||||||
1500
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,8 +106,6 @@ export const TerminalTab = forwardRef<TerminalTabRef, TerminalTabProps>(
|
||||||
return cleanup;
|
return cleanup;
|
||||||
}, [
|
}, [
|
||||||
onServerReady,
|
onServerReady,
|
||||||
host,
|
|
||||||
port,
|
|
||||||
frontendPreference,
|
frontendPreference,
|
||||||
imageGenerationFrontendPreference,
|
imageGenerationFrontendPreference,
|
||||||
isImageGenerationMode,
|
isImageGenerationMode,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import {
|
||||||
selectModelFile,
|
selectModelFile,
|
||||||
selectInstallDirectory,
|
selectInstallDirectory,
|
||||||
} from '@/main/modules/koboldcpp/config';
|
} from '@/main/modules/koboldcpp/config';
|
||||||
import { getLocalModelsForType } from '@/main/modules/koboldcpp/modelDownload';
|
import { getLocalModelsForType } from '@/main/modules/koboldcpp/model-download';
|
||||||
import { analyzeGGUFModel } from '@/main/modules/koboldcpp/analyze';
|
import { analyzeGGUFModel } from '@/main/modules/koboldcpp/analyze';
|
||||||
import {
|
import {
|
||||||
get as getConfig,
|
get as getConfig,
|
||||||
|
|
@ -75,7 +75,7 @@ import {
|
||||||
quitAndInstall,
|
quitAndInstall,
|
||||||
isUpdateDownloaded,
|
isUpdateDownloaded,
|
||||||
canAutoUpdate,
|
canAutoUpdate,
|
||||||
} from '@/main/modules/autoUpdater';
|
} from '@/main/modules/auto-updater';
|
||||||
import { calculateOptimalGpuLayers } from '@/utils/node/vram';
|
import { calculateOptimalGpuLayers } from '@/utils/node/vram';
|
||||||
|
|
||||||
export function setupIPCHandlers() {
|
export function setupIPCHandlers() {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
/* eslint-disable no-comments/disallowComments */
|
|
||||||
import {
|
import {
|
||||||
cpu as siCpu,
|
cpu as siCpu,
|
||||||
mem as siMem,
|
mem as siMem,
|
||||||
|
|
@ -82,8 +81,6 @@ export async function detectGPU() {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function detectGPUCapabilities() {
|
export async function detectGPUCapabilities() {
|
||||||
// WARNING: we're not worrying about the users that update their system
|
|
||||||
// during runtime and not restart. Should we be though?
|
|
||||||
if (gpuCapabilitiesCache) {
|
if (gpuCapabilitiesCache) {
|
||||||
return gpuCapabilitiesCache;
|
return gpuCapabilitiesCache;
|
||||||
}
|
}
|
||||||
|
|
@ -336,13 +333,11 @@ function parseRocmOutput(output: string, vulkanInfo: { allGPUs: GPUDevice[] }) {
|
||||||
const line = lines[i];
|
const line = lines[i];
|
||||||
const trimmedLine = line.trim();
|
const trimmedLine = line.trim();
|
||||||
|
|
||||||
// Handle hipInfo format
|
|
||||||
if (handleHipInfoLine(trimmedLine, currentDevice, devices)) {
|
if (handleHipInfoLine(trimmedLine, currentDevice, devices)) {
|
||||||
currentDevice = trimmedLine.startsWith('device#') ? {} : currentDevice;
|
currentDevice = trimmedLine.startsWith('device#') ? {} : currentDevice;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle rocminfo format
|
|
||||||
if (line.includes('Marketing Name:')) {
|
if (line.includes('Marketing Name:')) {
|
||||||
const device = parseRocmInfoDevice(line, lines, i, vulkanInfo);
|
const device = parseRocmInfoDevice(line, lines, i, vulkanInfo);
|
||||||
if (device) {
|
if (device) {
|
||||||
|
|
@ -351,7 +346,6 @@ function parseRocmOutput(output: string, vulkanInfo: { allGPUs: GPUDevice[] }) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the last device for hipInfo format
|
|
||||||
if (currentDevice?.name) {
|
if (currentDevice?.name) {
|
||||||
devices.push(
|
devices.push(
|
||||||
createDevice(currentDevice.name, currentDevice.isIntegrated || false)
|
createDevice(currentDevice.name, currentDevice.isIntegrated || false)
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import { startFrontend as startSillyTavernFrontend } from '@/main/modules/sillyt
|
||||||
import { startFrontend as startOpenWebUIFrontend } from '@/main/modules/openwebui';
|
import { startFrontend as startOpenWebUIFrontend } from '@/main/modules/openwebui';
|
||||||
import { patchKliteEmbd, patchKcppSduiEmbd, filterSpam } from './patches';
|
import { patchKliteEmbd, patchKcppSduiEmbd, filterSpam } from './patches';
|
||||||
import { startProxy, stopProxy } from '../proxy';
|
import { startProxy, stopProxy } from '../proxy';
|
||||||
import { resolveModelPath } from '../modelDownload';
|
import { resolveModelPath } from '../model-download';
|
||||||
import type {
|
import type {
|
||||||
FrontendPreference,
|
FrontendPreference,
|
||||||
ImageGenerationFrontendPreference,
|
ImageGenerationFrontendPreference,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue