| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 | 
							- import { PlusOutlined } from '@ant-design/icons';
 - import { Form, Input, message, Select, Switch, Upload } from 'antd';
 - import classNames from 'classnames';
 - import { ISegmentedContentProps } from '../interface';
 - 
 - import KnowledgeBaseItem from '@/components/knowledge-base-item';
 - import { useTranslate } from '@/hooks/common-hooks';
 - import { useFetchTenantInfo } from '@/hooks/user-setting-hooks';
 - import { useCallback } from 'react';
 - import styles from './index.less';
 - 
 - const AssistantSetting = ({ show, form }: ISegmentedContentProps) => {
 -   const { t } = useTranslate('chat');
 -   const { data } = useFetchTenantInfo();
 - 
 -   const normFile = (e: any) => {
 -     if (Array.isArray(e)) {
 -       return e;
 -     }
 -     return e?.fileList;
 -   };
 - 
 -   const handleTtsChange = useCallback(
 -     (checked: boolean) => {
 -       if (checked && !data.tts_id) {
 -         message.error(`Please set TTS model firstly. 
 -         Setting >> Model providers >> System model settings`);
 -         form.setFieldValue(['prompt_config', 'tts'], false);
 -       }
 -     },
 -     [data, form],
 -   );
 - 
 -   const uploadButtion = (
 -     <button style={{ border: 0, background: 'none' }} type="button">
 -       <PlusOutlined />
 -       <div style={{ marginTop: 8 }}>{t('upload', { keyPrefix: 'common' })}</div>
 -     </button>
 -   );
 - 
 -   return (
 -     <section
 -       className={classNames({
 -         [styles.segmentedHidden]: !show,
 -       })}
 -     >
 -       <Form.Item
 -         name={'name'}
 -         label={t('assistantName')}
 -         rules={[{ required: true, message: t('assistantNameMessage') }]}
 -       >
 -         <Input placeholder={t('namePlaceholder')} />
 -       </Form.Item>
 -       <Form.Item name={'description'} label={t('description')}>
 -         <Input placeholder={t('descriptionPlaceholder')} />
 -       </Form.Item>
 -       <Form.Item
 -         name="icon"
 -         label={t('assistantAvatar')}
 -         valuePropName="fileList"
 -         getValueFromEvent={normFile}
 -       >
 -         <Upload
 -           listType="picture-card"
 -           maxCount={1}
 -           beforeUpload={() => false}
 -           showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
 -         >
 -           {show ? uploadButtion : null}
 -         </Upload>
 -       </Form.Item>
 -       <Form.Item
 -         name={'language'}
 -         label={t('language')}
 -         initialValue={'English'}
 -         tooltip="coming soon"
 -         style={{ display: 'none' }}
 -       >
 -         <Select
 -           options={[
 -             { value: 'Chinese', label: t('chinese', { keyPrefix: 'common' }) },
 -             { value: 'English', label: t('english', { keyPrefix: 'common' }) },
 -           ]}
 -         />
 -       </Form.Item>
 -       <Form.Item
 -         name={['prompt_config', 'empty_response']}
 -         label={t('emptyResponse')}
 -         tooltip={t('emptyResponseTip')}
 -       >
 -         <Input placeholder="" />
 -       </Form.Item>
 -       <Form.Item
 -         name={['prompt_config', 'prologue']}
 -         label={t('setAnOpener')}
 -         tooltip={t('setAnOpenerTip')}
 -         initialValue={t('setAnOpenerInitial')}
 -       >
 -         <Input.TextArea autoSize={{ minRows: 5 }} />
 -       </Form.Item>
 -       <Form.Item
 -         label={t('quote')}
 -         valuePropName="checked"
 -         name={['prompt_config', 'quote']}
 -         tooltip={t('quoteTip')}
 -         initialValue={true}
 -       >
 -         <Switch />
 -       </Form.Item>
 -       <Form.Item
 -         label={t('keyword')}
 -         valuePropName="checked"
 -         name={['prompt_config', 'keyword']}
 -         tooltip={t('keywordTip')}
 -         initialValue={false}
 -       >
 -         <Switch />
 -       </Form.Item>
 -       {/* <Form.Item
 -         label={t('selfRag')}
 -         valuePropName="checked"
 -         name={['prompt_config', 'self_rag']}
 -         tooltip={t('selfRagTip')}
 -         initialValue={false}
 -       >
 -         <Switch />
 -       </Form.Item> */}
 -       <Form.Item
 -         label={t('tts')}
 -         valuePropName="checked"
 -         name={['prompt_config', 'tts']}
 -         tooltip={t('ttsTip')}
 -         initialValue={false}
 -       >
 -         <Switch onChange={handleTtsChange} />
 -       </Form.Item>
 -       <KnowledgeBaseItem></KnowledgeBaseItem>
 -     </section>
 -   );
 - };
 - 
 - export default AssistantSetting;
 
 
  |