balibabu commited on
Commit
d594e0f
·
1 Parent(s): 3110924

feat: add rerank models to the project #724 #162 (#966)

Browse files

### What problem does this PR solve?

Vector similarity weight is displayed incorrectly #965
feat: add rerank models to the project #724 #162
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

web/src/components/rerank.tsx ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { LlmModelType } from '@/constants/knowledge';
2
+ import { useTranslate } from '@/hooks/commonHooks';
3
+ import { useSelectLlmOptionsByModelType } from '@/hooks/llmHooks';
4
+ import { Form, Select, Slider } from 'antd';
5
+
6
+ type FieldType = {
7
+ rerank_id?: string;
8
+ top_k?: number;
9
+ };
10
+
11
+ export const RerankItem = () => {
12
+ const { t } = useTranslate('knowledgeDetails');
13
+ const allOptions = useSelectLlmOptionsByModelType();
14
+
15
+ return (
16
+ <Form.Item
17
+ label={t('rerankModel')}
18
+ name={'rerank_id'}
19
+ tooltip={t('rerankTip')}
20
+ >
21
+ <Select
22
+ options={allOptions[LlmModelType.Rerank]}
23
+ allowClear
24
+ placeholder={t('rerankPlaceholder')}
25
+ />
26
+ </Form.Item>
27
+ );
28
+ };
29
+
30
+ const Rerank = () => {
31
+ const { t } = useTranslate('knowledgeDetails');
32
+
33
+ return (
34
+ <>
35
+ <RerankItem></RerankItem>
36
+ <Form.Item noStyle dependencies={['rerank_id']}>
37
+ {({ getFieldValue }) => {
38
+ const rerankId = getFieldValue('rerank_id');
39
+ return (
40
+ rerankId && (
41
+ <Form.Item<FieldType>
42
+ label={t('topK')}
43
+ name={'top_k'}
44
+ initialValue={1024}
45
+ tooltip={t('topKTip')}
46
+ >
47
+ <Slider max={2048} min={1} />
48
+ </Form.Item>
49
+ )
50
+ );
51
+ }}
52
+ </Form.Item>
53
+ </>
54
+ );
55
+ };
56
+
57
+ export default Rerank;
web/src/components/similarity-slider/index.tsx CHANGED
@@ -26,7 +26,7 @@ const SimilaritySlider = ({ isTooltipShown = false }: IProps) => {
26
  <Form.Item<FieldType>
27
  label={t('vectorSimilarityWeight')}
28
  name={'vector_similarity_weight'}
29
- initialValue={0.3}
30
  tooltip={isTooltipShown && t('vectorSimilarityWeightTip')}
31
  >
32
  <Slider max={1} step={0.01} />
 
26
  <Form.Item<FieldType>
27
  label={t('vectorSimilarityWeight')}
28
  name={'vector_similarity_weight'}
29
+ initialValue={1 - 0.3}
30
  tooltip={isTooltipShown && t('vectorSimilarityWeightTip')}
31
  >
32
  <Slider max={1} step={0.01} />
web/src/constants/knowledge.ts CHANGED
@@ -47,6 +47,7 @@ export enum LlmModelType {
47
  Chat = 'chat',
48
  Image2text = 'image2text',
49
  Speech2text = 'speech2text',
 
50
  }
51
 
52
  export enum KnowledgeSearchParams {
 
47
  Chat = 'chat',
48
  Image2text = 'image2text',
49
  Speech2text = 'speech2text',
50
+ Rerank = 'rerank',
51
  }
52
 
53
  export enum KnowledgeSearchParams {
web/src/hooks/llmHooks.ts CHANGED
@@ -92,6 +92,7 @@ export const useSelectLlmOptionsByModelType = () => {
92
  [LlmModelType.Speech2text]: groupOptionsByModelType(
93
  LlmModelType.Speech2text,
94
  ),
 
95
  };
96
  };
97
 
 
92
  [LlmModelType.Speech2text]: groupOptionsByModelType(
93
  LlmModelType.Speech2text,
94
  ),
95
+ [LlmModelType.Rerank]: groupOptionsByModelType(LlmModelType.Rerank),
96
  };
97
  };
98
 
web/src/interfaces/database/chat.ts CHANGED
@@ -47,6 +47,8 @@ export interface IDialog {
47
  tenant_id: string;
48
  update_date: string;
49
  update_time: number;
 
 
50
  }
51
 
52
  export interface IConversation {
 
47
  tenant_id: string;
48
  update_date: string;
49
  update_time: number;
50
+ vector_similarity_weight: number;
51
+ similarity_threshold: number;
52
  }
53
 
54
  export interface IConversation {
web/src/locales/en.ts CHANGED
@@ -93,15 +93,12 @@ export default {
93
  progressMsg: 'Progress Msg',
94
  testingDescription:
95
  'Final step! After success, leave the rest to Infiniflow AI.',
96
- topK: 'Top K',
97
- topKTip:
98
- "For the computaion cost, not all the retrieved chunk will be computed vector cosine similarity with query. The bigger the 'Top K' is, the higher the recall rate is, the slower the retrieval speed is.",
99
  similarityThreshold: 'Similarity threshold',
100
  similarityThresholdTip:
101
  "We use hybrid similarity score to evaluate distance between two lines of text. It's weighted keywords similarity and vector cosine similarity. If the similarity between query and chunk is less than this threshold, the chunk will be filtered out.",
102
- vectorSimilarityWeight: 'Vector similarity weight',
103
  vectorSimilarityWeightTip:
104
- "We use hybrid similarity score to evaluate distance between two lines of text. It's weighted keywords similarity and vector cosine similarity. The sum of both weights is 1.0.",
105
  testText: 'Test text',
106
  testTextPlaceholder: 'Please input your question!',
107
  testingLabel: 'Testing',
@@ -143,6 +140,11 @@ export default {
143
  chunk: 'Chunk',
144
  bulk: 'Bulk',
145
  cancel: 'Cancel',
 
 
 
 
 
146
  },
147
  knowledgeConfiguration: {
148
  titleDescription:
@@ -465,6 +467,8 @@ The above is the content you need to summarize.`,
465
  sequence2txtModel: 'Sequence2txt model',
466
  sequence2txtModelTip:
467
  'The default ASR model all the newly created knowledgebase will use. Use this model to translate voices to corresponding text.',
 
 
468
  workspace: 'Workspace',
469
  upgrade: 'Upgrade',
470
  addLlmTitle: 'Add LLM',
@@ -477,7 +481,8 @@ The above is the content you need to summarize.`,
477
  baseUrlNameMessage: 'Please input your base url!',
478
  vision: 'Does it support Vision?',
479
  ollamaLink: 'How to integrate {{name}}',
480
- volcModelNameMessage: 'Please input your model name! Format: {"ModelName":"EndpointID"}',
 
481
  addVolcEngineAK: 'VOLC ACCESS_KEY',
482
  volcAKMessage: 'Please input your VOLC_ACCESS_KEY',
483
  addVolcEngineSK: 'VOLC SECRET_KEY',
 
93
  progressMsg: 'Progress Msg',
94
  testingDescription:
95
  'Final step! After success, leave the rest to Infiniflow AI.',
 
 
 
96
  similarityThreshold: 'Similarity threshold',
97
  similarityThresholdTip:
98
  "We use hybrid similarity score to evaluate distance between two lines of text. It's weighted keywords similarity and vector cosine similarity. If the similarity between query and chunk is less than this threshold, the chunk will be filtered out.",
99
+ vectorSimilarityWeight: 'Keywords similarity weight',
100
  vectorSimilarityWeightTip:
101
+ " We use hybrid similarity score to evaluate distance between two lines of text. It's weighted keywords similarity and vector cosine similarity or rerank score(0~1). The sum of both weights is 1.0.",
102
  testText: 'Test text',
103
  testTextPlaceholder: 'Please input your question!',
104
  testingLabel: 'Testing',
 
140
  chunk: 'Chunk',
141
  bulk: 'Bulk',
142
  cancel: 'Cancel',
143
+ rerankModel: 'Rerank Model',
144
+ rerankPlaceholder: 'Please select',
145
+ rerankTip: `If it's empty. It uses embeddings of query and chunks to compuste vector cosine similarity. Otherwise, it uses rerank score in place of vector cosine similarity.`,
146
+ topK: 'Top-K',
147
+ topKTip: `K chunks will be fed into rerank models.`,
148
  },
149
  knowledgeConfiguration: {
150
  titleDescription:
 
467
  sequence2txtModel: 'Sequence2txt model',
468
  sequence2txtModelTip:
469
  'The default ASR model all the newly created knowledgebase will use. Use this model to translate voices to corresponding text.',
470
+ rerankModel: 'Rerank Model',
471
+ rerankModelTip: `The default rerank model is used to rerank chunks retrieved by users' questions.`,
472
  workspace: 'Workspace',
473
  upgrade: 'Upgrade',
474
  addLlmTitle: 'Add LLM',
 
481
  baseUrlNameMessage: 'Please input your base url!',
482
  vision: 'Does it support Vision?',
483
  ollamaLink: 'How to integrate {{name}}',
484
+ volcModelNameMessage:
485
+ 'Please input your model name! Format: {"ModelName":"EndpointID"}',
486
  addVolcEngineAK: 'VOLC ACCESS_KEY',
487
  volcAKMessage: 'Please input your VOLC_ACCESS_KEY',
488
  addVolcEngineSK: 'VOLC SECRET_KEY',
web/src/locales/zh-traditional.ts CHANGED
@@ -91,15 +91,12 @@ export default {
91
  processDuration: '過程持續時間',
92
  progressMsg: '進度消息',
93
  testingDescription: '最後一步!成功後,剩下的就交給Infiniflow AI吧。',
94
- topK: 'top k',
95
- topKTip:
96
- '對於計算成本,並非所有檢索到的塊都會計算與查詢的向量餘弦相似度。Top K越大,召回率越高,檢索速度越慢。',
97
  similarityThreshold: '相似度閾值',
98
  similarityThresholdTip:
99
  '我們使用混合相似度得分來評估兩行文本之間的距離。它是加權關鍵詞相似度和向量餘弦相似度。如果查詢和塊之間的相似度小於此閾值,則該塊將被過濾掉。',
100
- vectorSimilarityWeight: '向量相似度權重',
101
  vectorSimilarityWeightTip:
102
- '我們使用混合相似度得分來評估兩行文本之間的距離。它是加權關鍵詞相似度和向量餘弦相似度。兩個權重之和為 1.0。',
103
  testText: '測試文本',
104
  testTextPlaceholder: '請輸入您的問題!',
105
  testingLabel: '測試',
@@ -139,6 +136,11 @@ export default {
139
  chunk: '解析塊',
140
  bulk: '批量',
141
  cancel: '取消',
 
 
 
 
 
142
  },
143
  knowledgeConfiguration: {
144
  titleDescription: '在這裡更新您的知識庫詳細信息,尤其是解析方法。',
@@ -429,6 +431,8 @@ export default {
429
  sequence2txtModel: 'sequence2Txt模型',
430
  sequence2txtModelTip:
431
  '所有新創建的知識庫都將使用默認的 ASR 模型。使用此模型將語音翻譯為相應的文本。',
 
 
432
  workspace: '工作空間',
433
  upgrade: '升級',
434
  addLlmTitle: '添加Llm',
 
91
  processDuration: '過程持續時間',
92
  progressMsg: '進度消息',
93
  testingDescription: '最後一步!成功後,剩下的就交給Infiniflow AI吧。',
 
 
 
94
  similarityThreshold: '相似度閾值',
95
  similarityThresholdTip:
96
  '我們使用混合相似度得分來評估兩行文本之間的距離。它是加權關鍵詞相似度和向量餘弦相似度。如果查詢和塊之間的相似度小於此閾值,則該塊將被過濾掉。',
97
+ vectorSimilarityWeight: '關鍵字相似度權重',
98
  vectorSimilarityWeightTip:
99
+ '我們使用混合相似性評分來評估兩行文本之間的距離。它是加權關鍵字相似性和矢量餘弦相似性或rerank得分(0〜1)。兩個權重的總和為1.0。',
100
  testText: '測試文本',
101
  testTextPlaceholder: '請輸入您的問題!',
102
  testingLabel: '測試',
 
136
  chunk: '解析塊',
137
  bulk: '批量',
138
  cancel: '取消',
139
+ rerankModel: 'rerank模型',
140
+ rerankPlaceholder: '請選擇',
141
+ rerankTip: `如果是空的。它使用查詢和塊的嵌入來構成矢量餘弦相似性。否則,它使用rerank評分代替矢量餘弦相似性。`,
142
+ topK: 'Top-K',
143
+ topKTip: `K塊將被送入Rerank型號。`,
144
  },
145
  knowledgeConfiguration: {
146
  titleDescription: '在這裡更新您的知識庫詳細信息,尤其是解析方法。',
 
431
  sequence2txtModel: 'sequence2Txt模型',
432
  sequence2txtModelTip:
433
  '所有新創建的知識庫都將使用默認的 ASR 模型。使用此模型將語音翻譯為相應的文本。',
434
+ rerankModel: 'rerank模型',
435
+ rerankModelTip: `默認的重讀模型用於用戶問題檢索到重讀塊。`,
436
  workspace: '工作空間',
437
  upgrade: '升級',
438
  addLlmTitle: '添加Llm',
web/src/locales/zh.ts CHANGED
@@ -91,15 +91,12 @@ export default {
91
  processDuration: '过程持续时间',
92
  progressMsg: '进度消息',
93
  testingDescription: '最后一步! 成功后,剩下的就交给Infiniflow AI吧。',
94
- topK: 'Top K',
95
- topKTip:
96
- '对于计算成本,并非所有检索到的块都会计算与查询的向量余弦相似度。 Top K越大,召回率越高,检索速度越慢。',
97
  similarityThreshold: '相似度阈值',
98
  similarityThresholdTip:
99
  '我们使用混合相似度得分来评估两行文本之间的距离。 它是加权关键词相似度和向量余弦相似度。 如果查询和块之间的相似度小于此阈值,则该块将被过滤掉。',
100
- vectorSimilarityWeight: '向量相似度权重',
101
  vectorSimilarityWeightTip:
102
- '我们使用混合相似度得分来评估两行文本之间的距离。 它是加权关键词相似度和向量余弦相似度。 两个权重之和为 1.0。',
103
  testText: '测试文本',
104
  testTextPlaceholder: '请输入您的问题!',
105
  testingLabel: '测试',
@@ -140,6 +137,11 @@ export default {
140
  chunk: '解析块',
141
  bulk: '批量',
142
  cancel: '取消',
 
 
 
 
 
143
  },
144
  knowledgeConfiguration: {
145
  titleDescription: '在这里更新您的知识库详细信息,尤其是解析方法。',
@@ -446,6 +448,8 @@ export default {
446
  sequence2txtModel: 'Sequence2txt模型',
447
  sequence2txtModelTip:
448
  '所有新创建的知识库都将使用默认的 ASR 模型。 使用此模型将语音翻译为相应的文本。',
 
 
449
  workspace: '工作空间',
450
  upgrade: '升级',
451
  addLlmTitle: '添加 LLM',
 
91
  processDuration: '过程持续时间',
92
  progressMsg: '进度消息',
93
  testingDescription: '最后一步! 成功后,剩下的就交给Infiniflow AI吧。',
 
 
 
94
  similarityThreshold: '相似度阈值',
95
  similarityThresholdTip:
96
  '我们使用混合相似度得分来评估两行文本之间的距离。 它是加权关键词相似度和向量余弦相似度。 如果查询和块之间的相似度小于此阈值,则该块将被过滤掉。',
97
+ vectorSimilarityWeight: '关键字相似度权重',
98
  vectorSimilarityWeightTip:
99
+ '我们使用混合相似性评分来评估两行文本之间的距离。它是加权关键字相似性和矢量余弦相似性或rerank得分(0〜1)。两个权重的总和为1.0。',
100
  testText: '测试文本',
101
  testTextPlaceholder: '请输入您的问题!',
102
  testingLabel: '测试',
 
137
  chunk: '解析块',
138
  bulk: '批量',
139
  cancel: '取消',
140
+ rerankModel: 'Rerank模型',
141
+ rerankPlaceholder: '请选择',
142
+ rerankTip: `如果是空的。它使用查询和块的嵌入来构成矢量余弦相似性。否则,它使用rerank评分代替矢量余弦相似性。`,
143
+ topK: 'Top-K',
144
+ topKTip: `K块将被送入Rerank型号。`,
145
  },
146
  knowledgeConfiguration: {
147
  titleDescription: '在这里更新您的知识库详细信息,尤其是解析方法。',
 
448
  sequence2txtModel: 'Sequence2txt模型',
449
  sequence2txtModelTip:
450
  '所有新创建的知识库都将使用默认的 ASR 模型。 使用此模型将语音翻译为相应的文本。',
451
+ rerankModel: 'Rerank模型',
452
+ rerankModelTip: `默认的重读模型用于用户问题检索到重读块。`,
453
  workspace: '工作空间',
454
  upgrade: '升级',
455
  addLlmTitle: '添加 LLM',
web/src/pages/add-knowledge/components/knowledge-testing/index.tsx CHANGED
@@ -15,7 +15,10 @@ const KnowledgeTesting = () => {
15
 
16
  const handleTesting = async () => {
17
  const values = await form.validateFields();
18
- testChunk(values);
 
 
 
19
  };
20
 
21
  useEffect(() => {
 
15
 
16
  const handleTesting = async () => {
17
  const values = await form.validateFields();
18
+ testChunk({
19
+ ...values,
20
+ vector_similarity_weight: 1 - values.vector_similarity_weight,
21
+ });
22
  };
23
 
24
  useEffect(() => {
web/src/pages/add-knowledge/components/knowledge-testing/testing-control/index.tsx CHANGED
@@ -2,8 +2,11 @@ import SimilaritySlider from '@/components/similarity-slider';
2
  import { Button, Card, Divider, Flex, Form, Input } from 'antd';
3
  import { FormInstance } from 'antd/lib';
4
 
 
5
  import { useTranslate } from '@/hooks/commonHooks';
 
6
  import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
 
7
  import styles from './index.less';
8
 
9
  type FieldType = {
@@ -23,6 +26,11 @@ const TestingControl = ({ form, handleTesting }: IProps) => {
23
  'testDocumentChunk',
24
  ]);
25
  const { t } = useTranslate('knowledgeDetails');
 
 
 
 
 
26
 
27
  const buttonDisabled =
28
  !question || (typeof question === 'string' && question.trim() === '');
@@ -37,6 +45,7 @@ const TestingControl = ({ form, handleTesting }: IProps) => {
37
  <section>
38
  <Form name="testing" layout="vertical" form={form}>
39
  <SimilaritySlider isTooltipShown></SimilaritySlider>
 
40
  <Card size="small" title={t('testText')}>
41
  <Form.Item<FieldType>
42
  name={'question'}
 
2
  import { Button, Card, Divider, Flex, Form, Input } from 'antd';
3
  import { FormInstance } from 'antd/lib';
4
 
5
+ import Rerank from '@/components/rerank';
6
  import { useTranslate } from '@/hooks/commonHooks';
7
+ import { useFetchLlmList } from '@/hooks/llmHooks';
8
  import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
9
+ import { useEffect } from 'react';
10
  import styles from './index.less';
11
 
12
  type FieldType = {
 
26
  'testDocumentChunk',
27
  ]);
28
  const { t } = useTranslate('knowledgeDetails');
29
+ const fetchLlmList = useFetchLlmList();
30
+
31
+ useEffect(() => {
32
+ fetchLlmList();
33
+ }, [fetchLlmList]);
34
 
35
  const buttonDisabled =
36
  !question || (typeof question === 'string' && question.trim() === '');
 
45
  <section>
46
  <Form name="testing" layout="vertical" form={form}>
47
  <SimilaritySlider isTooltipShown></SimilaritySlider>
48
+ <Rerank></Rerank>
49
  <Card size="small" title={t('testText')}>
50
  <Form.Item<FieldType>
51
  name={'question'}
web/src/pages/chat/chat-configuration-modal/hooks.ts CHANGED
@@ -1,3 +1,4 @@
 
1
  import {
2
  useFetchTenantInfo,
3
  useSelectTenantInfo,
@@ -16,3 +17,13 @@ export const useFetchModelId = (visible: boolean) => {
16
 
17
  return tenantInfo?.llm_id ?? '';
18
  };
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useFetchLlmList } from '@/hooks/llmHooks';
2
  import {
3
  useFetchTenantInfo,
4
  useSelectTenantInfo,
 
17
 
18
  return tenantInfo?.llm_id ?? '';
19
  };
20
+
21
+ export const useFetchLlmModelOnVisible = (visible: boolean) => {
22
+ const fetchLlmList = useFetchLlmList();
23
+
24
+ useEffect(() => {
25
+ if (visible) {
26
+ fetchLlmList();
27
+ }
28
+ }, [fetchLlmList, visible]);
29
+ };
web/src/pages/chat/chat-configuration-modal/index.tsx CHANGED
@@ -14,7 +14,7 @@ import { variableEnabledFieldMap } from '../constants';
14
  import { IPromptConfigParameters } from '../interface';
15
  import { excludeUnEnabledVariables } from '../utils';
16
  import AssistantSetting from './assistant-setting';
17
- import { useFetchModelId } from './hooks';
18
  import ModelSetting from './model-setting';
19
  import PromptEngine from './prompt-engine';
20
 
@@ -92,6 +92,7 @@ const ChatConfigurationModal = ({
92
  const finalValues = {
93
  dialog_id: initialDialog.id,
94
  ...nextValues,
 
95
  prompt_config: {
96
  ...nextValues.prompt_config,
97
  parameters: promptEngineRef.current,
@@ -115,6 +116,8 @@ const ChatConfigurationModal = ({
115
  form.resetFields();
116
  };
117
 
 
 
118
  const title = (
119
  <Flex gap={16}>
120
  <ChatConfigurationAtom></ChatConfigurationAtom>
@@ -142,6 +145,7 @@ const ChatConfigurationModal = ({
142
  settledModelVariableMap[ModelVariableType.Precise],
143
  icon: fileList,
144
  llm_id: initialDialog.llm_id ?? modelId,
 
145
  });
146
  }
147
  }, [initialDialog, form, visible, modelId]);
 
14
  import { IPromptConfigParameters } from '../interface';
15
  import { excludeUnEnabledVariables } from '../utils';
16
  import AssistantSetting from './assistant-setting';
17
+ import { useFetchLlmModelOnVisible, useFetchModelId } from './hooks';
18
  import ModelSetting from './model-setting';
19
  import PromptEngine from './prompt-engine';
20
 
 
92
  const finalValues = {
93
  dialog_id: initialDialog.id,
94
  ...nextValues,
95
+ vector_similarity_weight: 1 - nextValues.vector_similarity_weight,
96
  prompt_config: {
97
  ...nextValues.prompt_config,
98
  parameters: promptEngineRef.current,
 
116
  form.resetFields();
117
  };
118
 
119
+ useFetchLlmModelOnVisible(visible);
120
+
121
  const title = (
122
  <Flex gap={16}>
123
  <ChatConfigurationAtom></ChatConfigurationAtom>
 
145
  settledModelVariableMap[ModelVariableType.Precise],
146
  icon: fileList,
147
  llm_id: initialDialog.llm_id ?? modelId,
148
+ vector_similarity_weight: 1 - initialDialog.vector_similarity_weight,
149
  });
150
  }
151
  }, [initialDialog, form, visible, modelId]);
web/src/pages/chat/chat-configuration-modal/model-setting.tsx CHANGED
@@ -10,7 +10,7 @@ import { useEffect } from 'react';
10
  import { ISegmentedContentProps } from '../interface';
11
 
12
  import { useTranslate } from '@/hooks/commonHooks';
13
- import { useFetchLlmList, useSelectLlmOptions } from '@/hooks/llmHooks';
14
  import { Variable } from '@/interfaces/database/chat';
15
  import { variableEnabledFieldMap } from '../constants';
16
  import styles from './index.less';
@@ -30,7 +30,7 @@ const ModelSetting = ({
30
  value: x,
31
  }));
32
 
33
- const modelOptions = useSelectLlmOptions();
34
 
35
  const handleParametersChange = (value: ModelVariableType) => {
36
  const variable = settledModelVariableMap[value];
@@ -56,8 +56,6 @@ const ModelSetting = ({
56
  }
57
  }, [form, initialLlmSetting, visible]);
58
 
59
- useFetchLlmList(LlmModelType.Chat);
60
-
61
  return (
62
  <section
63
  className={classNames({
@@ -70,7 +68,7 @@ const ModelSetting = ({
70
  tooltip={t('modelTip')}
71
  rules={[{ required: true, message: t('modelMessage') }]}
72
  >
73
- <Select options={modelOptions} showSearch />
74
  </Form.Item>
75
  <Divider></Divider>
76
  <Form.Item
 
10
  import { ISegmentedContentProps } from '../interface';
11
 
12
  import { useTranslate } from '@/hooks/commonHooks';
13
+ import { useSelectLlmOptionsByModelType } from '@/hooks/llmHooks';
14
  import { Variable } from '@/interfaces/database/chat';
15
  import { variableEnabledFieldMap } from '../constants';
16
  import styles from './index.less';
 
30
  value: x,
31
  }));
32
 
33
+ const modelOptions = useSelectLlmOptionsByModelType();
34
 
35
  const handleParametersChange = (value: ModelVariableType) => {
36
  const variable = settledModelVariableMap[value];
 
56
  }
57
  }, [form, initialLlmSetting, visible]);
58
 
 
 
59
  return (
60
  <section
61
  className={classNames({
 
68
  tooltip={t('modelTip')}
69
  rules={[{ required: true, message: t('modelMessage') }]}
70
  >
71
+ <Select options={modelOptions[LlmModelType.Chat]} showSearch />
72
  </Form.Item>
73
  <Divider></Divider>
74
  <Form.Item
web/src/pages/chat/chat-configuration-modal/prompt-engine.tsx CHANGED
@@ -29,6 +29,7 @@ import {
29
  } from '../interface';
30
  import { EditableCell, EditableRow } from './editable-cell';
31
 
 
32
  import { useTranslate } from '@/hooks/commonHooks';
33
  import { useSelectPromptConfigParameters } from '../hooks';
34
  import styles from './index.less';
@@ -172,7 +173,7 @@ const PromptEngine = (
172
  >
173
  <Slider max={30} />
174
  </Form.Item>
175
-
176
  <section className={classNames(styles.variableContainer)}>
177
  <Row align={'middle'} justify="end">
178
  <Col span={7} className={styles.variableAlign}>
 
29
  } from '../interface';
30
  import { EditableCell, EditableRow } from './editable-cell';
31
 
32
+ import Rerank from '@/components/rerank';
33
  import { useTranslate } from '@/hooks/commonHooks';
34
  import { useSelectPromptConfigParameters } from '../hooks';
35
  import styles from './index.less';
 
173
  >
174
  <Slider max={30} />
175
  </Form.Item>
176
+ <Rerank></Rerank>
177
  <section className={classNames(styles.variableContainer)}>
178
  <Row align={'middle'} justify="end">
179
  <Col span={7} className={styles.variableAlign}>
web/src/pages/user-setting/setting-model/system-model-setting-modal/index.tsx CHANGED
@@ -76,6 +76,13 @@ const SystemModelSettingModal = ({
76
  >
77
  <Select options={allOptions[LlmModelType.Speech2text]} />
78
  </Form.Item>
 
 
 
 
 
 
 
79
  </Form>
80
  </Modal>
81
  );
 
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>
87
  </Modal>
88
  );