From deb9e030cbe859bf5358ed0df913c8a433d77da4 Mon Sep 17 00:00:00 2001 From: josc146 Date: Mon, 29 May 2023 21:15:11 +0800 Subject: [PATCH] GetPlatform --- frontend/src/startup.ts | 3 ++- frontend/src/stores/commonStore.ts | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/startup.ts b/frontend/src/startup.ts index 52e1b95..3a58f57 100644 --- a/frontend/src/startup.ts +++ b/frontend/src/startup.ts @@ -1,5 +1,5 @@ import commonStore from './stores/commonStore'; -import { ReadJson } from '../wailsjs/go/backend_golang/App'; +import { GetPlatform, ReadJson } from '../wailsjs/go/backend_golang/App'; import { Cache, checkUpdate, downloadProgramFiles, LocalConfig, refreshModels, saveCache } from './utils'; import { getStatus } from './apis'; import { EventsOn } from '../wailsjs/runtime'; @@ -15,6 +15,7 @@ export async function startup() { initCache().then(initRemoteText); + await GetPlatform().then(commonStore.setPlatform); await initConfig(); if (commonStore.settings.autoUpdatesCheck) // depends on config settings diff --git a/frontend/src/stores/commonStore.ts b/frontend/src/stores/commonStore.ts index bae0cd1..441f197 100644 --- a/frontend/src/stores/commonStore.ts +++ b/frontend/src/stores/commonStore.ts @@ -33,6 +33,7 @@ class CommonStore { device_name: 'CPU' }; depComplete: boolean = false; + platform: string = 'windows'; // home introduction: IntroductionContent = manifest.introduction; // chat @@ -168,6 +169,10 @@ class CommonStore { setCompletionGenerating(value: boolean) { this.completionGenerating = value; } + + setPlatform(value: string) { + this.platform = value; + } } export default new CommonStore(); \ No newline at end of file