Skip to content

Commit

Permalink
feat: If the model supplier is not set, click the OK button to jump d…
Browse files Browse the repository at this point in the history
…irectly 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):
  • Loading branch information
cike8899 authored Oct 29, 2024
1 parent 9906526 commit 1c364e0
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
4 changes: 4 additions & 0 deletions web/src/hooks/user-setting-hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<IUserInfo> => {
const { i18n } = useTranslation();
Expand Down Expand Up @@ -67,6 +68,9 @@ export const useFetchTenantInfo = (): ResponseGetType<ITenantInfo> => {
}}
></div>
),
onOk() {
history.push('/user-setting/model');
},
});
}
data.chat_id = data.llm_id;
Expand Down
3 changes: 1 addition & 2 deletions web/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <b>Settings > Model providers</b> firstly.',
modelProvidersWarn: `Please add both embedding model and LLM in <b>Settings > Model providers</b> firstly. Then, set them in 'System model settings'.`,
apiVersion: 'API-Version',
apiVersionMessage: 'Please input API version',
add: 'Add',
Expand Down
3 changes: 1 addition & 2 deletions web/src/locales/zh-traditional.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,7 @@ export default {
'請輸入 Google Cloud Service Account Key in base64 format',
addGoogleRegion: 'Google Cloud 區域',
GoogleRegionMessage: '請輸入 Google Cloud 區域',
modelProvidersWarn:
'請先在 <b>「設定」>「模型提供者」</b> 中新增嵌入模型和LLM。',
modelProvidersWarn: `請先在<b>設定>模型提供者</b>中新增嵌入模型和LLM。然後,在「系統模型設定」中設定它們。`,
add: '添加',
updateDate: '更新日期',
role: '角色',
Expand Down
3 changes: 1 addition & 2 deletions web/src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,7 @@ export default {
'请输入 Google Cloud Service Account Key in base64 format',
addGoogleRegion: 'Google Cloud 区域',
GoogleRegionMessage: '请输入 Google Cloud 区域',
modelProvidersWarn:
'请首先在 <b>设置 > 模型提供商</b> 中添加嵌入模型和 LLM。',
modelProvidersWarn: `请先在<b>设置 > 模型提供程序</b>中添加嵌入模型和 LLM。然后在“系统模型设置”中设置它们。`,
apiVersion: 'API版本',
apiVersionMessage: '请输入API版本!',
add: '添加',
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/flow/constant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ export const RestrictedUpstreamMap = {
[Operator.TuShare]: [Operator.Begin],
[Operator.Crawler]: [Operator.Begin],
[Operator.Note]: [],
[Operator.Invoke]: [Operator.Begin],
};

export const NodeMap = {
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/flow/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const FlowHeader = ({ showChatDrawer }: IProps) => {
<Button type="primary" onClick={saveGraph}>
<b>{t('save')}</b>
</Button>
<Button type="primary" onClick={showOverviewModal}>
<Button type="primary" onClick={showOverviewModal} disabled>
<b>{t('publish')}</b>
</Button>
</Space>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -52,43 +58,43 @@ const SystemModelSettingModal = ({
name="llm_id"
tooltip={t('chatModelTip')}
>
<Select options={allOptions[LlmModelType.Chat]} />
<Select options={allOptions[LlmModelType.Chat]} allowClear />
</Form.Item>
<Form.Item
label={t('embeddingModel')}
name="embd_id"
tooltip={t('embeddingModelTip')}
>
<Select options={allOptions[LlmModelType.Embedding]} />
<Select options={allOptions[LlmModelType.Embedding]} allowClear />
</Form.Item>
<Form.Item
label={t('img2txtModel')}
name="img2txt_id"
tooltip={t('img2txtModelTip')}
>
<Select options={allOptions[LlmModelType.Image2text]} />
<Select options={allOptions[LlmModelType.Image2text]} allowClear />
</Form.Item>

<Form.Item
label={t('sequence2txtModel')}
name="asr_id"
tooltip={t('sequence2txtModelTip')}
>
<Select options={allOptions[LlmModelType.Speech2text]} />
<Select options={allOptions[LlmModelType.Speech2text]} allowClear />
</Form.Item>
<Form.Item
label={t('rerankModel')}
name="rerank_id"
tooltip={t('rerankModelTip')}
>
<Select options={allOptions[LlmModelType.Rerank]} />
<Select options={allOptions[LlmModelType.Rerank]} allowClear />
</Form.Item>
<Form.Item
label={t('ttsModel')}
name="tts_id"
tooltip={t('ttsModelTip')}
>
<Select options={allOptions[LlmModelType.TTS]} />
<Select options={allOptions[LlmModelType.TTS]} allowClear />
</Form.Item>
</Form>
</Modal>
Expand Down

0 comments on commit 1c364e0

Please sign in to comment.