improve upgrade process
This commit is contained in:
parent
9f080b63e0
commit
5192e31bac
@ -144,8 +144,12 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
|||||||
if (!exist) CopyFile('./backend-python/wkv_cuda_utils/wkv_cuda_model.py', './py310/Lib/site-packages/rwkv/model.py');
|
if (!exist) CopyFile('./backend-python/wkv_cuda_utils/wkv_cuda_model.py', './py310/Lib/site-packages/rwkv/model.py');
|
||||||
});
|
});
|
||||||
await CopyFile(customCudaFile, './py310/Lib/site-packages/rwkv/wkv_cuda.pyd').catch(() => {
|
await CopyFile(customCudaFile, './py310/Lib/site-packages/rwkv/wkv_cuda.pyd').catch(() => {
|
||||||
customCudaFile = '';
|
FileExists('./py310/Lib/site-packages/rwkv/wkv_cuda.pyd').then((exist) => {
|
||||||
toast(t('Failed to copy custom cuda file'), { type: 'error' });
|
if (!exist) {
|
||||||
|
customCudaFile = '';
|
||||||
|
toast(t('Failed to copy custom cuda file'), { type: 'error' });
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
toast(t('Supported custom cuda file not found'), { type: 'warning' });
|
toast(t('Supported custom cuda file not found'), { type: 'warning' });
|
||||||
|
@ -3,8 +3,8 @@ import { FileExists, ReadJson } from '../wailsjs/go/backend_golang/App';
|
|||||||
import {
|
import {
|
||||||
Cache,
|
Cache,
|
||||||
checkUpdate,
|
checkUpdate,
|
||||||
|
deleteDynamicProgramFiles,
|
||||||
downloadProgramFiles,
|
downloadProgramFiles,
|
||||||
forceDownloadProgramFiles,
|
|
||||||
LocalConfig,
|
LocalConfig,
|
||||||
refreshModels,
|
refreshModels,
|
||||||
saveCache
|
saveCache
|
||||||
@ -17,8 +17,9 @@ export async function startup() {
|
|||||||
FileExists('cache.json').then((exists) => {
|
FileExists('cache.json').then((exists) => {
|
||||||
if (exists)
|
if (exists)
|
||||||
downloadProgramFiles();
|
downloadProgramFiles();
|
||||||
else
|
else {
|
||||||
forceDownloadProgramFiles();
|
deleteDynamicProgramFiles().then(downloadProgramFiles);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
EventsOn('downloadList', (data) => {
|
EventsOn('downloadList', (data) => {
|
||||||
if (data)
|
if (data)
|
||||||
|
@ -188,6 +188,16 @@ export function forceDownloadProgramFiles() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function deleteDynamicProgramFiles() {
|
||||||
|
let promises: Promise<void>[] = [];
|
||||||
|
manifest.programFiles.forEach(({ path }) => {
|
||||||
|
if ((path.endsWith('.py') && !path.includes('get-pip.py')) || path.includes('requirements') || path.endsWith('.pyd'))
|
||||||
|
promises.push(DeleteFile(path));
|
||||||
|
});
|
||||||
|
return await Promise.allSettled(promises).catch(() => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export function bytesToGb(size: number) {
|
export function bytesToGb(size: number) {
|
||||||
return (size / 1024 / 1024 / 1024).toFixed(2);
|
return (size / 1024 / 1024 / 1024).toFixed(2);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user