mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-02 12:48:30 +00:00
4.7 doc update (#1068)
* fix: plugin update * feat: get current time plugin * fix: ts * perf: select app ux * fix: ts * perf: max w * move code * perf: inform tip * fix: inform * doc * fix: tool handle * perf: tmp file store * doc * fix: message file selector * feat: doc * perf: switch trigger * doc * fix: openapi import * rount the number * parse openapi schema * fix empty line after variables (#64) * doc image * image size * doc * doc * catch error --------- Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
@@ -405,7 +405,7 @@ export const FlowProvider = ({
|
||||
toolInputs: inputs.filter((item) => isTool && item.toolDescription),
|
||||
commonInputs: inputs.filter((item) => {
|
||||
if (!isTool) return true;
|
||||
return !item.toolDescription && item.key !== ModuleInputKeyEnum.switch;
|
||||
return !item.toolDescription;
|
||||
})
|
||||
};
|
||||
},
|
||||
|
@@ -4,7 +4,7 @@ import { BoxProps } from '@chakra-ui/react';
|
||||
|
||||
const Container = ({ children, ...props }: BoxProps) => {
|
||||
return (
|
||||
<Box px={'16px'} py={'10px'} position={'relative'} {...props}>
|
||||
<Box px={4} py={'10px'} position={'relative'} {...props}>
|
||||
{children}
|
||||
</Box>
|
||||
);
|
||||
|
@@ -16,6 +16,7 @@ import { useConfirm } from '@fastgpt/web/hooks/useConfirm';
|
||||
import { LOGO_ICON } from '@fastgpt/global/common/system/constants';
|
||||
import { ToolTargetHandle } from './ToolHandle';
|
||||
import { useEditTextarea } from '@fastgpt/web/hooks/useEditTextarea';
|
||||
import TriggerAndFinish from './RenderInput/templates/TriggerAndFinish';
|
||||
|
||||
type Props = FlowModuleItemType & {
|
||||
children?: React.ReactNode | React.ReactNode[] | string;
|
||||
@@ -208,6 +209,8 @@ const NodeCard = (props: Props) => {
|
||||
</Button>
|
||||
)}
|
||||
</Flex>
|
||||
{/* switch */}
|
||||
<TriggerAndFinish moduleId={moduleId} isTool={moduleIsTool} />
|
||||
</Box>
|
||||
);
|
||||
}, [
|
||||
|
@@ -13,10 +13,6 @@ const RenderList: {
|
||||
types: `${FlowNodeInputTypeEnum}`[];
|
||||
Component: React.ComponentType<RenderInputProps>;
|
||||
}[] = [
|
||||
{
|
||||
types: [FlowNodeInputTypeEnum.triggerAndFinish],
|
||||
Component: dynamic(() => import('./templates/TriggerAndFinish'))
|
||||
},
|
||||
{
|
||||
types: [FlowNodeInputTypeEnum.input],
|
||||
Component: dynamic(() => import('./templates/TextInput'))
|
||||
|
@@ -7,10 +7,18 @@ import SourceHandle from '../../SourceHandle';
|
||||
import { ModuleInputKeyEnum, ModuleOutputKeyEnum } from '@fastgpt/global/core/module/constants';
|
||||
import { useFlowProviderStore } from '../../../../FlowProvider';
|
||||
|
||||
const TriggerAndFinish = ({ moduleId }: RenderInputProps) => {
|
||||
const TriggerAndFinish = ({ moduleId, isTool }: { moduleId: string; isTool: boolean }) => {
|
||||
const { t } = useTranslation();
|
||||
const { nodes } = useFlowProviderStore();
|
||||
|
||||
const inputs = useMemo(
|
||||
() => nodes.find((node) => node.data.moduleId === moduleId)?.data?.inputs || [],
|
||||
[moduleId, nodes]
|
||||
);
|
||||
const hasSwitch = useMemo(
|
||||
() => inputs.some((input) => input.key === ModuleInputKeyEnum.switch),
|
||||
[inputs]
|
||||
);
|
||||
const outputs = useMemo(
|
||||
() => nodes.find((node) => node.data.moduleId === moduleId)?.data?.outputs || [],
|
||||
[moduleId, nodes]
|
||||
@@ -20,8 +28,8 @@ const TriggerAndFinish = ({ moduleId }: RenderInputProps) => {
|
||||
[outputs]
|
||||
);
|
||||
|
||||
const Render = useMemo(
|
||||
() => (
|
||||
const Render = useMemo(() => {
|
||||
return (
|
||||
<Flex
|
||||
className="nodrag"
|
||||
cursor={'default'}
|
||||
@@ -30,21 +38,24 @@ const TriggerAndFinish = ({ moduleId }: RenderInputProps) => {
|
||||
position={'relative'}
|
||||
>
|
||||
<Box position={'relative'}>
|
||||
<TargetHandle handleKey={ModuleInputKeyEnum.switch} valueType={'any'} />
|
||||
{t('core.module.input.label.switch')}
|
||||
{!isTool && (
|
||||
<Box mt={2}>
|
||||
<TargetHandle handleKey={ModuleInputKeyEnum.switch} valueType={'any'} />
|
||||
{t('core.module.input.label.switch')}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
{hasFinishOutput && (
|
||||
<Box position={'relative'}>
|
||||
<Box position={'relative'} mt={2}>
|
||||
{t('core.module.output.label.running done')}
|
||||
<SourceHandle handleKey={ModuleOutputKeyEnum.finish} valueType={'boolean'} />
|
||||
</Box>
|
||||
)}
|
||||
</Flex>
|
||||
),
|
||||
[hasFinishOutput, t]
|
||||
);
|
||||
);
|
||||
}, [hasFinishOutput, isTool, t]);
|
||||
|
||||
return Render;
|
||||
return hasSwitch ? Render : null;
|
||||
};
|
||||
|
||||
export default React.memo(TriggerAndFinish);
|
||||
|
@@ -28,8 +28,8 @@ const SourceHandle = ({ handleKey, valueType, ...props }: Props) => {
|
||||
<Box
|
||||
position={'absolute'}
|
||||
top={'50%'}
|
||||
right={'-20px'}
|
||||
transform={'translate(50%,-50%)'}
|
||||
right={'-18px'}
|
||||
transform={'translate(0,-50%)'}
|
||||
{...props}
|
||||
>
|
||||
<MyTooltip
|
||||
|
@@ -27,8 +27,8 @@ const TargetHandle = ({ handleKey, valueType, ...props }: Props) => {
|
||||
<Box
|
||||
position={'absolute'}
|
||||
top={'50%'}
|
||||
left={'-20px'}
|
||||
transform={'translate(50%,-50%)'}
|
||||
left={'-18px'}
|
||||
transform={'translate(0,-50%)'}
|
||||
{...props}
|
||||
>
|
||||
<MyTooltip
|
||||
|
@@ -41,6 +41,7 @@ export const ToolTargetHandle = ({ moduleId }: ToolHandleProps) => {
|
||||
h={'14px'}
|
||||
border={'4px solid #5E8FFF'}
|
||||
transform={'translate(-40%,-30%) rotate(45deg)'}
|
||||
pointerEvents={'none'}
|
||||
/>
|
||||
</Handle>
|
||||
</MyTooltip>
|
||||
@@ -98,6 +99,7 @@ export const ToolSourceHandle = ({ moduleId }: ToolHandleProps) => {
|
||||
h={'14px'}
|
||||
border={'4px solid #5E8FFF'}
|
||||
transform={'translate(-40%,-30%) rotate(45deg)'}
|
||||
pointerEvents={'none'}
|
||||
/>
|
||||
</Handle>
|
||||
</MyTooltip>
|
||||
|
Reference in New Issue
Block a user