mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-08 20:39:44 +00:00
feat(ChatKnowledge):chunk add enable_merge parameter (#1014)
Co-authored-by: Aralhi <xiaoping0501@gmail.com>
This commit is contained in:
@@ -47,7 +47,7 @@ export default function ArgumentsModal({ space, argumentsShow, setArgumentsShow
|
||||
</Form.Item>
|
||||
</Col>
|
||||
<Col span={12}>
|
||||
<Form.Item<IArguments> tooltip={t(`Recall_Type`)} rules={[{ required: true }]} label={t('recall_type')} name={['embedding', 'recall_type']}>
|
||||
<Form.Item<IArguments> tooltip={t(`recall_type`)} rules={[{ required: true }]} label={t('recall_type')} name={['embedding', 'recall_type']}>
|
||||
<Input className="mb-5 h-12" />
|
||||
</Form.Item>
|
||||
</Col>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { IChunkStrategyResponse } from '@/types/knowledge';
|
||||
import { Alert, Form, FormListFieldData, Input, InputNumber, Radio, RadioChangeEvent } from 'antd';
|
||||
import { Alert, Checkbox, Form, FormListFieldData, Input, InputNumber, Radio, RadioChangeEvent } from 'antd';
|
||||
import { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
const { TextArea } = Input;
|
||||
@@ -25,7 +25,7 @@ export default function StrategyForm({ strategies, docType, fileName, field }: I
|
||||
const [selectedStrategy, setSelectedStrategy] = useState<string>();
|
||||
const { t } = useTranslation();
|
||||
const DEFAULT_STRATEGY = {
|
||||
strategy: t('Automatic'),
|
||||
strategy: 'Automatic',
|
||||
name: t('Automatic'),
|
||||
desc: t('Automatic_desc'),
|
||||
};
|
||||
@@ -50,17 +50,30 @@ export default function StrategyForm({ strategies, docType, fileName, field }: I
|
||||
{parameters?.map((param) => (
|
||||
<Form.Item
|
||||
key={`param_${param.param_name}`}
|
||||
label={`${param.param_name}: ${param.param_type}`}
|
||||
label={param.param_name}
|
||||
name={[field!.name, 'chunk_parameters', param.param_name]}
|
||||
rules={[{ required: true, message: t('Please_input_the_name') }]}
|
||||
initialValue={param.default_value}
|
||||
valuePropName={param.param_type === 'boolean' ? 'checked' : 'value'}
|
||||
tooltip={param.description}
|
||||
>
|
||||
{param.param_type === 'int' ? <InputNumber className="w-full" min={1} /> : <TextArea className="w-full" rows={2} maxLength={6} />}
|
||||
{renderParamByType(param.param_type)}
|
||||
</Form.Item>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function renderParamByType(type: string) {
|
||||
switch (type) {
|
||||
case 'int':
|
||||
return <InputNumber className="w-full" min={1} />;
|
||||
case 'string':
|
||||
return <TextArea className="w-full" rows={2} />;
|
||||
case 'boolean':
|
||||
return <Checkbox />;
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Form.Item name={[field!.name, 'chunk_parameters', 'chunk_strategy']} initialValue={DEFAULT_STRATEGY.strategy}>
|
||||
|
Reference in New Issue
Block a user