2024-02-20 18:10:20 +08:00
|
|
|
import { Form, Input, Select } from 'antd';
|
2024-02-19 19:16:23 +08:00
|
|
|
|
|
|
|
|
import classNames from 'classnames';
|
2024-02-22 17:14:25 +08:00
|
|
|
import { ISegmentedContentProps } from '../interface';
|
2024-02-19 19:16:23 +08:00
|
|
|
|
2024-02-20 18:10:20 +08:00
|
|
|
import { useFetchKnowledgeList } from '@/hooks/knowledgeHook';
|
2024-02-19 19:16:23 +08:00
|
|
|
import styles from './index.less';
|
|
|
|
|
|
|
|
|
|
const AssistantSetting = ({ show }: ISegmentedContentProps) => {
|
2024-02-22 17:14:25 +08:00
|
|
|
const knowledgeList = useFetchKnowledgeList(true);
|
2024-02-20 18:10:20 +08:00
|
|
|
const knowledgeOptions = knowledgeList.map((x) => ({
|
|
|
|
|
label: x.name,
|
|
|
|
|
value: x.id,
|
|
|
|
|
}));
|
|
|
|
|
|
2024-02-19 19:16:23 +08:00
|
|
|
return (
|
|
|
|
|
<section
|
|
|
|
|
className={classNames({
|
|
|
|
|
[styles.segmentedHidden]: !show,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<Form.Item
|
|
|
|
|
name={'name'}
|
|
|
|
|
label="Assistant name"
|
|
|
|
|
rules={[{ required: true }]}
|
|
|
|
|
>
|
|
|
|
|
<Input placeholder="e.g. Resume Jarvis" />
|
|
|
|
|
</Form.Item>
|
2024-02-20 18:10:20 +08:00
|
|
|
<Form.Item name={'icon'} label="Assistant avatar">
|
2024-02-19 19:16:23 +08:00
|
|
|
<Input />
|
|
|
|
|
</Form.Item>
|
2024-02-20 18:10:20 +08:00
|
|
|
<Form.Item name={'language'} label="Language" initialValue={'Chinese'}>
|
|
|
|
|
<Select
|
|
|
|
|
options={[
|
|
|
|
|
{ value: 'Chinese', label: 'Chinese' },
|
|
|
|
|
{ value: 'English', label: 'English' },
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item
|
|
|
|
|
name={['prompt_config', 'empty_response']}
|
|
|
|
|
label="Empty response"
|
|
|
|
|
>
|
|
|
|
|
<Input placeholder="" />
|
2024-02-19 19:16:23 +08:00
|
|
|
</Form.Item>
|
2024-02-20 18:10:20 +08:00
|
|
|
<Form.Item name={['prompt_config', 'prologue']} label="Set an opener">
|
2024-02-19 19:16:23 +08:00
|
|
|
<Input.TextArea autoSize={{ minRows: 5 }} />
|
|
|
|
|
</Form.Item>
|
2024-02-20 18:10:20 +08:00
|
|
|
<Form.Item
|
|
|
|
|
label="Select one context"
|
|
|
|
|
name="kb_ids"
|
|
|
|
|
rules={[
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: 'Please select!',
|
|
|
|
|
type: 'array',
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
>
|
|
|
|
|
<Select
|
|
|
|
|
mode="multiple"
|
|
|
|
|
options={knowledgeOptions}
|
|
|
|
|
placeholder="Please select"
|
|
|
|
|
></Select>
|
|
|
|
|
</Form.Item>
|
2024-02-19 19:16:23 +08:00
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default AssistantSetting;
|