mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 20:27:45 +00:00
V4.6.5-alpha (#609)
This commit is contained in:
@@ -9,7 +9,7 @@ export const postUploadFiles = (
|
||||
onUploadProgress: (progressEvent: AxiosProgressEvent) => void
|
||||
) =>
|
||||
POST<string[]>('/common/file/upload', data, {
|
||||
timeout: 0,
|
||||
timeout: 480000,
|
||||
onUploadProgress,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data; charset=utf-8'
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useMemo, useRef, useState } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useDisclosure, Button, ModalBody, ModalFooter } from '@chakra-ui/react';
|
||||
import { useTranslation } from 'next-i18next';
|
||||
import MyModal from '@/components/MyModal';
|
||||
@@ -7,7 +7,6 @@ export const useConfirm = (props?: {
|
||||
title?: string;
|
||||
iconSrc?: string | '';
|
||||
content?: string;
|
||||
bg?: string;
|
||||
showCancel?: boolean;
|
||||
type?: 'common' | 'delete';
|
||||
}) => {
|
||||
@@ -34,7 +33,6 @@ export const useConfirm = (props?: {
|
||||
title = map?.title || t('Warning'),
|
||||
iconSrc = map?.iconSrc,
|
||||
content,
|
||||
bg = map?.bg,
|
||||
showCancel = true
|
||||
} = props || {};
|
||||
const [customContent, setCustomContent] = useState(content);
|
||||
@@ -57,43 +55,72 @@ export const useConfirm = (props?: {
|
||||
[onOpen]
|
||||
),
|
||||
ConfirmModal: useCallback(
|
||||
({ isLoading }: { isLoading?: boolean }) => (
|
||||
<MyModal
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
iconSrc={iconSrc}
|
||||
title={title}
|
||||
maxW={['90vw', '500px']}
|
||||
>
|
||||
<ModalBody pt={5}>{customContent}</ModalBody>
|
||||
<ModalFooter>
|
||||
{showCancel && (
|
||||
({
|
||||
closeText = t('Cancel'),
|
||||
confirmText = t('Confirm'),
|
||||
isLoading,
|
||||
bg,
|
||||
countDown = 0
|
||||
}: {
|
||||
closeText?: string;
|
||||
confirmText?: string;
|
||||
isLoading?: boolean;
|
||||
bg?: string;
|
||||
countDown?: number;
|
||||
}) => {
|
||||
const timer = useRef<any>();
|
||||
const [countDownAmount, setCountDownAmount] = useState(countDown);
|
||||
|
||||
useEffect(() => {
|
||||
timer.current = setInterval(() => {
|
||||
setCountDownAmount((val) => {
|
||||
if (val <= 0) {
|
||||
clearInterval(timer.current);
|
||||
}
|
||||
return val - 1;
|
||||
});
|
||||
}, 1000);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
isOpen={isOpen}
|
||||
onClose={onClose}
|
||||
iconSrc={iconSrc}
|
||||
title={title}
|
||||
maxW={['90vw', '500px']}
|
||||
>
|
||||
<ModalBody pt={5}>{customContent}</ModalBody>
|
||||
<ModalFooter>
|
||||
{showCancel && (
|
||||
<Button
|
||||
variant={'base'}
|
||||
onClick={() => {
|
||||
onClose();
|
||||
typeof cancelCb.current === 'function' && cancelCb.current();
|
||||
}}
|
||||
>
|
||||
{closeText}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button
|
||||
variant={'base'}
|
||||
{...(bg && { bg: `${bg} !important` })}
|
||||
isDisabled={countDownAmount > 0}
|
||||
ml={4}
|
||||
isLoading={isLoading}
|
||||
onClick={() => {
|
||||
onClose();
|
||||
typeof cancelCb.current === 'function' && cancelCb.current();
|
||||
typeof confirmCb.current === 'function' && confirmCb.current();
|
||||
}}
|
||||
>
|
||||
{t('Cancel')}
|
||||
{countDownAmount > 0 ? `${countDownAmount}s` : confirmText}
|
||||
</Button>
|
||||
)}
|
||||
|
||||
<Button
|
||||
{...(bg && { bg: `${bg} !important` })}
|
||||
ml={4}
|
||||
isLoading={isLoading}
|
||||
onClick={() => {
|
||||
onClose();
|
||||
typeof confirmCb.current === 'function' && confirmCb.current();
|
||||
}}
|
||||
>
|
||||
{t('Confirm')}
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
),
|
||||
[bg, customContent, iconSrc, isOpen, onClose, showCancel, t, title]
|
||||
</ModalFooter>
|
||||
</MyModal>
|
||||
);
|
||||
},
|
||||
[customContent, iconSrc, isOpen, onClose, showCancel, t, title]
|
||||
)
|
||||
};
|
||||
};
|
||||
|
@@ -21,6 +21,8 @@ export const useCopyData = () => {
|
||||
throw new Error('');
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = data;
|
||||
document.body.appendChild(textarea);
|
||||
|
@@ -2,4 +2,4 @@ import { GET, POST, PUT, DELETE } from '@/web/common/api/request';
|
||||
import { UrlFetchParams, UrlFetchResponse } from '@fastgpt/global/common/file/api.d';
|
||||
|
||||
export const postFetchUrls = (data: UrlFetchParams) =>
|
||||
POST<UrlFetchResponse>(`/tools/urlFetch`, data);
|
||||
POST<UrlFetchResponse>(`/common/tools/urlFetch`, data);
|
||||
|
@@ -1,60 +1,48 @@
|
||||
import type { BoxProps } from '@chakra-ui/react';
|
||||
import { ModuleDataTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { ModuleIOValueTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
|
||||
export const FlowValueTypeStyle: Record<`${ModuleDataTypeEnum}`, BoxProps> = {
|
||||
[ModuleDataTypeEnum.string]: {
|
||||
background: '#36ADEF'
|
||||
},
|
||||
[ModuleDataTypeEnum.number]: {
|
||||
background: '#FB7C3C'
|
||||
},
|
||||
[ModuleDataTypeEnum.boolean]: {
|
||||
background: '#E7D118'
|
||||
},
|
||||
[ModuleDataTypeEnum.chatHistory]: {
|
||||
background: '#00A9A6'
|
||||
},
|
||||
[ModuleDataTypeEnum.datasetQuote]: {
|
||||
background: '#A558C9'
|
||||
},
|
||||
[ModuleDataTypeEnum.any]: {
|
||||
background: '#9CA2A8'
|
||||
},
|
||||
[ModuleDataTypeEnum.selectApp]: {
|
||||
background: '#6a6efa'
|
||||
},
|
||||
[ModuleDataTypeEnum.selectDataset]: {
|
||||
background: '#21ba45'
|
||||
}
|
||||
};
|
||||
export const FlowValueTypeMap = {
|
||||
[ModuleDataTypeEnum.string]: {
|
||||
[ModuleIOValueTypeEnum.string]: {
|
||||
handlerStyle: {
|
||||
background: '#36ADEF'
|
||||
},
|
||||
label: 'core.module.valueType.string',
|
||||
value: ModuleDataTypeEnum.string,
|
||||
example: ''
|
||||
value: ModuleIOValueTypeEnum.string,
|
||||
description: ''
|
||||
},
|
||||
[ModuleDataTypeEnum.number]: {
|
||||
[ModuleIOValueTypeEnum.number]: {
|
||||
handlerStyle: {
|
||||
background: '#FB7C3C'
|
||||
},
|
||||
label: 'core.module.valueType.number',
|
||||
value: ModuleDataTypeEnum.number,
|
||||
example: ''
|
||||
value: ModuleIOValueTypeEnum.number,
|
||||
description: ''
|
||||
},
|
||||
[ModuleDataTypeEnum.boolean]: {
|
||||
[ModuleIOValueTypeEnum.boolean]: {
|
||||
handlerStyle: {
|
||||
background: '#E7D118'
|
||||
},
|
||||
label: 'core.module.valueType.boolean',
|
||||
value: ModuleDataTypeEnum.boolean,
|
||||
example: ''
|
||||
value: ModuleIOValueTypeEnum.boolean,
|
||||
description: ''
|
||||
},
|
||||
[ModuleDataTypeEnum.chatHistory]: {
|
||||
[ModuleIOValueTypeEnum.chatHistory]: {
|
||||
handlerStyle: {
|
||||
background: '#00A9A6'
|
||||
},
|
||||
label: 'core.module.valueType.chatHistory',
|
||||
value: ModuleDataTypeEnum.chatHistory,
|
||||
example: `{
|
||||
value: ModuleIOValueTypeEnum.chatHistory,
|
||||
description: `{
|
||||
obj: System | Human | AI;
|
||||
value: string;
|
||||
}[]`
|
||||
},
|
||||
[ModuleDataTypeEnum.datasetQuote]: {
|
||||
[ModuleIOValueTypeEnum.datasetQuote]: {
|
||||
handlerStyle: {
|
||||
background: '#A558C9'
|
||||
},
|
||||
label: 'core.module.valueType.datasetQuote',
|
||||
value: ModuleDataTypeEnum.datasetQuote,
|
||||
example: `{
|
||||
value: ModuleIOValueTypeEnum.datasetQuote,
|
||||
description: `{
|
||||
id: string;
|
||||
datasetId: string;
|
||||
collectionId: string;
|
||||
@@ -64,19 +52,28 @@ export const FlowValueTypeMap = {
|
||||
a: string
|
||||
}[]`
|
||||
},
|
||||
[ModuleDataTypeEnum.any]: {
|
||||
[ModuleIOValueTypeEnum.any]: {
|
||||
handlerStyle: {
|
||||
background: '#9CA2A8'
|
||||
},
|
||||
label: 'core.module.valueType.any',
|
||||
value: ModuleDataTypeEnum.any,
|
||||
example: ''
|
||||
value: ModuleIOValueTypeEnum.any,
|
||||
description: ''
|
||||
},
|
||||
[ModuleDataTypeEnum.selectApp]: {
|
||||
[ModuleIOValueTypeEnum.selectApp]: {
|
||||
handlerStyle: {
|
||||
background: '#6a6efa'
|
||||
},
|
||||
label: 'core.module.valueType.selectApp',
|
||||
value: ModuleDataTypeEnum.selectApp,
|
||||
example: ''
|
||||
value: ModuleIOValueTypeEnum.selectApp,
|
||||
description: ''
|
||||
},
|
||||
[ModuleDataTypeEnum.selectDataset]: {
|
||||
[ModuleIOValueTypeEnum.selectDataset]: {
|
||||
handlerStyle: {
|
||||
background: '#21ba45'
|
||||
},
|
||||
label: 'core.module.valueType.selectDataset',
|
||||
value: ModuleDataTypeEnum.selectDataset,
|
||||
example: ''
|
||||
value: ModuleIOValueTypeEnum.selectDataset,
|
||||
description: ''
|
||||
}
|
||||
};
|
||||
|
@@ -1,7 +0,0 @@
|
||||
export const edgeOptions = {
|
||||
style: {
|
||||
strokeWidth: 1.5,
|
||||
stroke: '#5A646Es'
|
||||
}
|
||||
};
|
||||
export const connectionLineStyle = { strokeWidth: 1.5, stroke: '#5A646Es' };
|
@@ -1,6 +1,6 @@
|
||||
import { UserGuideModule } from '@fastgpt/global/core/module/template/system/userGuide';
|
||||
import { UserInputModule } from '@fastgpt/global/core/module/template/system/userInput';
|
||||
import { HistoryModule } from '@fastgpt/global/core/module/template/system/history';
|
||||
import { HistoryModule } from '@fastgpt/global/core/module/template/system/abandon/history';
|
||||
import { AiChatModule } from '@fastgpt/global/core/module/template/system/aiChat';
|
||||
import { DatasetSearchModule } from '@fastgpt/global/core/module/template/system/datasetSearch';
|
||||
import { AssignedAnswerModule } from '@fastgpt/global/core/module/template/system/assignedAnswer';
|
||||
@@ -12,6 +12,7 @@ import { RunAppModule } from '@fastgpt/global/core/module/template/system/runApp
|
||||
import { PluginInputModule } from '@fastgpt/global/core/module/template/system/pluginInput';
|
||||
import { PluginOutputModule } from '@fastgpt/global/core/module/template/system/pluginOutput';
|
||||
import { RunPluginModule } from '@fastgpt/global/core/module/template/system/runPlugin';
|
||||
|
||||
import type {
|
||||
FlowModuleTemplateType,
|
||||
moduleTemplateListType
|
||||
@@ -68,19 +69,19 @@ export const moduleTemplatesList: moduleTemplateListType = [
|
||||
label: '系统输入',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.tools,
|
||||
label: '工具',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.textAnswer,
|
||||
label: '文本输出',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.dataset,
|
||||
label: '知识库',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.functionCall,
|
||||
label: '函数调用',
|
||||
label: '功能调用',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
@@ -93,59 +94,9 @@ export const moduleTemplatesList: moduleTemplateListType = [
|
||||
label: '个人插件',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.communityPlugin,
|
||||
label: '社区插件',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.commercialPlugin,
|
||||
label: '商业插件',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
type: ModuleTemplateTypeEnum.other,
|
||||
label: '其他',
|
||||
list: []
|
||||
}
|
||||
];
|
||||
// export const appSystemModuleTemplates = [
|
||||
// {
|
||||
// label: '引导模块',
|
||||
// list: [UserGuideModule]
|
||||
// },
|
||||
// {
|
||||
// label: '输入模块',
|
||||
// list: [UserInputModule, HistoryModule]
|
||||
// },
|
||||
// {
|
||||
// label: '内容生成',
|
||||
// list: [AiChatModule, AssignedAnswerModule]
|
||||
// },
|
||||
// {
|
||||
// label: '核心调用',
|
||||
// list: [DatasetSearchModule, RunAppModule]
|
||||
// },
|
||||
// {
|
||||
// label: '函数模块',
|
||||
// list: [ClassifyQuestionModule, ContextExtractModule, HttpModule]
|
||||
// }
|
||||
// ];
|
||||
// export const pluginModuleTemplates = [
|
||||
// {
|
||||
// label: '输入输出',
|
||||
// list: [PluginInputModule, PluginOutputModule, HistoryModule]
|
||||
// },
|
||||
// {
|
||||
// label: '内容生成',
|
||||
// list: [AiChatModule, AssignedAnswerModule]
|
||||
// },
|
||||
// {
|
||||
// label: '核心调用',
|
||||
// list: [DatasetSearchModule, RunAppModule]
|
||||
// },
|
||||
// {
|
||||
// label: '函数模块',
|
||||
// list: [ClassifyQuestionModule, ContextExtractModule, HttpModule]
|
||||
// }
|
||||
// ];
|
||||
|
@@ -71,7 +71,7 @@ const Button = defineStyleConfig({
|
||||
color: 'myBlue.700',
|
||||
border: '1px solid #EFF0F1',
|
||||
_hover: {
|
||||
bg: '#3370FF1A'
|
||||
background: '#3370FF1A'
|
||||
}
|
||||
},
|
||||
base: {
|
||||
@@ -82,13 +82,16 @@ const Button = defineStyleConfig({
|
||||
transition: 'background 0.3s',
|
||||
_hover: {
|
||||
color: 'myBlue.600',
|
||||
bg: 'myWhite.400',
|
||||
background: 'myWhite.400',
|
||||
boxShadow: '0 0 5px rgba(0,0,0,0.1)'
|
||||
},
|
||||
_active: {
|
||||
color: 'myBlue.700'
|
||||
},
|
||||
_disabled: { bg: 'myGray.100 !important', color: 'myGray.700 !important' }
|
||||
_disabled: {
|
||||
bg: 'myGray.100 !important',
|
||||
color: 'myGray.700 !important'
|
||||
}
|
||||
},
|
||||
boxBtn: {
|
||||
px: 3,
|
||||
|
Reference in New Issue
Block a user