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
d3731d22
authored
Aug 27, 2024
by
heheer
Committed by
GitHub
Aug 27, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: change workflow start node output when change file config (#2527)
parent
f6e2d13e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
27 deletions
+28
-27
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeSystemConfig.tsx
+27
-0
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeWorkflowStart.tsx
+1
-27
No files found.
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeSystemConfig.tsx
View file @
d3731d22
...
@@ -19,6 +19,8 @@ import VariableEdit from '@/components/core/app/VariableEdit';
...
@@ -19,6 +19,8 @@ import VariableEdit from '@/components/core/app/VariableEdit';
import
{
AppContext
}
from
'@/pages/app/detail/components/context'
;
import
{
AppContext
}
from
'@/pages/app/detail/components/context'
;
import
WelcomeTextConfig
from
'@/components/core/app/WelcomeTextConfig'
;
import
WelcomeTextConfig
from
'@/components/core/app/WelcomeTextConfig'
;
import
FileSelect
from
'@/components/core/app/FileSelect'
;
import
FileSelect
from
'@/components/core/app/FileSelect'
;
import
{
FlowNodeTypeEnum
}
from
'@fastgpt/global/core/workflow/node/constant'
;
import
{
userFilesInput
}
from
'@fastgpt/global/core/workflow/template/system/workflowStart'
;
type
ComponentProps
=
{
type
ComponentProps
=
{
chatConfig
:
AppChatConfigType
;
chatConfig
:
AppChatConfigType
;
...
@@ -215,6 +217,10 @@ function QuestionInputGuide({ chatConfig: { chatInputGuide }, setAppDetail }: Co
...
@@ -215,6 +217,10 @@ function QuestionInputGuide({ chatConfig: { chatInputGuide }, setAppDetail }: Co
}
}
function
FileSelectConfig
({
chatConfig
:
{
fileSelectConfig
},
setAppDetail
}:
ComponentProps
)
{
function
FileSelectConfig
({
chatConfig
:
{
fileSelectConfig
},
setAppDetail
}:
ComponentProps
)
{
const
onChangeNode
=
useContextSelector
(
WorkflowContext
,
(
v
)
=>
v
.
onChangeNode
);
const
nodes
=
useContextSelector
(
WorkflowContext
,
(
v
)
=>
v
.
nodes
);
const
workflowStartNode
=
nodes
.
find
((
item
)
=>
item
.
type
===
FlowNodeTypeEnum
.
workflowStart
)
!
;
return
(
return
(
<
FileSelect
<
FileSelect
value=
{
fileSelectConfig
}
value=
{
fileSelectConfig
}
...
@@ -226,6 +232,27 @@ function FileSelectConfig({ chatConfig: { fileSelectConfig }, setAppDetail }: Co
...
@@ -226,6 +232,27 @@ function FileSelectConfig({ chatConfig: { fileSelectConfig }, setAppDetail }: Co
fileSelectConfig
:
e
fileSelectConfig
:
e
}
}
}));
}));
// Dynamic add or delete userFilesInput
const
canUploadFiles
=
e
.
canSelectFile
||
e
.
canSelectImg
;
const
repeatKey
=
workflowStartNode
?.
data
.
outputs
.
find
(
(
item
)
=>
item
.
key
===
userFilesInput
.
key
);
if
(
canUploadFiles
)
{
!
repeatKey
&&
onChangeNode
({
nodeId
:
workflowStartNode
.
id
,
type
:
'addOutput'
,
value
:
userFilesInput
});
}
else
{
repeatKey
&&
onChangeNode
({
nodeId
:
workflowStartNode
.
id
,
type
:
'delOutput'
,
key
:
userFilesInput
.
key
});
}
}
}
}
}
/>
/>
);
);
...
...
projects/app/src/pages/app/detail/components/WorkflowComponents/Flow/nodes/NodeWorkflowStart.tsx
View file @
d3731d22
import
React
,
{
useEffect
,
useMemo
}
from
'react'
;
import
React
from
'react'
;
import
{
NodeProps
}
from
'reactflow'
;
import
{
NodeProps
}
from
'reactflow'
;
import
NodeCard
from
'./render/NodeCard'
;
import
NodeCard
from
'./render/NodeCard'
;
import
{
FlowNodeItemType
}
from
'@fastgpt/global/core/workflow/type/node.d'
;
import
{
FlowNodeItemType
}
from
'@fastgpt/global/core/workflow/type/node.d'
;
...
@@ -17,13 +17,11 @@ import {
...
@@ -17,13 +17,11 @@ import {
}
from
'@fastgpt/global/core/workflow/node/constant'
;
}
from
'@fastgpt/global/core/workflow/node/constant'
;
import
{
WorkflowIOValueTypeEnum
}
from
'@fastgpt/global/core/workflow/constants'
;
import
{
WorkflowIOValueTypeEnum
}
from
'@fastgpt/global/core/workflow/constants'
;
import
{
AppContext
}
from
'@/pages/app/detail/components/context'
;
import
{
AppContext
}
from
'@/pages/app/detail/components/context'
;
import
{
userFilesInput
}
from
'@fastgpt/global/core/workflow/template/system/workflowStart'
;
const
NodeStart
=
({
data
,
selected
}:
NodeProps
<
FlowNodeItemType
>
)
=>
{
const
NodeStart
=
({
data
,
selected
}:
NodeProps
<
FlowNodeItemType
>
)
=>
{
const
{
t
}
=
useTranslation
();
const
{
t
}
=
useTranslation
();
const
{
nodeId
,
outputs
}
=
data
;
const
{
nodeId
,
outputs
}
=
data
;
const
nodeList
=
useContextSelector
(
WorkflowContext
,
(
v
)
=>
v
.
nodeList
);
const
nodeList
=
useContextSelector
(
WorkflowContext
,
(
v
)
=>
v
.
nodeList
);
const
onChangeNode
=
useContextSelector
(
WorkflowContext
,
(
v
)
=>
v
.
onChangeNode
);
const
{
appDetail
}
=
useContextSelector
(
AppContext
,
(
v
)
=>
v
);
const
{
appDetail
}
=
useContextSelector
(
AppContext
,
(
v
)
=>
v
);
const
variablesOutputs
=
useCreation
(()
=>
{
const
variablesOutputs
=
useCreation
(()
=>
{
...
@@ -56,30 +54,6 @@ const NodeStart = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
...
@@ -56,30 +54,6 @@ const NodeStart = ({ data, selected }: NodeProps<FlowNodeItemType>) => {
});
});
},
[
nodeList
,
t
]);
},
[
nodeList
,
t
]);
// Dynamic add or delete userFilesInput
useEffect
(()
=>
{
const
canUploadFiles
=
appDetail
.
chatConfig
?.
fileSelectConfig
?.
canSelectFile
||
appDetail
.
chatConfig
?.
fileSelectConfig
?.
canSelectImg
;
const
repeatKey
=
outputs
.
find
((
item
)
=>
item
.
key
===
userFilesInput
.
key
);
if
(
canUploadFiles
)
{
!
repeatKey
&&
onChangeNode
({
nodeId
,
type
:
'addOutput'
,
value
:
userFilesInput
});
}
else
{
repeatKey
&&
onChangeNode
({
nodeId
,
type
:
'delOutput'
,
key
:
userFilesInput
.
key
});
}
},
[
appDetail
.
chatConfig
?.
fileSelectConfig
,
nodeId
,
onChangeNode
,
outputs
]);
return
(
return
(
<
NodeCard
<
NodeCard
minW=
{
'240px'
}
minW=
{
'240px'
}
...
...
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