From c6ef32958eb613481e2500f2c01e70f5f94dd48d Mon Sep 17 00:00:00 2001 From: josc146 Date: Wed, 8 Nov 2023 23:31:13 +0800 Subject: [PATCH] when client webUI enabled, set server into deployment mode --- frontend/src/_locales/ja/main.json | 4 +++- frontend/src/_locales/zh-hans/main.json | 4 +++- frontend/src/components/RunButton.tsx | 11 +++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/frontend/src/_locales/ja/main.json b/frontend/src/_locales/ja/main.json index a989f30..5eb8790 100644 --- a/frontend/src/_locales/ja/main.json +++ b/frontend/src/_locales/ja/main.json @@ -265,5 +265,7 @@ "Port is occupied. Change it in Configs page or close the program that occupies the port.": "ポートが占有されています。設定ページで変更するか、ポートを占有しているプログラムを終了してください。", "Loading...": "読み込み中...", "Hello, what can I do for you?": "こんにちは、何かお手伝いできますか?", - "Enable WebUI": "WebUIを有効化" + "Enable WebUI": "WebUIを有効化", + "Server is working on deployment mode, please close the terminal window manually": "サーバーはデプロイモードで動作しています、ターミナルウィンドウを手動で閉じてください", + "Server is working on deployment mode, please exit the program manually to stop the server": "サーバーはデプロイモードで動作しています、サーバーを停止するにはプログラムを手動で終了してください" } \ 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 569a818..01434c6 100644 --- a/frontend/src/_locales/zh-hans/main.json +++ b/frontend/src/_locales/zh-hans/main.json @@ -265,5 +265,7 @@ "Port is occupied. Change it in Configs page or close the program that occupies the port.": "端口被占用。请在配置页面更改端口,或关闭占用端口的程序", "Loading...": "加载中...", "Hello, what can I do for you?": "你好,有什么要我帮忙的吗?", - "Enable WebUI": "启用WebUI" + "Enable WebUI": "启用WebUI", + "Server is working on deployment mode, please close the terminal window manually": "服务器正在部署模式下运行,请手动关闭终端窗口", + "Server is working on deployment mode, please exit the program manually to stop the server": "服务器正在部署模式下运行,请手动退出程序以停止服务器" } \ No newline at end of file diff --git a/frontend/src/components/RunButton.tsx b/frontend/src/components/RunButton.tsx index 142577d..0dd5851 100644 --- a/frontend/src/components/RunButton.tsx +++ b/frontend/src/components/RunButton.tsx @@ -199,7 +199,8 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean model: modelPath, strategy: strategy, tokenizer: modelConfig.modelParameters.useCustomTokenizer ? modelConfig.modelParameters.customTokenizer : undefined, - customCuda: customCudaFile !== '' + customCuda: customCudaFile !== '', + deploy: modelConfig.enableWebUI }).then(async (r) => { if (r.ok) { commonStore.setStatus({ status: ModelStatus.Working }); @@ -246,7 +247,13 @@ export const RunButton: FC<{ onClickRun?: MouseEventHandler, iconMode?: boolean }, 1000); } else { commonStore.setStatus({ status: ModelStatus.Offline }); - exit(); + exit().then(r => { + if (r.status === 403) + if (commonStore.platform !== 'linux') + toast(t('Server is working on deployment mode, please close the terminal window manually'), { type: 'info' }); + else + toast(t('Server is working on deployment mode, please exit the program manually to stop the server'), { type: 'info' }); + }); } };