Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
7bdff9ce
authored
Sep 28, 2024
by
heheer
Committed by
GitHub
Sep 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: change tool params type label & enum input conditional rendering (#2835)
parent
1599d144
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
16 deletions
+26
-16
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeToolParams/ToolParamsEditModal.tsx
+23
-13
projects/app/src/web/core/workflow/constants/dataType.ts
+3
-3
No files found.
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeToolParams/ToolParamsEditModal.tsx
View file @
7bdff9ce
...
...
@@ -3,7 +3,7 @@ import { Box, Button, Flex, Input, ModalBody, ModalFooter, Textarea } from '@cha
import
{
FlowNodeInputItemType
}
from
'@fastgpt/global/core/workflow/type/io'
;
import
MyModal
from
'@fastgpt/web/components/common/MyModal'
;
import
MySelect
from
'@fastgpt/web/components/common/MySelect'
;
import
React
,
{
useCallback
}
from
'react'
;
import
React
,
{
useCallback
,
useMemo
}
from
'react'
;
import
{
useForm
}
from
'react-hook-form'
;
import
{
useTranslation
}
from
'react-i18next'
;
import
{
defaultEditFormData
}
from
'../render/RenderToolInput/EditFieldModal'
;
...
...
@@ -14,6 +14,7 @@ import { useToast } from '@fastgpt/web/hooks/useToast';
import
{
FlowNodeOutputTypeEnum
}
from
'@fastgpt/global/core/workflow/node/constant'
;
import
FormLabel
from
'@fastgpt/web/components/common/MyBox/FormLabel'
;
import
QuestionTip
from
'@fastgpt/web/components/common/MyTooltip/QuestionTip'
;
import
{
WorkflowIOValueTypeEnum
}
from
'@fastgpt/global/core/workflow/constants'
;
const
ToolParamsEditModal
=
({
defaultValue
=
defaultEditFormData
,
...
...
@@ -106,6 +107,13 @@ const ToolParamsEditModal = ({
[
toast
]
);
const
showEnumInput
=
useMemo
(()
=>
{
return
!
(
valueType
===
WorkflowIOValueTypeEnum
.
boolean
||
valueType
===
WorkflowIOValueTypeEnum
.
arrayBoolean
);
},
[
valueType
]);
return
(
<
MyModal
isOpen
iconSrc=
"modal/edit"
title=
{
t
(
'workflow:tool_field'
)
}
onClose=
{
onClose
}
>
<
ModalBody
>
...
...
@@ -135,7 +143,7 @@ const ToolParamsEditModal = ({
placeholder=
{
t
(
'workflow:tool_params.params_name_placeholder'
)
}
/>
</
Flex
>
<
Flex
alignItems=
{
'center'
}
mb=
{
5
}
>
<
Flex
alignItems=
{
'center'
}
mb=
{
showEnumInput
?
5
:
0
}
>
<
FormLabel
flex=
{
'0 0 80px'
}
>
{
t
(
'workflow:tool_params.params_description'
)
}
</
FormLabel
>
<
Input
bg=
{
'myGray.50'
}
...
...
@@ -145,17 +153,19 @@ const ToolParamsEditModal = ({
placeholder=
{
t
(
'workflow:tool_params.params_description_placeholder'
)
}
/>
</
Flex
>
<
Box
>
<
Flex
alignItems=
{
'center'
}
mb=
{
2
}
>
<
FormLabel
>
{
t
(
'workflow:tool_params.enum_values'
)
}
</
FormLabel
>
<
QuestionTip
label=
{
t
(
'workflow:tool_params.enum_values_tip'
)
}
/>
</
Flex
>
<
Textarea
bg=
{
'myGray.50'
}
{
...
register
('
enum
')}
placeholder=
{
t
(
'workflow:tool_params.enum_placeholder'
)
}
/>
</
Box
>
{
showEnumInput
&&
(
<
Box
>
<
Flex
alignItems=
{
'center'
}
mb=
{
2
}
>
<
FormLabel
>
{
t
(
'workflow:tool_params.enum_values'
)
}
</
FormLabel
>
<
QuestionTip
label=
{
t
(
'workflow:tool_params.enum_values_tip'
)
}
/>
</
Flex
>
<
Textarea
bg=
{
'myGray.50'
}
{
...
register
('
enum
')}
placeholder=
{
t
(
'workflow:tool_params.enum_placeholder'
)
}
/>
</
Box
>
)
}
</
ModalBody
>
<
ModalFooter
>
<
Button
variant=
{
'whiteBase'
}
mr=
{
2
}
onClick=
{
onClose
}
>
...
...
projects/app/src/web/core/workflow/constants/dataType.ts
View file @
7bdff9ce
...
...
@@ -14,15 +14,15 @@ export const fnValueTypeSelect = [
value
:
WorkflowIOValueTypeEnum
.
boolean
},
{
label
:
WorkflowIOValueTypeEnum
.
arrayString
,
label
:
'array<string>'
,
value
:
WorkflowIOValueTypeEnum
.
arrayString
},
{
label
:
WorkflowIOValueTypeEnum
.
arrayNumber
,
label
:
'array<number>'
,
value
:
WorkflowIOValueTypeEnum
.
arrayNumber
},
{
label
:
WorkflowIOValueTypeEnum
.
arrayBoolean
,
label
:
'array<boolean>'
,
value
:
WorkflowIOValueTypeEnum
.
arrayBoolean
}
];
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment