From 2b912cb22eb26d87a3e2b09b5389f8eb3ab56fdd Mon Sep 17 00:00:00 2001 From: Egor Date: Thu, 4 Sep 2025 00:05:33 -0700 Subject: [PATCH] more fixes and improvements before final release --- package.json | 2 +- src/components/settings/AboutTab.tsx | 8 +-- src/main/managers/SillyTavernManager.ts | 22 +++++---- src/utils/assets.ts | 65 +++---------------------- 4 files changed, 25 insertions(+), 72 deletions(-) diff --git a/package.json b/package.json index 049fef0..3dee6c4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gerbil", "productName": "Gerbil", - "version": "1.0.0", + "version": "0.9.10", "description": "Run Large Language Models locally", "main": "out/main/index.js", "homepage": "./", diff --git a/src/components/settings/AboutTab.tsx b/src/components/settings/AboutTab.tsx index 89da0b0..29b2f2c 100644 --- a/src/components/settings/AboutTab.tsx +++ b/src/components/settings/AboutTab.tsx @@ -41,7 +41,7 @@ export const AboutTab = () => { } const versionItems = [ - { label: 'App Version', value: versionInfo.appVersion }, + { label: PRODUCT_NAME, value: versionInfo.appVersion }, { label: 'Electron', value: versionInfo.electronVersion }, { label: 'Node.js', value: versionInfo.nodeVersion }, { label: 'Chromium', value: versionInfo.chromeVersion }, @@ -54,7 +54,7 @@ export const AboutTab = () => { const copyVersionInfo = async () => { const info = [ - `${PRODUCT_NAME} v${versionInfo.appVersion}`, + `${PRODUCT_NAME}: v${versionInfo.appVersion}`, `Electron: ${versionInfo.electronVersion}`, `Node.js: ${versionInfo.nodeVersion}`, `Chromium: ${versionInfo.chromeVersion}`, @@ -137,12 +137,12 @@ export const AboutTab = () => { - + { const env = { ...process.env }; + if (process.platform === 'win32') { + return env; + } + const versionManagerPaths = [ join(homedir(), '.local', 'share', 'fnm', 'node-versions'), join(homedir(), '.nvm', 'versions', 'node'), @@ -144,19 +148,12 @@ export class SillyTavernManager { if (process.platform === 'darwin') { systemPaths.push('/opt/homebrew/bin', '/usr/local/bin'); } - if (process.platform === 'win32') { - versionManagerPaths.push( - join(homedir(), 'AppData', 'Local', 'fnm', 'node-versions'), - join(homedir(), 'AppData', 'Roaming', 'nvm') - ); - } for (const systemPath of systemPaths) { try { await access(systemPath); - if (await this.tryAddPathToEnv(env, systemPath)) { - return env; - } + await this.tryAddPathToEnv(env, systemPath); + return env; } catch { continue; } @@ -174,7 +171,11 @@ export class SillyTavernManager { async isNpxAvailable(): Promise { try { const env = await this.getNodeEnvironment(); - const testProcess = spawn('npx', ['--version'], { stdio: 'pipe', env }); + const testProcess = spawn('npx', ['--version'], { + stdio: 'pipe', + env, + shell: process.platform === 'win32', + }); return new Promise((resolve) => { const timeout = setTimeout(() => { @@ -203,6 +204,7 @@ export class SillyTavernManager { stdio: ['pipe', 'pipe', 'pipe'], detached: false, env, + shell: process.platform === 'win32', }); } diff --git a/src/utils/assets.ts b/src/utils/assets.ts index 985e07f..d5b65d6 100644 --- a/src/utils/assets.ts +++ b/src/utils/assets.ts @@ -55,68 +55,19 @@ export const sortDownloadsByType = ( }); export const pretifyBinName = (binName: string): string => { - const cleanName = stripAssetExtensions(binName); + const cleanName = stripAssetExtensions(binName).toLowerCase(); - let name = cleanName.replace(/^koboldcpp[-_]?/, ''); - - if (!name) { - return 'Windows (x64)'; + if (cleanName.includes(ASSET_SUFFIXES.ROCM)) { + return 'ROCm'; } - const platforms = { - linux: 'Linux', - mac: 'macOS', - }; - - const architectures = { - x64: 'x64', - arm64: 'ARM64', - }; - - const variants = { - rocm: 'ROCm', - nocuda: 'NoCUDA', - oldpc: 'OldPC', - }; - - const parts: string[] = []; - let workingName = name.toLowerCase(); - - let platform = ''; - for (const [key, value] of Object.entries(platforms)) { - if (workingName.includes(key)) { - platform = value; - workingName = workingName.replace(key, '').replace(/^-+|-+$/g, ''); - break; - } + if (cleanName.endsWith(ASSET_SUFFIXES.OLDPC)) { + return 'Old PC'; } - let arch = ''; - for (const [key, value] of Object.entries(architectures)) { - if (workingName.includes(key)) { - arch = value; - workingName = workingName.replace(key, '').replace(/^-+|-+$/g, ''); - break; - } + if (cleanName.endsWith(ASSET_SUFFIXES.NOCUDA)) { + return 'No CUDA'; } - const foundVariants: string[] = []; - for (const [key, value] of Object.entries(variants)) { - if (workingName.includes(key)) { - foundVariants.push(value); - workingName = workingName.replace(key, '').replace(/^-+|-+$/g, ''); - } - } - - if (platform) parts.push(platform); - if (arch) parts.push(`(${arch})`); - if (foundVariants.length > 0) { - parts.push(`- ${foundVariants.join(', ')}`); - } - - if (parts.length === 0) { - return cleanName.replace('koboldcpp-', '').replace(/^-+/, '') || 'Standard'; - } - - return parts.join(' '); + return 'Standard'; };