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):
This commit is contained in:
balibabu 2024-10-29 11:05:31 +08:00 committed by GitHub
parent 9906526a91
commit 1c364e0e5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 22 additions and 14 deletions

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;

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

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

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

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 = {

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>

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>