code format
This commit is contained in:
parent
035c6ab8de
commit
bbad153ecb
@ -1,4 +1,4 @@
|
|||||||
import zhHans from './zh-hans/main.json'
|
import zhHans from './zh-hans/main.json';
|
||||||
|
|
||||||
export const resources = {
|
export const resources = {
|
||||||
zh: {
|
zh: {
|
||||||
@ -34,4 +34,4 @@ export const resources = {
|
|||||||
// zhHant: {
|
// zhHant: {
|
||||||
// translation: zhHant,
|
// translation: zhHant,
|
||||||
// },
|
// },
|
||||||
}
|
};
|
||||||
|
@ -46,7 +46,8 @@ export const ReadButton: FC<{ content: string }> = observer(({content}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ToolTipButton desc={t('Read Aloud')} size="small" appearance="subtle" icon={speaking ? <MuteIcon/> : <UnmuteIcon/>}
|
<ToolTipButton desc={t('Read Aloud')} size="small" appearance="subtle"
|
||||||
|
icon={speaking ? <MuteIcon /> : <UnmuteIcon />}
|
||||||
onClick={speaking ? stopSpeak : startSpeak} />
|
onClick={speaking ? stopSpeak : startSpeak} />
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
import React, { FC, MouseEventHandler, ReactElement } from 'react';
|
import React, { FC, MouseEventHandler, ReactElement } from 'react';
|
||||||
import commonStore, { ModelStatus } from '../stores/commonStore';
|
import commonStore, { ModelStatus } from '../stores/commonStore';
|
||||||
import { AddToDownloadList, DepCheck, FileExists, InstallPyDep, StartServer } from '../../wailsjs/go/backend_golang/App';
|
import {
|
||||||
|
AddToDownloadList,
|
||||||
|
DepCheck,
|
||||||
|
FileExists,
|
||||||
|
InstallPyDep,
|
||||||
|
StartServer
|
||||||
|
} from '../../wailsjs/go/backend_golang/App';
|
||||||
import { Button } from '@fluentui/react-components';
|
import { Button } from '@fluentui/react-components';
|
||||||
import { observer } from 'mobx-react-lite';
|
import { observer } from 'mobx-react-lite';
|
||||||
import { exit, readRoot, switchModel, updateConfig } from '../apis';
|
import { exit, readRoot, switchModel, updateConfig } from '../apis';
|
||||||
@ -40,8 +46,8 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
|||||||
commonStore.setModelStatus(ModelStatus.Starting);
|
commonStore.setModelStatus(ModelStatus.Starting);
|
||||||
|
|
||||||
const modelConfig = commonStore.getCurrentModelConfig();
|
const modelConfig = commonStore.getCurrentModelConfig();
|
||||||
let modelName = ''
|
let modelName = '';
|
||||||
let modelPath = ''
|
let modelPath = '';
|
||||||
if (modelConfig && modelConfig.modelParameters) {
|
if (modelConfig && modelConfig.modelParameters) {
|
||||||
modelName = modelConfig.modelParameters.modelName;
|
modelName = modelConfig.modelParameters.modelName;
|
||||||
modelPath = `./${manifest.localModelDir}/${modelName}`;
|
modelPath = `./${manifest.localModelDir}/${modelName}`;
|
||||||
@ -66,7 +72,7 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
|||||||
} else if (depErrorMsg.includes('DepCheck Error')) {
|
} else if (depErrorMsg.includes('DepCheck Error')) {
|
||||||
toastWithButton(t('Python dependencies are incomplete, would you like to install them?'), t('Install'), () => {
|
toastWithButton(t('Python dependencies are incomplete, would you like to install them?'), t('Install'), () => {
|
||||||
InstallPyDep(commonStore.settings.cnMirror);
|
InstallPyDep(commonStore.settings.cnMirror);
|
||||||
setTimeout(WindowShow, 1000)
|
setTimeout(WindowShow, 1000);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
toast(depErrorMsg, { type: 'error' });
|
toast(depErrorMsg, { type: 'error' });
|
||||||
@ -103,7 +109,7 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean
|
|||||||
await exit(1000).catch(() => {
|
await exit(1000).catch(() => {
|
||||||
});
|
});
|
||||||
StartServer(port);
|
StartServer(port);
|
||||||
setTimeout(WindowShow, 1000)
|
setTimeout(WindowShow, 1000);
|
||||||
|
|
||||||
let timeoutCount = 6;
|
let timeoutCount = 6;
|
||||||
let loading = false;
|
let loading = false;
|
||||||
|
@ -734,7 +734,7 @@ export const Configs: FC = observer(() => {
|
|||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
toast(`${t('Convert Failed')} - ${e.message || e}`, { type: 'error' });
|
toast(`${t('Convert Failed')} - ${e.message || e}`, { type: 'error' });
|
||||||
});
|
});
|
||||||
setTimeout(WindowShow, 1000)
|
setTimeout(WindowShow, 1000);
|
||||||
} else {
|
} else {
|
||||||
toast(`${t('Model Not Found')} - ${modelPath}`, { type: 'error' });
|
toast(`${t('Model Not Found')} - ${modelPath}`, { type: 'error' });
|
||||||
}
|
}
|
||||||
|
@ -19,32 +19,22 @@ export enum ModelStatus {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class CommonStore {
|
class CommonStore {
|
||||||
constructor() {
|
|
||||||
makeAutoObservable(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// global
|
// global
|
||||||
modelStatus: ModelStatus = ModelStatus.Offline;
|
modelStatus: ModelStatus = ModelStatus.Offline;
|
||||||
depComplete: boolean = false;
|
depComplete: boolean = false;
|
||||||
|
|
||||||
// home
|
// home
|
||||||
introduction: IntroductionContent = manifest.introduction;
|
introduction: IntroductionContent = manifest.introduction;
|
||||||
|
|
||||||
// chat
|
// chat
|
||||||
conversations: Conversations = {};
|
conversations: Conversations = {};
|
||||||
conversationsOrder: string[] = [];
|
conversationsOrder: string[] = [];
|
||||||
|
|
||||||
// configs
|
// configs
|
||||||
currentModelConfigIndex: number = 0;
|
currentModelConfigIndex: number = 0;
|
||||||
modelConfigs: ModelConfig[] = [];
|
modelConfigs: ModelConfig[] = [];
|
||||||
|
|
||||||
// models
|
// models
|
||||||
modelSourceManifestList: string = 'https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner/manifest.json;';
|
modelSourceManifestList: string = 'https://cdn.jsdelivr.net/gh/josstorer/RWKV-Runner/manifest.json;';
|
||||||
modelSourceList: ModelSourceItem[] = [];
|
modelSourceList: ModelSourceItem[] = [];
|
||||||
|
|
||||||
// downloads
|
// downloads
|
||||||
downloadList: DownloadStatus[] = [];
|
downloadList: DownloadStatus[] = [];
|
||||||
|
|
||||||
// settings
|
// settings
|
||||||
settings: SettingsType = {
|
settings: SettingsType = {
|
||||||
language: getUserLanguage(),
|
language: getUserLanguage(),
|
||||||
@ -53,10 +43,13 @@ class CommonStore {
|
|||||||
giteeUpdatesSource: getUserLanguage() === 'zh',
|
giteeUpdatesSource: getUserLanguage() === 'zh',
|
||||||
cnMirror: getUserLanguage() === 'zh'
|
cnMirror: getUserLanguage() === 'zh'
|
||||||
};
|
};
|
||||||
|
|
||||||
// about
|
// about
|
||||||
about: AboutContent = manifest.about;
|
about: AboutContent = manifest.about;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
makeAutoObservable(this);
|
||||||
|
}
|
||||||
|
|
||||||
getCurrentModelConfig = () => {
|
getCurrentModelConfig = () => {
|
||||||
return this.modelConfigs[this.currentModelConfigIndex];
|
return this.modelConfigs[this.currentModelConfigIndex];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user