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');
|
||||
});
|
||||
await CopyFile(customCudaFile, './py310/Lib/site-packages/rwkv/wkv_cuda.pyd').catch(() => {
|
||||
FileExists('./py310/Lib/site-packages/rwkv/wkv_cuda.pyd').then((exist) => {
|
||||
if (!exist) {
|
||||
customCudaFile = '';
|
||||
toast(t('Failed to copy custom cuda file'), { type: 'error' });
|
||||
}
|
||||
});
|
||||
});
|
||||
} else
|
||||
toast(t('Supported custom cuda file not found'), { type: 'warning' });
|
||||
|
@ -3,8 +3,8 @@ import { FileExists, ReadJson } from '../wailsjs/go/backend_golang/App';
|
||||
import {
|
||||
Cache,
|
||||
checkUpdate,
|
||||
deleteDynamicProgramFiles,
|
||||
downloadProgramFiles,
|
||||
forceDownloadProgramFiles,
|
||||
LocalConfig,
|
||||
refreshModels,
|
||||
saveCache
|
||||
@ -17,8 +17,9 @@ export async function startup() {
|
||||
FileExists('cache.json').then((exists) => {
|
||||
if (exists)
|
||||
downloadProgramFiles();
|
||||
else
|
||||
forceDownloadProgramFiles();
|
||||
else {
|
||||
deleteDynamicProgramFiles().then(downloadProgramFiles);
|
||||
}
|
||||
});
|
||||
EventsOn('downloadList', (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) {
|
||||
return (size / 1024 / 1024 / 1024).toFixed(2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user