improve updates
This commit is contained in:
@@ -74,5 +74,6 @@
|
||||
"This tool’s API is compatible with OpenAI API. It can be used with any ChatGPT tool you like. Go to the settings of some ChatGPT tool, replace the 'https://api.openai.com' part in the API address with '": "本工具的API与OpenAI API兼容. 因此可以配合任意你喜欢的ChatGPT工具使用. 打开某个ChatGPT工具的设置, 将API地址中的'https://api.openai.com'部分替换为'",
|
||||
"New Version Available": "新版本可用",
|
||||
"Update": "更新",
|
||||
"Please click the button in the top right corner to start the model": "请点击右上角的按钮启动模型"
|
||||
"Please click the button in the top right corner to start the model": "请点击右上角的按钮启动模型",
|
||||
"Update Error, Please restart this program": "更新出错, 请重启本程序"
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
DeleteFile,
|
||||
DownloadFile,
|
||||
FileExists,
|
||||
ListDirFiles,
|
||||
@@ -188,6 +189,13 @@ export function forceDownloadProgramFiles() {
|
||||
});
|
||||
}
|
||||
|
||||
export function deletePythonProgramFiles() {
|
||||
manifest.programFiles.forEach(({path}) => {
|
||||
if (path.endsWith('.py'))
|
||||
DeleteFile(path);
|
||||
});
|
||||
}
|
||||
|
||||
export async function checkUpdate() {
|
||||
let updateUrl = '';
|
||||
await fetch('https://api.github.com/repos/josstorer/RWKV-Runner/releases/latest').then((r) => {
|
||||
@@ -198,7 +206,16 @@ export async function checkUpdate() {
|
||||
if (versionTag.replace('v', '') > manifest.version) {
|
||||
updateUrl = `https://github.com/josStorer/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe`;
|
||||
toastWithButton(t('New Version Available') + ': ' + versionTag, t('Update'), () => {
|
||||
UpdateApp(updateUrl);
|
||||
deletePythonProgramFiles();
|
||||
setTimeout(() => {
|
||||
UpdateApp(updateUrl).catch((e) => {
|
||||
toast(t('Update Error, Please restart this program') + ' - ' + e.message, {
|
||||
type: 'error',
|
||||
position: 'bottom-left',
|
||||
autoClose: false
|
||||
});
|
||||
});
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user