balibabu commited on
Commit
777daee
·
1 Parent(s): ed12544

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)

Browse files

### 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 CHANGED
@@ -21,6 +21,7 @@ import DOMPurify from 'dompurify';
21
  import { isEmpty } from 'lodash';
22
  import { useCallback, useMemo, useState } from 'react';
23
  import { useTranslation } from 'react-i18next';
 
24
 
25
  export const useFetchUserInfo = (): ResponseGetType<IUserInfo> => {
26
  const { i18n } = useTranslation();
@@ -67,6 +68,9 @@ export const useFetchTenantInfo = (): ResponseGetType<ITenantInfo> => {
67
  }}
68
  ></div>
69
  ),
 
 
 
70
  });
71
  }
72
  data.chat_id = data.llm_id;
 
21
  import { isEmpty } from 'lodash';
22
  import { useCallback, useMemo, useState } from 'react';
23
  import { useTranslation } from 'react-i18next';
24
+ import { history } from 'umi';
25
 
26
  export const useFetchUserInfo = (): ResponseGetType<IUserInfo> => {
27
  const { i18n } = useTranslation();
 
68
  }}
69
  ></div>
70
  ),
71
+ onOk() {
72
+ history.push('/user-setting/model');
73
+ },
74
  });
75
  }
76
  data.chat_id = data.llm_id;
web/src/locales/en.ts CHANGED
@@ -586,8 +586,7 @@ The above is the content you need to summarize.`,
586
  'Please input Google Cloud Service Account Key in base64 format',
587
  addGoogleRegion: 'Google Cloud Region',
588
  GoogleRegionMessage: 'Please input Google Cloud Region',
589
- modelProvidersWarn:
590
- 'Please add both embedding model and LLM in <b>Settings > Model providers</b> firstly.',
591
  apiVersion: 'API-Version',
592
  apiVersionMessage: 'Please input API version',
593
  add: 'Add',
 
586
  'Please input Google Cloud Service Account Key in base64 format',
587
  addGoogleRegion: 'Google Cloud Region',
588
  GoogleRegionMessage: 'Please input Google Cloud Region',
589
+ modelProvidersWarn: `Please add both embedding model and LLM in <b>Settings > Model providers</b> firstly. Then, set them in 'System model settings'.`,
 
590
  apiVersion: 'API-Version',
591
  apiVersionMessage: 'Please input API version',
592
  add: 'Add',
web/src/locales/zh-traditional.ts CHANGED
@@ -544,8 +544,7 @@ export default {
544
  '請輸入 Google Cloud Service Account Key in base64 format',
545
  addGoogleRegion: 'Google Cloud 區域',
546
  GoogleRegionMessage: '請輸入 Google Cloud 區域',
547
- modelProvidersWarn:
548
- '請先在 <b>「設定」>「模型提供者」</b> 中新增嵌入模型和LLM。',
549
  add: '添加',
550
  updateDate: '更新日期',
551
  role: '角色',
 
544
  '請輸入 Google Cloud Service Account Key in base64 format',
545
  addGoogleRegion: 'Google Cloud 區域',
546
  GoogleRegionMessage: '請輸入 Google Cloud 區域',
547
+ modelProvidersWarn: `請先在<b>設定>模型提供者</b>中新增嵌入模型和LLM。然後,在「系統模型設定」中設定它們。`,
 
548
  add: '添加',
549
  updateDate: '更新日期',
550
  role: '角色',
web/src/locales/zh.ts CHANGED
@@ -561,8 +561,7 @@ export default {
561
  '请输入 Google Cloud Service Account Key in base64 format',
562
  addGoogleRegion: 'Google Cloud 区域',
563
  GoogleRegionMessage: '请输入 Google Cloud 区域',
564
- modelProvidersWarn:
565
- '请首先在 <b>设置 > 模型提供商</b> 中添加嵌入模型和 LLM。',
566
  apiVersion: 'API版本',
567
  apiVersionMessage: '请输入API版本!',
568
  add: '添加',
 
561
  '请输入 Google Cloud Service Account Key in base64 format',
562
  addGoogleRegion: 'Google Cloud 区域',
563
  GoogleRegionMessage: '请输入 Google Cloud 区域',
564
+ modelProvidersWarn: `请先在<b>设置 > 模型提供程序</b>中添加嵌入模型和 LLM。然后在“系统模型设置”中设置它们。`,
 
565
  apiVersion: 'API版本',
566
  apiVersionMessage: '请输入API版本!',
567
  add: '添加',
web/src/pages/flow/constant.tsx CHANGED
@@ -608,6 +608,7 @@ export const RestrictedUpstreamMap = {
608
  [Operator.TuShare]: [Operator.Begin],
609
  [Operator.Crawler]: [Operator.Begin],
610
  [Operator.Note]: [],
 
611
  };
612
 
613
  export const NodeMap = {
 
608
  [Operator.TuShare]: [Operator.Begin],
609
  [Operator.Crawler]: [Operator.Begin],
610
  [Operator.Note]: [],
611
+ [Operator.Invoke]: [Operator.Begin],
612
  };
613
 
614
  export const NodeMap = {
web/src/pages/flow/header/index.tsx CHANGED
@@ -44,7 +44,7 @@ const FlowHeader = ({ showChatDrawer }: IProps) => {
44
  <Button type="primary" onClick={saveGraph}>
45
  <b>{t('save')}</b>
46
  </Button>
47
- <Button type="primary" onClick={showOverviewModal}>
48
  <b>{t('publish')}</b>
49
  </Button>
50
  </Space>
 
44
  <Button type="primary" onClick={saveGraph}>
45
  <b>{t('save')}</b>
46
  </Button>
47
+ <Button type="primary" onClick={showOverviewModal} disabled>
48
  <b>{t('publish')}</b>
49
  </Button>
50
  </Space>
web/src/pages/user-setting/setting-model/system-model-setting-modal/index.tsx CHANGED
@@ -26,7 +26,13 @@ const SystemModelSettingModal = ({
26
 
27
  const handleOk = async () => {
28
  const values = await form.validateFields();
29
- onOk(values);
 
 
 
 
 
 
30
  };
31
 
32
  useEffect(() => {
@@ -52,21 +58,21 @@ const SystemModelSettingModal = ({
52
  name="llm_id"
53
  tooltip={t('chatModelTip')}
54
  >
55
- <Select options={allOptions[LlmModelType.Chat]} />
56
  </Form.Item>
57
  <Form.Item
58
  label={t('embeddingModel')}
59
  name="embd_id"
60
  tooltip={t('embeddingModelTip')}
61
  >
62
- <Select options={allOptions[LlmModelType.Embedding]} />
63
  </Form.Item>
64
  <Form.Item
65
  label={t('img2txtModel')}
66
  name="img2txt_id"
67
  tooltip={t('img2txtModelTip')}
68
  >
69
- <Select options={allOptions[LlmModelType.Image2text]} />
70
  </Form.Item>
71
 
72
  <Form.Item
@@ -74,21 +80,21 @@ const SystemModelSettingModal = ({
74
  name="asr_id"
75
  tooltip={t('sequence2txtModelTip')}
76
  >
77
- <Select options={allOptions[LlmModelType.Speech2text]} />
78
  </Form.Item>
79
  <Form.Item
80
  label={t('rerankModel')}
81
  name="rerank_id"
82
  tooltip={t('rerankModelTip')}
83
  >
84
- <Select options={allOptions[LlmModelType.Rerank]} />
85
  </Form.Item>
86
  <Form.Item
87
  label={t('ttsModel')}
88
  name="tts_id"
89
  tooltip={t('ttsModelTip')}
90
  >
91
- <Select options={allOptions[LlmModelType.TTS]} />
92
  </Form.Item>
93
  </Form>
94
  </Modal>
 
26
 
27
  const handleOk = async () => {
28
  const values = await form.validateFields();
29
+ onOk({
30
+ ...values,
31
+ asr_id: values.asr_id ?? '',
32
+ embd_id: values.embd_id ?? '',
33
+ img2txt_id: values.img2txt_id ?? '',
34
+ llm_id: values.llm_id ?? '',
35
+ });
36
  };
37
 
38
  useEffect(() => {
 
58
  name="llm_id"
59
  tooltip={t('chatModelTip')}
60
  >
61
+ <Select options={allOptions[LlmModelType.Chat]} allowClear />
62
  </Form.Item>
63
  <Form.Item
64
  label={t('embeddingModel')}
65
  name="embd_id"
66
  tooltip={t('embeddingModelTip')}
67
  >
68
+ <Select options={allOptions[LlmModelType.Embedding]} allowClear />
69
  </Form.Item>
70
  <Form.Item
71
  label={t('img2txtModel')}
72
  name="img2txt_id"
73
  tooltip={t('img2txtModelTip')}
74
  >
75
+ <Select options={allOptions[LlmModelType.Image2text]} allowClear />
76
  </Form.Item>
77
 
78
  <Form.Item
 
80
  name="asr_id"
81
  tooltip={t('sequence2txtModelTip')}
82
  >
83
+ <Select options={allOptions[LlmModelType.Speech2text]} allowClear />
84
  </Form.Item>
85
  <Form.Item
86
  label={t('rerankModel')}
87
  name="rerank_id"
88
  tooltip={t('rerankModelTip')}
89
  >
90
+ <Select options={allOptions[LlmModelType.Rerank]} allowClear />
91
  </Form.Item>
92
  <Form.Item
93
  label={t('ttsModel')}
94
  name="tts_id"
95
  tooltip={t('ttsModelTip')}
96
  >
97
+ <Select options={allOptions[LlmModelType.TTS]} allowClear />
98
  </Form.Item>
99
  </Form>
100
  </Modal>