V4.8.16 dev (#3431)
* feat: add feishu & yuque dataset (#3379) * feat: add feishu & yuque dataset * fix ts * fix ts * move type position * fix * fix: merge interface * fix * feat: dingtalk sso support (#3408) * fix: optional sso state * feat: dingtalk bot * feat: dingtalk sso login * chore: move i18n to user namespace * feat: dingtalk bot integration (#3415) * feat: dingtalk bot integration * docs: config dingtalk bot * feat:sear XNG服务 (#3413) * feat:sear XNG服务 * 补充了courseUrl * 添加了官方文档 * 错误时返回情况修正了一下 * Tracks (#3420) * feat: node intro * feat: add domain track * dingding sso login * perf: api dataset code and add doc * feat: tracks * feat: searXNG plugins * fix: ts * feat: delete node tracks (#3423) * fix: dingtalk bot GET verification (#3424) * 4.8.16 test: fix: plugin inputs render;fix: ui offset (#3426) * fix: ui offset * perf: dingding talk * fix: plugin inputs render * feat: menu all folder (#3429) * fix: recall code --------- Co-authored-by: heheer <heheer@sealos.io> Co-authored-by: a.e. <49438478+I-Info@users.noreply.github.com> Co-authored-by: Jiangween <145003935+Jiangween@users.noreply.github.com>
This commit is contained in:
166
projects/app/src/pages/dataset/component/ApiDatasetForm.tsx
Normal file
166
projects/app/src/pages/dataset/component/ApiDatasetForm.tsx
Normal file
@@ -0,0 +1,166 @@
|
||||
import React from 'react';
|
||||
import { DatasetTypeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||
import { Flex, Input } from '@chakra-ui/react';
|
||||
import { UseFormReturn } from 'react-hook-form';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import type {
|
||||
APIFileServer,
|
||||
FeishuServer,
|
||||
YuqueServer
|
||||
} from '@fastgpt/global/core/dataset/apiDataset';
|
||||
|
||||
const ApiDatasetForm = ({
|
||||
type,
|
||||
form
|
||||
}: {
|
||||
type: `${DatasetTypeEnum}`;
|
||||
form: UseFormReturn<
|
||||
{
|
||||
apiServer?: APIFileServer;
|
||||
feishuServer?: FeishuServer;
|
||||
yuqueServer?: YuqueServer;
|
||||
},
|
||||
any
|
||||
>;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { register } = form;
|
||||
|
||||
return (
|
||||
<>
|
||||
{type === DatasetTypeEnum.apiDataset && (
|
||||
<>
|
||||
<Flex mt={6}>
|
||||
<Flex
|
||||
alignItems={'center'}
|
||||
flex={['', '0 0 110px']}
|
||||
color={'myGray.900'}
|
||||
fontWeight={500}
|
||||
fontSize={'sm'}
|
||||
>
|
||||
{t('dataset:api_url')}
|
||||
</Flex>
|
||||
<Input
|
||||
bg={'myWhite.600'}
|
||||
placeholder={t('dataset:api_url')}
|
||||
maxLength={200}
|
||||
{...register('apiServer.baseUrl', { required: true })}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex mt={6}>
|
||||
<Flex
|
||||
alignItems={'center'}
|
||||
flex={['', '0 0 110px']}
|
||||
color={'myGray.900'}
|
||||
fontWeight={500}
|
||||
fontSize={'sm'}
|
||||
>
|
||||
Authorization
|
||||
</Flex>
|
||||
<Input
|
||||
bg={'myWhite.600'}
|
||||
placeholder={t('dataset:request_headers')}
|
||||
maxLength={200}
|
||||
{...register('apiServer.authorization')}
|
||||
/>
|
||||
</Flex>
|
||||
</>
|
||||
)}
|
||||
{type === DatasetTypeEnum.feishu && (
|
||||
<>
|
||||
<Flex mt={6}>
|
||||
<Flex
|
||||
alignItems={'center'}
|
||||
flex={['', '0 0 110px']}
|
||||
color={'myGray.900'}
|
||||
fontWeight={500}
|
||||
fontSize={'sm'}
|
||||
>
|
||||
App ID
|
||||
</Flex>
|
||||
<Input
|
||||
bg={'myWhite.600'}
|
||||
placeholder={'App ID'}
|
||||
maxLength={200}
|
||||
{...register('feishuServer.appId', { required: true })}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex mt={6}>
|
||||
<Flex
|
||||
alignItems={'center'}
|
||||
flex={['', '0 0 110px']}
|
||||
color={'myGray.900'}
|
||||
fontWeight={500}
|
||||
fontSize={'sm'}
|
||||
>
|
||||
App Secret
|
||||
</Flex>
|
||||
<Input
|
||||
bg={'myWhite.600'}
|
||||
placeholder={'App Secret'}
|
||||
maxLength={200}
|
||||
{...register('feishuServer.appSecret', { required: true })}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex mt={6}>
|
||||
<Flex
|
||||
alignItems={'center'}
|
||||
flex={['', '0 0 110px']}
|
||||
color={'myGray.900'}
|
||||
fontWeight={500}
|
||||
fontSize={'sm'}
|
||||
>
|
||||
Folder Token
|
||||
</Flex>
|
||||
<Input
|
||||
bg={'myWhite.600'}
|
||||
placeholder={'Folder Token'}
|
||||
maxLength={200}
|
||||
{...register('feishuServer.folderToken', { required: true })}
|
||||
/>
|
||||
</Flex>
|
||||
</>
|
||||
)}
|
||||
{type === DatasetTypeEnum.yuque && (
|
||||
<>
|
||||
<Flex mt={6}>
|
||||
<Flex
|
||||
alignItems={'center'}
|
||||
flex={['', '0 0 110px']}
|
||||
color={'myGray.900'}
|
||||
fontWeight={500}
|
||||
fontSize={'sm'}
|
||||
>
|
||||
User ID
|
||||
</Flex>
|
||||
<Input
|
||||
bg={'myWhite.600'}
|
||||
placeholder={'Token'}
|
||||
maxLength={200}
|
||||
{...register('yuqueServer.userId', { required: true })}
|
||||
/>
|
||||
</Flex>
|
||||
<Flex mt={6}>
|
||||
<Flex
|
||||
alignItems={'center'}
|
||||
flex={['', '0 0 110px']}
|
||||
color={'myGray.900'}
|
||||
fontWeight={500}
|
||||
fontSize={'sm'}
|
||||
>
|
||||
Token
|
||||
</Flex>
|
||||
<Input
|
||||
bg={'myWhite.600'}
|
||||
placeholder={'Token'}
|
||||
maxLength={200}
|
||||
{...register('yuqueServer.token', { required: true })}
|
||||
/>
|
||||
</Flex>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ApiDatasetForm;
|
||||
Reference in New Issue
Block a user