diff --git a/frontend/src/_locales/ja/main.json b/frontend/src/_locales/ja/main.json index 1bd2253d..053138a8 100644 --- a/frontend/src/_locales/ja/main.json +++ b/frontend/src/_locales/ja/main.json @@ -359,5 +359,8 @@ "See More": "もっと見る", "State Model": "Stateモデル", "State model mismatch": "Stateモデルの不一致", - "File format of the model or state model not supported": "モデルまたはStateモデルのファイル形式がサポートされていません" + "File format of the model or state model not supported": "モデルまたはStateモデルのファイル形式がサポートされていません", + "Note: You are using an English state": "注意: あなたは英語のstateを使用しています", + "Note: You are using a Chinese state": "注意: あなたは中国語のstateを使用しています", + "Note: You are using a Japanese state": "注意: あなたは日本語のstateを使用しています" } \ No newline at end of file diff --git a/frontend/src/_locales/zh-hans/main.json b/frontend/src/_locales/zh-hans/main.json index 216bf02f..cc9724e2 100644 --- a/frontend/src/_locales/zh-hans/main.json +++ b/frontend/src/_locales/zh-hans/main.json @@ -359,5 +359,8 @@ "See More": "查看更多", "State Model": "State模型", "State model mismatch": "State模型不匹配", - "File format of the model or state model not supported": "模型或state模型的文件格式不支持" + "File format of the model or state model not supported": "模型或state模型的文件格式不支持", + "Note: You are using an English state": "注意: 你正在使用一个英文state", + "Note: You are using a Chinese state": "注意: 你正在使用一个中文state", + "Note: You are using a Japanese state": "注意: 你正在使用一个日文state" } \ No newline at end of file diff --git a/frontend/src/apis/index.ts b/frontend/src/apis/index.ts index f616a28d..ab8972ea 100644 --- a/frontend/src/apis/index.ts +++ b/frontend/src/apis/index.ts @@ -1,4 +1,6 @@ import commonStore, { Status } from '../stores/commonStore'; +import { toast } from 'react-toastify'; +import { TFunction } from 'i18next'; export const readRoot = async () => { const port = commonStore.getCurrentModelConfig().apiParameters.apiPort; @@ -25,7 +27,27 @@ export const switchModel = async (body: any) => { }); }; -export const updateConfig = async (body: any) => { +export const updateConfig = async (t: TFunction<'translation', undefined, 'translation'>, body: any) => { + if (body.state) { + const stateName = body.state.toLowerCase(); + if (commonStore.settings.language !== 'zh' && (stateName.includes('chn') || stateName.includes('chinese'))) { + toast(t('Note: You are using a Chinese state'), { + type: 'warning', + toastId: 'state_warning' + }); + } else if (commonStore.settings.language !== 'dev' && (stateName.includes('eng') || stateName.includes('english'))) { + toast(t('Note: You are using an English state'), { + type: 'warning', + toastId: 'state_warning' + }); + } else if (commonStore.settings.language !== 'ja' && (stateName.includes('jpn') || stateName.includes('japanese'))) { + toast(t('Note: You are using a Japanese state'), { + type: 'warning', + toastId: 'state_warning' + }); + } + } + const port = commonStore.getCurrentModelConfig().apiParameters.apiPort; return fetch(`http://127.0.0.1:${port}/update-config`, { method: 'POST', diff --git a/frontend/src/components/RunButton.tsx b/frontend/src/components/RunButton.tsx index 66b6f098..8810901c 100644 --- a/frontend/src/components/RunButton.tsx +++ b/frontend/src/components/RunButton.tsx @@ -207,7 +207,7 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean commonStore.setStatus({ status: ModelStatus.Loading }); const loadingId = toast(t('Loading Model'), { type: 'info', autoClose: false }); if (!webgpu) { - updateConfig({ + updateConfig(t, { max_tokens: modelConfig.apiParameters.maxResponseToken, temperature: modelConfig.apiParameters.temperature, top_p: modelConfig.apiParameters.topP, diff --git a/frontend/src/pages/Configs.tsx b/frontend/src/pages/Configs.tsx index c53fed61..1ea7f53f 100644 --- a/frontend/src/pages/Configs.tsx +++ b/frontend/src/pages/Configs.tsx @@ -119,7 +119,7 @@ const Configs: FC = observer(() => { if (!webgpu) { // When clicking RunButton in Configs page, updateConfig will be called twice, // because there are also RunButton in other pages, and the calls to updateConfig in both places are necessary. - updateConfig({ + updateConfig(t, { max_tokens: selectedConfig.apiParameters.maxResponseToken, temperature: selectedConfig.apiParameters.temperature, top_p: selectedConfig.apiParameters.topP,