This commit is contained in:
josc146 2023-05-30 22:58:52 +08:00
parent 83905c65c7
commit 1f3f6cf9a8
2 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import commonStore from './stores/commonStore'; import commonStore, { Platform } from './stores/commonStore';
import { GetPlatform, ReadJson } from '../wailsjs/go/backend_golang/App'; import { GetPlatform, ReadJson } from '../wailsjs/go/backend_golang/App';
import { Cache, checkUpdate, downloadProgramFiles, LocalConfig, refreshModels } from './utils'; import { Cache, checkUpdate, downloadProgramFiles, LocalConfig, refreshModels } from './utils';
import { getStatus } from './apis'; import { getStatus } from './apis';
@ -15,7 +15,7 @@ export async function startup() {
initCache().then(initRemoteText); initCache().then(initRemoteText);
await GetPlatform().then(p => commonStore.setPlatform(p)); await GetPlatform().then(p => commonStore.setPlatform(p as Platform));
await initConfig(); await initConfig();
if (commonStore.settings.autoUpdatesCheck) // depends on config settings if (commonStore.settings.autoUpdatesCheck) // depends on config settings

View File

@ -25,6 +25,8 @@ export type Status = {
device_name: string; device_name: string;
} }
export type Platform = 'windows' | 'darwin' | 'linux';
class CommonStore { class CommonStore {
// global // global
status: Status = { status: Status = {
@ -33,7 +35,7 @@ class CommonStore {
device_name: 'CPU' device_name: 'CPU'
}; };
depComplete: boolean = false; depComplete: boolean = false;
platform: string = 'windows'; platform: Platform = 'windows';
// home // home
introduction: IntroductionContent = manifest.introduction; introduction: IntroductionContent = manifest.introduction;
// chat // chat
@ -170,7 +172,7 @@ class CommonStore {
this.completionGenerating = value; this.completionGenerating = value;
} }
setPlatform(value: string) { setPlatform(value: Platform) {
this.platform = value; this.platform = value;
} }
} }