improve update process
This commit is contained in:
parent
f439b3d382
commit
dc50cf84f2
@ -75,7 +75,7 @@
|
|||||||
"New Version Available": "新版本可用",
|
"New Version Available": "新版本可用",
|
||||||
"Update": "更新",
|
"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": "更新出错, 请重启本程序",
|
"Update Error": "更新出错",
|
||||||
"Open the following URL with your browser to view the API documentation": "使用浏览器打开以下地址查看API文档",
|
"Open the following URL with your browser to view the API documentation": "使用浏览器打开以下地址查看API文档",
|
||||||
"By default, the maximum number of tokens that can be answered in a single response, it can be changed by the user by specifying API parameters.": "默认情况下, 单个回复最多回答的token数目, 用户可以通过自行指定API参数改变这个值",
|
"By default, the maximum number of tokens that can be answered in a single response, it can be changed by the user by specifying API parameters.": "默认情况下, 单个回复最多回答的token数目, 用户可以通过自行指定API参数改变这个值",
|
||||||
"Sampling temperature, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.": "采样温度, 越大随机性越强, 更具创造力, 越小则越保守稳定",
|
"Sampling temperature, the higher the stronger the randomness and creativity, while the lower, the more focused and deterministic it will be.": "采样温度, 越大随机性越强, 更具创造力, 越小则越保守稳定",
|
||||||
|
@ -1,12 +1,25 @@
|
|||||||
import commonStore from './stores/commonStore';
|
import commonStore from './stores/commonStore';
|
||||||
import { ReadJson } from '../wailsjs/go/backend_golang/App';
|
import { FileExists, ReadJson } from '../wailsjs/go/backend_golang/App';
|
||||||
import { Cache, checkUpdate, downloadProgramFiles, LocalConfig, refreshModels, saveCache } from './utils';
|
import {
|
||||||
|
Cache,
|
||||||
|
checkUpdate,
|
||||||
|
downloadProgramFiles,
|
||||||
|
forceDownloadProgramFiles,
|
||||||
|
LocalConfig,
|
||||||
|
refreshModels,
|
||||||
|
saveCache
|
||||||
|
} from './utils';
|
||||||
import { getStatus } from './apis';
|
import { getStatus } from './apis';
|
||||||
import { EventsOn } from '../wailsjs/runtime';
|
import { EventsOn } from '../wailsjs/runtime';
|
||||||
import { defaultModelConfigs } from './pages/Configs';
|
import { defaultModelConfigs } from './pages/Configs';
|
||||||
|
|
||||||
export async function startup() {
|
export async function startup() {
|
||||||
downloadProgramFiles();
|
FileExists('cache.json').then((exists) => {
|
||||||
|
if (exists)
|
||||||
|
downloadProgramFiles();
|
||||||
|
else
|
||||||
|
forceDownloadProgramFiles();
|
||||||
|
});
|
||||||
EventsOn('downloadList', (data) => {
|
EventsOn('downloadList', (data) => {
|
||||||
if (data)
|
if (data)
|
||||||
commonStore.setDownloadList(data);
|
commonStore.setDownloadList(data);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
AddToDownloadList,
|
AddToDownloadList,
|
||||||
DeleteFile,
|
DeleteFile,
|
||||||
DownloadFile,
|
|
||||||
FileExists,
|
FileExists,
|
||||||
ListDirFiles,
|
ListDirFiles,
|
||||||
ReadJson,
|
ReadJson,
|
||||||
@ -185,15 +184,7 @@ export function downloadProgramFiles() {
|
|||||||
|
|
||||||
export function forceDownloadProgramFiles() {
|
export function forceDownloadProgramFiles() {
|
||||||
manifest.programFiles.forEach(({ url, path }) => {
|
manifest.programFiles.forEach(({ url, path }) => {
|
||||||
DownloadFile(path, url.replace('@master', '@v' + manifest.version));
|
AddToDownloadList(path, url.replace('@master', '@v' + manifest.version));
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function deleteDynamicProgramFiles() {
|
|
||||||
DeleteFile('cache.json');
|
|
||||||
manifest.programFiles.forEach(({ path }) => {
|
|
||||||
if ((path.endsWith('.py') && !path.includes('get-pip.py')) || path.includes('requirements'))
|
|
||||||
DeleteFile(path);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +215,7 @@ export async function checkUpdate(notifyEvenLatest: boolean = false) {
|
|||||||
`https://github.com/josStorer/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe` :
|
`https://github.com/josStorer/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe` :
|
||||||
`https://gitee.com/josc146/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe`;
|
`https://gitee.com/josc146/RWKV-Runner/releases/download/${versionTag}/RWKV-Runner_windows_x64.exe`;
|
||||||
toastWithButton(t('New Version Available') + ': ' + versionTag, t('Update'), () => {
|
toastWithButton(t('New Version Available') + ': ' + versionTag, t('Update'), () => {
|
||||||
deleteDynamicProgramFiles();
|
DeleteFile('cache.json');
|
||||||
toast(t('Downloading update, please wait. If it is not completed, please manually download the program from GitHub and replace the original program.'), {
|
toast(t('Downloading update, please wait. If it is not completed, please manually download the program from GitHub and replace the original program.'), {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
position: 'bottom-left',
|
position: 'bottom-left',
|
||||||
@ -232,7 +223,7 @@ export async function checkUpdate(notifyEvenLatest: boolean = false) {
|
|||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
UpdateApp(updateUrl).catch((e) => {
|
UpdateApp(updateUrl).catch((e) => {
|
||||||
toast(t('Update Error, Please restart this program') + ' - ' + e.message || e, {
|
toast(t('Update Error') + ' - ' + e.message || e, {
|
||||||
type: 'error',
|
type: 'error',
|
||||||
position: 'bottom-left',
|
position: 'bottom-left',
|
||||||
autoClose: false
|
autoClose: false
|
||||||
|
Loading…
Reference in New Issue
Block a user