toastWithButton
This commit is contained in:
parent
c5b3246154
commit
c03e16415f
@ -71,5 +71,7 @@
|
||||
"Copy": "复制",
|
||||
"Read Aloud": "朗读",
|
||||
"Hello! I'm RWKV, an open-source and commercially available large language model.": "你好! 我是RWKV, 一个开源可商用的大语言模型.",
|
||||
"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'部分替换为'"
|
||||
"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": "更新"
|
||||
}
|
@ -1,8 +1,17 @@
|
||||
import {DownloadFile, FileExists, ListDirFiles, ReadJson, SaveJson} from '../../wailsjs/go/backend_golang/App';
|
||||
import {
|
||||
DownloadFile,
|
||||
FileExists,
|
||||
ListDirFiles,
|
||||
ReadJson,
|
||||
SaveJson,
|
||||
UpdateApp
|
||||
} from '../../wailsjs/go/backend_golang/App';
|
||||
import manifest from '../../../manifest.json';
|
||||
import commonStore, {ModelConfig, ModelParameters, ModelSourceItem} from '../stores/commonStore';
|
||||
import {toast} from 'react-toastify';
|
||||
import {t} from 'i18next';
|
||||
import {ToastOptions} from 'react-toastify/dist/types';
|
||||
import {Button} from '@fluentui/react-components';
|
||||
|
||||
export const Languages = {
|
||||
dev: 'English', // i18n default
|
||||
@ -186,8 +195,12 @@ export async function checkUpdate() {
|
||||
r.json().then((data) => {
|
||||
if (data.tag_name) {
|
||||
const versionTag = data.tag_name;
|
||||
if (versionTag.replace('v', '') > manifest.version)
|
||||
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);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
throw new Error('Invalid response.');
|
||||
}
|
||||
@ -200,4 +213,18 @@ export async function checkUpdate() {
|
||||
toast(t('Updates Check Error') + ' - ' + e.message, {type: 'error', position: 'bottom-left'});
|
||||
});
|
||||
return updateUrl;
|
||||
}
|
||||
|
||||
export function toastWithButton(text: string, buttonText: string, onClickButton: () => void, options?: ToastOptions) {
|
||||
return toast(
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<div>{text}</div>
|
||||
<Button appearance="primary" onClick={onClickButton}>{buttonText}</Button>
|
||||
</div>,
|
||||
{
|
||||
autoClose: false,
|
||||
position: 'bottom-left',
|
||||
type: 'info',
|
||||
...options
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user