refetch versions if they fail to be fetched on startup for the versions tab, don't wait for half a second after initial version download, better/simpler config writting

This commit is contained in:
Egor 2025-10-11 12:00:31 -07:00
parent 576cfdbc02
commit 38fc320a5a
6 changed files with 25 additions and 19 deletions

View file

@ -1,7 +1,7 @@
{ {
"name": "gerbil", "name": "gerbil",
"productName": "Gerbil", "productName": "Gerbil",
"version": "1.6.8", "version": "1.6.9",
"description": "Run Large Language Models locally", "description": "Run Large Language Models locally",
"main": "out/main/index.js", "main": "out/main/index.js",
"homepage": "./", "homepage": "./",
@ -39,7 +39,7 @@
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.37.0", "@eslint/js": "^9.37.0",
"@types/node": "^24.7.1", "@types/node": "^24.7.2",
"@types/react": "^19.2.2", "@types/react": "^19.2.2",
"@types/react-dom": "^19.2.1", "@types/react-dom": "^19.2.1",
"@typescript-eslint/eslint-plugin": "^8.46.0", "@typescript-eslint/eslint-plugin": "^8.46.0",

View file

@ -128,7 +128,7 @@ export const StatusBar = ({ maxDataPoints = 60 }: StatusBarProps) => {
))} ))}
</> </>
) : ( ) : (
<PerformanceBadge tooltipLabel="Resource manager" iconOnly /> <PerformanceBadge tooltipLabel="Resource Manager" iconOnly />
)} )}
</Group> </Group>
</Group> </Group>

View file

@ -165,10 +165,7 @@ export const App = () => {
determineScreen(currentVersion, true); determineScreen(currentVersion, true);
}; };
const handleDownloadComplete = () => { const handleDownloadComplete = () => setCurrentScreen('launch');
setTimeout(() => setCurrentScreen('launch'), 500);
};
const handleLaunch = () => { const handleLaunch = () => {
setActiveInterfaceTab('terminal'); setActiveInterfaceTab('terminal');
setCurrentScreen('interface'); setCurrentScreen('interface');

View file

@ -30,6 +30,7 @@ export const VersionsTab = () => {
downloading, downloading,
handleDownload: handleDownloadFromStore, handleDownload: handleDownloadFromStore,
getLatestReleaseWithDownloadStatus, getLatestReleaseWithDownloadStatus,
initialize,
} = useKoboldVersionsStore(); } = useKoboldVersionsStore();
const [installedVersions, setInstalledVersions] = useState< const [installedVersions, setInstalledVersions] = useState<
@ -66,11 +67,21 @@ export const VersionsTab = () => {
}, [getLatestReleaseWithDownloadStatus]); }, [getLatestReleaseWithDownloadStatus]);
useEffect(() => { useEffect(() => {
/* eslint-disable react-hooks/set-state-in-effect */ if (availableDownloads.length === 0 && !loadingRemote && !loadingPlatform) {
initialize();
}
// eslint-disable-next-line react-hooks/set-state-in-effect
loadInstalledVersions(); loadInstalledVersions();
loadLatestRelease(); loadLatestRelease();
/* eslint-enable react-hooks/set-state-in-effect */ }, [
}, [loadInstalledVersions, loadLatestRelease]); loadInstalledVersions,
loadLatestRelease,
availableDownloads.length,
loadingRemote,
loadingPlatform,
initialize,
]);
const allVersions = useMemo((): VersionInfo[] => { const allVersions = useMemo((): VersionInfo[] => {
const versions: VersionInfo[] = []; const versions: VersionInfo[] = [];

View file

@ -1,4 +1,4 @@
import { readFile, writeFile, access, mkdir, rename } from 'fs/promises'; import { readFile, writeFile, access, mkdir } from 'fs/promises';
import { constants } from 'fs'; import { constants } from 'fs';
import { dirname } from 'path'; import { dirname } from 'path';
@ -26,9 +26,7 @@ export const writeJsonFile = async (path: string, data: unknown) => {
await ensureDir(dir); await ensureDir(dir);
const content = JSON.stringify(data, null, 2); const content = JSON.stringify(data, null, 2);
const tempPath = `${path}.tmp`; await writeFile(path, content, 'utf-8');
await writeFile(tempPath, content, 'utf-8');
await rename(tempPath, path);
}; };
export const ensureDir = async (path: string) => { export const ensureDir = async (path: string) => {

View file

@ -1431,12 +1431,12 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/node@npm:*, @types/node@npm:^24.7.1": "@types/node@npm:*, @types/node@npm:^24.7.2":
version: 24.7.1 version: 24.7.2
resolution: "@types/node@npm:24.7.1" resolution: "@types/node@npm:24.7.2"
dependencies: dependencies:
undici-types: "npm:~7.14.0" undici-types: "npm:~7.14.0"
checksum: 10c0/2525f2aa865d78b1c75faaf8c6bf2af51c930962d8078306620d9a76eafcbbea035142cf2cdc2fcf1b4010cd3958a1c6c59b67aba1ac205dc1e5f895ef6af673 checksum: 10c0/03f662f10e4b89bc97016e067101cbabe55025b54c24afb581fb50992d5eeaaf417bdae34bbc668ae8759d3cdbbbadf35fc8b9b29d26f52ede2525d48e919e49
languageName: node languageName: node
linkType: hard linkType: hard
@ -3862,7 +3862,7 @@ __metadata:
"@fontsource/inter": "npm:^5.2.8" "@fontsource/inter": "npm:^5.2.8"
"@mantine/core": "npm:^8.3.4" "@mantine/core": "npm:^8.3.4"
"@mantine/hooks": "npm:^8.3.4" "@mantine/hooks": "npm:^8.3.4"
"@types/node": "npm:^24.7.1" "@types/node": "npm:^24.7.2"
"@types/react": "npm:^19.2.2" "@types/react": "npm:^19.2.2"
"@types/react-dom": "npm:^19.2.1" "@types/react-dom": "npm:^19.2.1"
"@types/yauzl": "npm:^2.10.3" "@types/yauzl": "npm:^2.10.3"