fix(web): knowledge config
This commit is contained in:
@@ -1281,13 +1281,13 @@ export const en = {
|
|||||||
hybrid: 'Hybrid Retrieval',
|
hybrid: 'Hybrid Retrieval',
|
||||||
graph: 'Graph Retrieval',
|
graph: 'Graph Retrieval',
|
||||||
|
|
||||||
similarity_threshold: 'Semantic similarity threshold',
|
vector_similarity_weight: 'Semantic similarity threshold',
|
||||||
similarity_threshold_desc: 'Only return results with semantic similarity higher than this threshold',
|
vector_similarity_weight_desc: 'Only return results with semantic similarity higher than this threshold',
|
||||||
similarity_threshold_desc1: 'The minimum similarity threshold for semantic retrieval',
|
vector_similarity_weight_desc1: 'The minimum similarity threshold for semantic retrieval',
|
||||||
|
|
||||||
vector_similarity_weight: 'Vector Similarity Weight',
|
similarity_threshold: 'Vector Similarity Weight',
|
||||||
vector_similarity_weight_desc: 'Only return results with BM25 scores above this threshold',
|
similarity_threshold_desc: 'Only return results with BM25 scores above this threshold',
|
||||||
vector_similarity_weight_desc1: 'The minimum BM25 score threshold for word segmentation retrieval',
|
similarity_threshold_desc1: 'The minimum BM25 score threshold for word segmentation retrieval',
|
||||||
|
|
||||||
description: 'Description',
|
description: 'Description',
|
||||||
shareVersion: 'Share Version',
|
shareVersion: 'Share Version',
|
||||||
|
|||||||
@@ -663,13 +663,13 @@ export const zh = {
|
|||||||
hybrid: '混合检索',
|
hybrid: '混合检索',
|
||||||
graph: '图谱检索',
|
graph: '图谱检索',
|
||||||
|
|
||||||
similarity_threshold: '语义相似度阈值',
|
similarity_threshold: '向量相似度权重',
|
||||||
similarity_threshold_desc: '仅返回语义相似度高于此阈值的结果',
|
similarity_threshold_desc: '仅返回BM25分数高于此阈值的结果',
|
||||||
similarity_threshold_desc1: '语义检索的最小相似度阈值',
|
similarity_threshold_desc1: '分词检索的最小BM25分数阈值',
|
||||||
|
|
||||||
vector_similarity_weight: '向量相似度权重',
|
vector_similarity_weight: '语义相似度阈值',
|
||||||
vector_similarity_weight_desc: '仅返回BM25分数高于此阈值的结果',
|
vector_similarity_weight_desc: '仅返回语义相似度高于此阈值的结果',
|
||||||
vector_similarity_weight_desc1: '分词检索的最小BM25分数阈值',
|
vector_similarity_weight_desc1: '语义检索的最小相似度阈值',
|
||||||
|
|
||||||
description: '描述',
|
description: '描述',
|
||||||
shareVersion: '分享版本',
|
shareVersion: '分享版本',
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (values?.retrieve_type) {
|
if (values?.retrieve_type) {
|
||||||
const fieldsToReset = Object.keys(values).filter(key =>
|
const fieldsToReset = Object.keys(values).filter(key =>
|
||||||
key !== 'kb_id' && key !== 'retrieve_type' && key !== 'top_k'
|
key !== 'kb_id' && key !== 'retrieve_type' && key !== 'top_k'
|
||||||
) as (keyof KnowledgeConfigForm)[];
|
) as (keyof KnowledgeConfigForm)[];
|
||||||
form.resetFields(fieldsToReset);
|
form.resetFields(fieldsToReset);
|
||||||
@@ -127,7 +127,7 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
extra={t('application.retrieve_type_desc')}
|
extra={t('application.retrieve_type_desc')}
|
||||||
rules={[{ required: true, message: t('common.pleaseSelect') }]}
|
rules={[{ required: true, message: t('common.pleaseSelect') }]}
|
||||||
>
|
>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
options={retrieveTypes.map(key => ({
|
options={retrieveTypes.map(key => ({
|
||||||
label: t(`application.${key}`),
|
label: t(`application.${key}`),
|
||||||
@@ -150,33 +150,35 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
onChange={(value) => form.setFieldValue('top_k', value)}
|
onChange={(value) => form.setFieldValue('top_k', value)}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
{/* Semantic similarity threshold */}
|
{/* Vector similarity weight */}
|
||||||
{values?.retrieve_type === 'semantic' && (
|
{values?.retrieve_type === 'semantic' && (
|
||||||
<FormItem
|
|
||||||
name="similarity_threshold"
|
|
||||||
label={t('application.similarity_threshold')}
|
|
||||||
extra={t('application.similarity_threshold_desc')}
|
|
||||||
initialValue={0.5}
|
|
||||||
>
|
|
||||||
<RbSlider
|
|
||||||
max={1.0}
|
|
||||||
step={0.1}
|
|
||||||
min={0.0}
|
|
||||||
/>
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
{/* Word segmentation matching threshold */}
|
|
||||||
{values?.retrieve_type === 'participle' && (
|
|
||||||
<FormItem
|
<FormItem
|
||||||
name="vector_similarity_weight"
|
name="vector_similarity_weight"
|
||||||
label={t('application.vector_similarity_weight')}
|
label={t('application.vector_similarity_weight')}
|
||||||
extra={t('application.vector_similarity_weight_desc')}
|
extra={t('application.vector_similarity_weight_desc')}
|
||||||
initialValue={0.5}
|
initialValue={0.5}
|
||||||
>
|
>
|
||||||
<RbSlider
|
<RbSlider
|
||||||
max={1.0}
|
max={1.0}
|
||||||
step={0.1}
|
step={0.1}
|
||||||
min={0.0}
|
min={0.0}
|
||||||
|
isInput={true}
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
{/* Semantic similarity threshold */}
|
||||||
|
{values?.retrieve_type === 'participle' && (
|
||||||
|
<FormItem
|
||||||
|
name="similarity_threshold"
|
||||||
|
label={t('application.similarity_threshold')}
|
||||||
|
extra={t('application.similarity_threshold_desc')}
|
||||||
|
initialValue={0.5}
|
||||||
|
>
|
||||||
|
<RbSlider
|
||||||
|
max={1.0}
|
||||||
|
step={0.1}
|
||||||
|
min={0.0}
|
||||||
|
isInput={true}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
@@ -189,10 +191,11 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
extra={t('application.similarity_threshold_desc1')}
|
extra={t('application.similarity_threshold_desc1')}
|
||||||
initialValue={0.5}
|
initialValue={0.5}
|
||||||
>
|
>
|
||||||
<RbSlider
|
<RbSlider
|
||||||
max={1.0}
|
max={1.0}
|
||||||
step={0.1}
|
step={0.1}
|
||||||
min={0.0}
|
min={0.0}
|
||||||
|
isInput={true}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem
|
||||||
@@ -201,10 +204,11 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
extra={t('application.vector_similarity_weight_desc1')}
|
extra={t('application.vector_similarity_weight_desc1')}
|
||||||
initialValue={0.5}
|
initialValue={0.5}
|
||||||
>
|
>
|
||||||
<RbSlider
|
<RbSlider
|
||||||
max={1.0}
|
max={1.0}
|
||||||
step={0.1}
|
step={0.1}
|
||||||
min={0.0}
|
min={0.0}
|
||||||
|
isInput={true}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (values?.retrieve_type) {
|
if (values?.retrieve_type) {
|
||||||
const fieldsToReset = Object.keys(values).filter(key =>
|
const fieldsToReset = Object.keys(values).filter(key =>
|
||||||
key !== 'kb_id' && key !== 'retrieve_type' && key !== 'top_k'
|
key !== 'kb_id' && key !== 'retrieve_type' && key !== 'top_k'
|
||||||
) as (keyof KnowledgeConfigForm)[];
|
) as (keyof KnowledgeConfigForm)[];
|
||||||
form.resetFields(fieldsToReset);
|
form.resetFields(fieldsToReset);
|
||||||
@@ -91,7 +91,7 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
<Flex align="center" justify="space-between" className="rb:mb-6! rb-border rb:rounded-lg rb:p-[17px_16px]! rb:cursor-pointer rb:bg-[#F0F3F8] rb:text-[#212332]">
|
<Flex align="center" justify="space-between" className="rb:mb-6! rb-border rb:rounded-lg rb:p-[17px_16px]! rb:cursor-pointer rb:bg-[#F0F3F8] rb:text-[#212332]">
|
||||||
<div className="rb:text-[16px] rb:leading-5.5">
|
<div className="rb:text-[16px] rb:leading-5.5">
|
||||||
{data.name}
|
{data.name}
|
||||||
<div className="rb:text-[12px] rb:leading-4 rb:text-[#5B6167] rb:mt-2">{t('application.contains', {include_count: data.doc_num})}</div>
|
<div className="rb:text-[12px] rb:leading-4 rb:text-[#5B6167] rb:mt-2">{t('application.contains', { include_count: data.doc_num })}</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="rb:text-[12px] rb:leading-4 rb:text-[#5B6167]">{formatDateTime(data.updated_at, 'YYYY-MM-DD HH:mm:ss')}</div>
|
<div className="rb:text-[12px] rb:leading-4 rb:text-[#5B6167]">{formatDateTime(data.updated_at, 'YYYY-MM-DD HH:mm:ss')}</div>
|
||||||
</Flex>
|
</Flex>
|
||||||
@@ -104,13 +104,12 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
extra={t('application.retrieve_type_desc')}
|
extra={t('application.retrieve_type_desc')}
|
||||||
rules={[{ required: true, message: t('common.pleaseSelect') }]}
|
rules={[{ required: true, message: t('common.pleaseSelect') }]}
|
||||||
>
|
>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
options={retrieveTypes.map(key => ({
|
options={retrieveTypes.map(key => ({
|
||||||
label: t(`application.${key}`),
|
label: t(`application.${key}`),
|
||||||
value: key,
|
value: key,
|
||||||
}))}
|
}))}
|
||||||
// onChange={handleChange}
|
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
{/* Top K */}
|
{/* Top K */}
|
||||||
@@ -124,34 +123,18 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
min={1}
|
min={1}
|
||||||
max={20}
|
max={20}
|
||||||
// onChange={(value) => form.setFieldValue('top_k', value)}
|
onChange={(value) => form.setFieldValue('top_k', value)}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
{/* 语义相似度阈值 similarity_threshold */}
|
{/* Vector similarity weight */}
|
||||||
{values?.retrieve_type === 'semantic' && (
|
{values?.retrieve_type === 'semantic' && (
|
||||||
<FormItem
|
|
||||||
name="similarity_threshold"
|
|
||||||
label={t('application.similarity_threshold')}
|
|
||||||
extra={t('application.similarity_threshold_desc')}
|
|
||||||
initialValue={0.5}
|
|
||||||
>
|
|
||||||
<RbSlider
|
|
||||||
max={1.0}
|
|
||||||
step={0.1}
|
|
||||||
min={0.0}
|
|
||||||
isInput={true}
|
|
||||||
/>
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
{/* 分词匹配度阈值 vector_similarity_weight */}
|
|
||||||
{values?.retrieve_type === 'participle' && (
|
|
||||||
<FormItem
|
<FormItem
|
||||||
name="vector_similarity_weight"
|
name="vector_similarity_weight"
|
||||||
label={t('application.vector_similarity_weight')}
|
label={t('application.vector_similarity_weight')}
|
||||||
extra={t('application.vector_similarity_weight_desc')}
|
extra={t('application.vector_similarity_weight_desc')}
|
||||||
initialValue={0.5}
|
initialValue={0.5}
|
||||||
>
|
>
|
||||||
<RbSlider
|
<RbSlider
|
||||||
max={1.0}
|
max={1.0}
|
||||||
step={0.1}
|
step={0.1}
|
||||||
min={0.0}
|
min={0.0}
|
||||||
@@ -159,7 +142,23 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
{/* 混合检索权重 */}
|
{/* similarity threshold */}
|
||||||
|
{values?.retrieve_type === 'participle' && (
|
||||||
|
<FormItem
|
||||||
|
name="similarity_threshold"
|
||||||
|
label={t('application.similarity_threshold')}
|
||||||
|
extra={t('application.similarity_threshold_desc')}
|
||||||
|
initialValue={0.5}
|
||||||
|
>
|
||||||
|
<RbSlider
|
||||||
|
max={1.0}
|
||||||
|
step={0.1}
|
||||||
|
min={0.0}
|
||||||
|
isInput={true}
|
||||||
|
/>
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
{/* Hybrid retrieval weight */}
|
||||||
{values?.retrieve_type === 'hybrid' && (
|
{values?.retrieve_type === 'hybrid' && (
|
||||||
<>
|
<>
|
||||||
<FormItem
|
<FormItem
|
||||||
@@ -168,7 +167,7 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
extra={t('application.similarity_threshold_desc1')}
|
extra={t('application.similarity_threshold_desc1')}
|
||||||
initialValue={0.5}
|
initialValue={0.5}
|
||||||
>
|
>
|
||||||
<RbSlider
|
<RbSlider
|
||||||
max={1.0}
|
max={1.0}
|
||||||
step={0.1}
|
step={0.1}
|
||||||
min={0.0}
|
min={0.0}
|
||||||
@@ -181,7 +180,7 @@ const KnowledgeConfigModal = forwardRef<KnowledgeConfigModalRef, KnowledgeConfig
|
|||||||
extra={t('application.vector_similarity_weight_desc1')}
|
extra={t('application.vector_similarity_weight_desc1')}
|
||||||
initialValue={0.5}
|
initialValue={0.5}
|
||||||
>
|
>
|
||||||
<RbSlider
|
<RbSlider
|
||||||
max={1.0}
|
max={1.0}
|
||||||
step={0.1}
|
step={0.1}
|
||||||
min={0.0}
|
min={0.0}
|
||||||
|
|||||||
Reference in New Issue
Block a user