Browse Source

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):
tags/v0.13.0
balibabu 1 year ago
parent
commit
1c364e0e5c
No account linked to committer's email address

+ 4
- 0
web/src/hooks/user-setting-hooks.tsx View File

@@ -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();
@@ -67,6 +68,9 @@ export const useFetchTenantInfo = (): ResponseGetType<ITenantInfo> => {
}}
></div>
),
onOk() {
history.push('/user-setting/model');
},
});
}
data.chat_id = data.llm_id;

+ 1
- 2
web/src/locales/en.ts View File

@@ -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',

+ 1
- 2
web/src/locales/zh-traditional.ts View File

@@ -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: '角色',

+ 1
- 2
web/src/locales/zh.ts View File

@@ -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: '添加',

+ 1
- 0
web/src/pages/flow/constant.tsx View File

@@ -608,6 +608,7 @@ export const RestrictedUpstreamMap = {
[Operator.TuShare]: [Operator.Begin],
[Operator.Crawler]: [Operator.Begin],
[Operator.Note]: [],
[Operator.Invoke]: [Operator.Begin],
};

export const NodeMap = {

+ 1
- 1
web/src/pages/flow/header/index.tsx View File

@@ -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>

+ 13
- 7
web/src/pages/user-setting/setting-model/system-model-setting-modal/index.tsx View File

@@ -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')}
>
<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
@@ -74,21 +80,21 @@ const SystemModelSettingModal = ({
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>

Loading…
Cancel
Save