From 1c364e0e5c3a5267a8f8a8c394178d082269c5d2 Mon Sep 17 00:00:00 2001 From: balibabu Date: Tue, 29 Oct 2024 11:05:31 +0800 Subject: [PATCH] feat: If the model supplier is not set, click the OK button to jump directly to the page for setting the model supplier. #3068 (#3069) ### What problem does this PR solve? feat: If the model supplier is not set, click the OK button to jump directly to the page for setting the model supplier. #3068 ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe): --- web/src/hooks/user-setting-hooks.tsx | 4 ++++ web/src/locales/en.ts | 3 +-- web/src/locales/zh-traditional.ts | 3 +-- web/src/locales/zh.ts | 3 +-- web/src/pages/flow/constant.tsx | 1 + web/src/pages/flow/header/index.tsx | 2 +- .../system-model-setting-modal/index.tsx | 20 ++++++++++++------- 7 files changed, 22 insertions(+), 14 deletions(-) diff --git a/web/src/hooks/user-setting-hooks.tsx b/web/src/hooks/user-setting-hooks.tsx index 9b0288cfd5..e27646bfdf 100644 --- a/web/src/hooks/user-setting-hooks.tsx +++ b/web/src/hooks/user-setting-hooks.tsx @@ -21,6 +21,7 @@ import DOMPurify from 'dompurify'; import { isEmpty } from 'lodash'; import { useCallback, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { history } from 'umi'; export const useFetchUserInfo = (): ResponseGetType => { const { i18n } = useTranslation(); @@ -67,6 +68,9 @@ export const useFetchTenantInfo = (): ResponseGetType => { }} > ), + onOk() { + history.push('/user-setting/model'); + }, }); } data.chat_id = data.llm_id; diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index d313c27a13..e47823b917 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -586,8 +586,7 @@ The above is the content you need to summarize.`, 'Please input Google Cloud Service Account Key in base64 format', addGoogleRegion: 'Google Cloud Region', GoogleRegionMessage: 'Please input Google Cloud Region', - modelProvidersWarn: - 'Please add both embedding model and LLM in Settings > Model providers firstly.', + modelProvidersWarn: `Please add both embedding model and LLM in Settings > Model providers firstly. Then, set them in 'System model settings'.`, apiVersion: 'API-Version', apiVersionMessage: 'Please input API version', add: 'Add', diff --git a/web/src/locales/zh-traditional.ts b/web/src/locales/zh-traditional.ts index f805739996..cee0e361d4 100644 --- a/web/src/locales/zh-traditional.ts +++ b/web/src/locales/zh-traditional.ts @@ -544,8 +544,7 @@ export default { '請輸入 Google Cloud Service Account Key in base64 format', addGoogleRegion: 'Google Cloud 區域', GoogleRegionMessage: '請輸入 Google Cloud 區域', - modelProvidersWarn: - '請先在 「設定」>「模型提供者」 中新增嵌入模型和LLM。', + modelProvidersWarn: `請先在設定>模型提供者中新增嵌入模型和LLM。然後,在「系統模型設定」中設定它們。`, add: '添加', updateDate: '更新日期', role: '角色', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index f991a8c7af..3e12ab833a 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -561,8 +561,7 @@ export default { '请输入 Google Cloud Service Account Key in base64 format', addGoogleRegion: 'Google Cloud 区域', GoogleRegionMessage: '请输入 Google Cloud 区域', - modelProvidersWarn: - '请首先在 设置 > 模型提供商 中添加嵌入模型和 LLM。', + modelProvidersWarn: `请先在设置 > 模型提供程序中添加嵌入模型和 LLM。然后在“系统模型设置”中设置它们。`, apiVersion: 'API版本', apiVersionMessage: '请输入API版本!', add: '添加', diff --git a/web/src/pages/flow/constant.tsx b/web/src/pages/flow/constant.tsx index 2131bfa3c0..3329cd7c7d 100644 --- a/web/src/pages/flow/constant.tsx +++ b/web/src/pages/flow/constant.tsx @@ -608,6 +608,7 @@ export const RestrictedUpstreamMap = { [Operator.TuShare]: [Operator.Begin], [Operator.Crawler]: [Operator.Begin], [Operator.Note]: [], + [Operator.Invoke]: [Operator.Begin], }; export const NodeMap = { diff --git a/web/src/pages/flow/header/index.tsx b/web/src/pages/flow/header/index.tsx index e89113d242..38f16b7858 100644 --- a/web/src/pages/flow/header/index.tsx +++ b/web/src/pages/flow/header/index.tsx @@ -44,7 +44,7 @@ const FlowHeader = ({ showChatDrawer }: IProps) => { - diff --git a/web/src/pages/user-setting/setting-model/system-model-setting-modal/index.tsx b/web/src/pages/user-setting/setting-model/system-model-setting-modal/index.tsx index e6517e4ea0..292f2d1db5 100644 --- a/web/src/pages/user-setting/setting-model/system-model-setting-modal/index.tsx +++ b/web/src/pages/user-setting/setting-model/system-model-setting-modal/index.tsx @@ -26,7 +26,13 @@ const SystemModelSettingModal = ({ const handleOk = async () => { const values = await form.validateFields(); - onOk(values); + onOk({ + ...values, + asr_id: values.asr_id ?? '', + embd_id: values.embd_id ?? '', + img2txt_id: values.img2txt_id ?? '', + llm_id: values.llm_id ?? '', + }); }; useEffect(() => { @@ -52,21 +58,21 @@ const SystemModelSettingModal = ({ name="llm_id" tooltip={t('chatModelTip')} > - - - - - -