mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 09:33:10 -07:00
fix the --version handling regression for packaged builds
This commit is contained in:
parent
2c485ef37d
commit
83d5c9cbd4
3 changed files with 8 additions and 17 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "gerbil",
|
||||
"productName": "Gerbil",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.1",
|
||||
"description": "Run Large Language Models locally",
|
||||
"main": "out/main/index.js",
|
||||
"homepage": "./",
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import {
|
|||
} from '@/main/modules/binary';
|
||||
import { startMonitoring, stopMonitoring } from '@/main/modules/monitoring';
|
||||
import type { FrontendPreference } from '@/types';
|
||||
import { getAppVersion } from '@/utils/node/fs';
|
||||
|
||||
async function launchKoboldCppWithCustomFrontends(args: string[] = []) {
|
||||
try {
|
||||
|
|
@ -152,10 +153,10 @@ export function setupIPCHandlers() {
|
|||
|
||||
ipcMain.handle('config:set', (_, key, value) => setConfig(key, value));
|
||||
|
||||
ipcMain.handle('app:getVersion', () => app.getVersion());
|
||||
ipcMain.handle('app:getVersion', () => getAppVersion());
|
||||
|
||||
ipcMain.handle('app:getVersionInfo', () => ({
|
||||
appVersion: app.getVersion(),
|
||||
appVersion: getAppVersion(),
|
||||
electronVersion: process.versions.electron,
|
||||
nodeVersion: process.versions.node,
|
||||
chromeVersion: process.versions.chrome,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import { readFile, writeFile, access, mkdir } from 'fs/promises';
|
||||
import { constants } from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
export const pathExists = async (path: string) => {
|
||||
try {
|
||||
|
|
@ -11,9 +10,7 @@ export const pathExists = async (path: string) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const readJsonFile = async <T = unknown>(
|
||||
path: string
|
||||
): Promise<T | null> => {
|
||||
export const readJsonFile = async <T = unknown>(path: string) => {
|
||||
try {
|
||||
const content = await readFile(path, 'utf-8');
|
||||
return JSON.parse(content) as T;
|
||||
|
|
@ -37,14 +34,7 @@ export const ensureDir = async (path: string) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const getAppVersion = async (): Promise<string> => {
|
||||
try {
|
||||
const packageJsonPath = join(__dirname, '../../../package.json');
|
||||
const packageJson = await readJsonFile<{ version: string }>(
|
||||
packageJsonPath
|
||||
);
|
||||
return packageJson?.version || 'unknown';
|
||||
} catch {
|
||||
return 'unknown';
|
||||
}
|
||||
export const getAppVersion = async () => {
|
||||
const { app } = await import('electron');
|
||||
return app.getVersion();
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue