File size: 1,855 Bytes
8c4ec99
452020d
 
058cd84
452020d
8c4ec99
452020d
 
 
058cd84
8c4ec99
 
 
 
 
452020d
 
 
 
 
 
 
 
 
 
 
 
 
8c4ec99
452020d
 
8c4ec99
 
 
 
 
 
 
 
 
 
 
 
 
452020d
8c4ec99
452020d
 
8c4ec99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
452020d
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { Form, Input, Select } from 'antd';

import classNames from 'classnames';
import { ISegmentedContentProps } from '../interface';

import { useFetchKnowledgeList } from '@/hooks/knowledgeHook';
import styles from './index.less';

const AssistantSetting = ({ show }: ISegmentedContentProps) => {
  const knowledgeList = useFetchKnowledgeList(true);
  const knowledgeOptions = knowledgeList.map((x) => ({
    label: x.name,
    value: x.id,
  }));

  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>
      <Form.Item name={'icon'} label="Assistant avatar">
        <Input />
      </Form.Item>
      <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="" />
      </Form.Item>
      <Form.Item name={['prompt_config', 'prologue']} label="Set an opener">
        <Input.TextArea autoSize={{ minRows: 5 }} />
      </Form.Item>
      <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>
    </section>
  );
};

export default AssistantSetting;