Skip to content

Commit

Permalink
feat: Limit the maximum value of auto keywords to 30 infiniflow#2687
Browse files Browse the repository at this point in the history
  • Loading branch information
cike8899 committed Oct 23, 2024
1 parent ec6d942 commit 69f70c2
Showing 1 changed file with 39 additions and 19 deletions.
58 changes: 39 additions & 19 deletions web/src/components/auto-keywords-item.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
import { useTranslate } from '@/hooks/common-hooks';
import { Form, InputNumber } from 'antd';

const style = {
width: '100%',
};
import { Flex, Form, InputNumber, Slider } from 'antd';

export const AutoKeywordsItem = () => {
const { t } = useTranslate('knowledgeDetails');

return (
<Form.Item
label={t('autoKeywords')}
name={['parser_config', 'auto_keywords']}
tooltip={t('autoKeywordsTip')}
initialValue={0}
>
<InputNumber style={style}></InputNumber>
<Form.Item label={t('autoKeywords')} tooltip={t('autoKeywordsTip')}>
<Flex gap={20} align="center">
<Flex flex={1}>
<Form.Item
name={['parser_config', 'auto_keywords']}
noStyle
initialValue={0}
>
<Slider max={30} style={{ width: '100%' }} />
</Form.Item>
</Flex>
<Form.Item
name={['parser_config', 'auto_keywords']}
noStyle
initialValue={0}
>
<InputNumber max={30} min={0} />
</Form.Item>
</Flex>
</Form.Item>
);
};
Expand All @@ -24,13 +32,25 @@ export const AutoQuestionsItem = () => {
const { t } = useTranslate('knowledgeDetails');

return (
<Form.Item
label={t('autoQuestions')}
name={['parser_config', 'auto_questions']}
tooltip={t('autoQuestionsTip')}
initialValue={0}
>
<InputNumber style={style}></InputNumber>
<Form.Item label={t('autoQuestions')} tooltip={t('autoQuestionsTip')}>
<Flex gap={20} align="center">
<Flex flex={1}>
<Form.Item
name={['parser_config', 'auto_questions']}
noStyle
initialValue={0}
>
<Slider max={10} style={{ width: '100%' }} />
</Form.Item>
</Flex>
<Form.Item
name={['parser_config', 'auto_questions']}
noStyle
initialValue={0}
>
<InputNumber max={10} min={0} />
</Form.Item>
</Flex>
</Form.Item>
);
};

0 comments on commit 69f70c2

Please sign in to comment.