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
85ea1174
authored
Sep 04, 2025
by
Archer
Committed by
GitHub
Sep 04, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix workflow (#5592)
* fix: fileselector default * fix: workflow run process
parent
9be1e591
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
80 additions
and
111 deletions
+80
-111
document/content/docs/upgrading/4-12/4123.mdx
+2
-0
document/data/doc-last-modified.json
+1
-1
packages/global/core/app/constants.ts
+1
-1
packages/global/core/workflow/template/system/interactive/type.d.ts
+1
-0
packages/service/core/workflow/dispatch/index.ts
+0
-0
packages/service/core/workflow/dispatch/type.d.ts
+15
-5
projects/app/src/components/core/app/FileSelect.tsx
+1
-1
projects/app/src/global/core/workflow/api.d.ts
+3
-6
projects/app/src/pageComponents/app/detail/SimpleApp/EditForm.tsx
+1
-2
projects/app/src/pageComponents/app/detail/SimpleApp/index.tsx
+8
-1
projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/render/RenderDebug/NodeDebugResponse.tsx
+6
-8
projects/app/src/pageComponents/app/detail/WorkflowComponents/context/index.tsx
+34
-78
projects/app/src/pages/api/core/workflow/debug.ts
+7
-8
No files found.
document/content/docs/upgrading/4-12/4123.mdx
View file @
85ea1174
...
@@ -14,5 +14,7 @@ description: 'FastGPT V4.12.3 更新说明'
...
@@ -14,5 +14,7 @@ description: 'FastGPT V4.12.3 更新说明'
## 🐛 修复
## 🐛 修复
1. 单团队模式下,如果用户离开,则无法重新进入团队。
1. 单团队模式下,如果用户离开,则无法重新进入团队。
2. 工作流文件上传默认打开,但输入侧未添加文件输出。
3. 连续用户选择,分支无法正常运行。
## 🔨 工具更新
## 🔨 工具更新
document/data/doc-last-modified.json
View file @
85ea1174
...
@@ -105,7 +105,7 @@
...
@@ -105,7 +105,7 @@
"document/content/docs/upgrading/4-12/4120.mdx"
:
"2025-08-12T22:45:19+08:00"
,
"document/content/docs/upgrading/4-12/4120.mdx"
:
"2025-08-12T22:45:19+08:00"
,
"document/content/docs/upgrading/4-12/4121.mdx"
:
"2025-08-15T22:53:06+08:00"
,
"document/content/docs/upgrading/4-12/4121.mdx"
:
"2025-08-15T22:53:06+08:00"
,
"document/content/docs/upgrading/4-12/4122.mdx"
:
"2025-08-27T00:31:33+08:00"
,
"document/content/docs/upgrading/4-12/4122.mdx"
:
"2025-08-27T00:31:33+08:00"
,
"document/content/docs/upgrading/4-12/4123.mdx"
:
"2025-0
8-29T01:24:19
+08:00"
,
"document/content/docs/upgrading/4-12/4123.mdx"
:
"2025-0
9-04T13:48:03
+08:00"
,
"document/content/docs/upgrading/4-8/40.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/40.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/41.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/41.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/42.mdx"
:
"2025-08-02T19:38:37+08:00"
,
"document/content/docs/upgrading/4-8/42.mdx"
:
"2025-08-02T19:38:37+08:00"
,
...
...
packages/global/core/app/constants.ts
View file @
85ea1174
...
@@ -45,7 +45,7 @@ export const defaultChatInputGuideConfig = {
...
@@ -45,7 +45,7 @@ export const defaultChatInputGuideConfig = {
};
};
export
const
defaultAppSelectFileConfig
:
AppFileSelectConfigType
=
{
export
const
defaultAppSelectFileConfig
:
AppFileSelectConfigType
=
{
canSelectFile
:
tru
e
,
canSelectFile
:
fals
e
,
canSelectImg
:
false
,
canSelectImg
:
false
,
maxFiles
:
10
maxFiles
:
10
};
};
...
...
packages/global/core/workflow/template/system/interactive/type.d.ts
View file @
85ea1174
...
@@ -8,6 +8,7 @@ type InteractiveBasicType = {
...
@@ -8,6 +8,7 @@ type InteractiveBasicType = {
entryNodeIds
:
string
[];
entryNodeIds
:
string
[];
memoryEdges
:
RuntimeEdgeItemType
[];
memoryEdges
:
RuntimeEdgeItemType
[];
nodeOutputs
:
NodeOutputItemType
[];
nodeOutputs
:
NodeOutputItemType
[];
skipNodeQueue
?:
{
id
:
string
;
skippedNodeIdList
:
string
[]
}[];
// 需要记录目前在 queue 里的节点
toolParams
?:
{
toolParams
?:
{
entryNodeIds
:
string
[];
// 记录工具中,交互节点的 Id,而不是起始工作流的入口
entryNodeIds
:
string
[];
// 记录工具中,交互节点的 Id,而不是起始工作流的入口
memoryMessages
:
ChatCompletionMessageParam
[];
// 这轮工具中,产生的新的 messages
memoryMessages
:
ChatCompletionMessageParam
[];
// 这轮工具中,产生的新的 messages
...
...
packages/service/core/workflow/dispatch/index.ts
View file @
85ea1174
This diff is collapsed.
Click to expand it.
packages/service/core/workflow/dispatch/type.d.ts
View file @
85ea1174
...
@@ -13,14 +13,24 @@ import type { WorkflowInteractiveResponseType } from '@fastgpt/global/core/workf
...
@@ -13,14 +13,24 @@ import type { WorkflowInteractiveResponseType } from '@fastgpt/global/core/workf
import
type
{
RuntimeEdgeItemType
}
from
'@fastgpt/global/core/workflow/type/edge'
;
import
type
{
RuntimeEdgeItemType
}
from
'@fastgpt/global/core/workflow/type/edge'
;
import
type
{
ChatNodeUsageType
}
from
'@fastgpt/global/support/wallet/bill/type'
;
import
type
{
ChatNodeUsageType
}
from
'@fastgpt/global/support/wallet/bill/type'
;
export
type
WorkflowDebugResponse
=
{
memoryEdges
:
RuntimeEdgeItemType
[];
entryNodeIds
:
string
[];
// Next step entry nodes
nodeResponses
:
Record
<
string
,
{
nodeId
:
string
;
type
:
'skip'
|
'run'
;
response
?:
ChatHistoryItemResType
;
interactiveResponse
?:
InteractiveNodeResponseType
;
}
>
;
skipNodeQueue
?:
{
id
:
string
;
skippedNodeIdList
:
string
[]
}[];
// Cache
};
export
type
DispatchFlowResponse
=
{
export
type
DispatchFlowResponse
=
{
flowResponses
:
ChatHistoryItemResType
[];
flowResponses
:
ChatHistoryItemResType
[];
flowUsages
:
ChatNodeUsageType
[];
flowUsages
:
ChatNodeUsageType
[];
debugResponse
:
{
debugResponse
:
WorkflowDebugResponse
;
finishedNodes
:
RuntimeNodeItemType
[];
finishedEdges
:
RuntimeEdgeItemType
[];
nextStepRunNodes
:
RuntimeNodeItemType
[];
};
workflowInteractiveResponse
?:
WorkflowInteractiveResponseType
;
workflowInteractiveResponse
?:
WorkflowInteractiveResponseType
;
[
DispatchNodeResponseKeyEnum
.
toolResponses
]:
ToolRunResponseItemType
;
[
DispatchNodeResponseKeyEnum
.
toolResponses
]:
ToolRunResponseItemType
;
[
DispatchNodeResponseKeyEnum
.
assistantResponses
]:
AIChatItemValueItemType
[];
[
DispatchNodeResponseKeyEnum
.
assistantResponses
]:
AIChatItemValueItemType
[];
...
...
projects/app/src/components/core/app/FileSelect.tsx
View file @
85ea1174
...
@@ -17,7 +17,6 @@ import { useTranslation } from 'next-i18next';
...
@@ -17,7 +17,6 @@ import { useTranslation } from 'next-i18next';
import
type
{
AppFileSelectConfigType
}
from
'@fastgpt/global/core/app/type.d'
;
import
type
{
AppFileSelectConfigType
}
from
'@fastgpt/global/core/app/type.d'
;
import
MyModal
from
'@fastgpt/web/components/common/MyModal'
;
import
MyModal
from
'@fastgpt/web/components/common/MyModal'
;
import
MySlider
from
'@/components/Slider'
;
import
MySlider
from
'@/components/Slider'
;
import
{
defaultAppSelectFileConfig
}
from
'@fastgpt/global/core/app/constants'
;
import
ChatFunctionTip
from
'./Tip'
;
import
ChatFunctionTip
from
'./Tip'
;
import
FormLabel
from
'@fastgpt/web/components/common/MyBox/FormLabel'
;
import
FormLabel
from
'@fastgpt/web/components/common/MyBox/FormLabel'
;
import
{
useMount
}
from
'ahooks'
;
import
{
useMount
}
from
'ahooks'
;
...
@@ -25,6 +24,7 @@ import { useSystemStore } from '@/web/common/system/useSystemStore';
...
@@ -25,6 +24,7 @@ import { useSystemStore } from '@/web/common/system/useSystemStore';
import
QuestionTip
from
'@fastgpt/web/components/common/MyTooltip/QuestionTip'
;
import
QuestionTip
from
'@fastgpt/web/components/common/MyTooltip/QuestionTip'
;
import
MyTag
from
'@fastgpt/web/components/common/Tag/index'
;
import
MyTag
from
'@fastgpt/web/components/common/Tag/index'
;
import
MyDivider
from
'@fastgpt/web/components/common/MyDivider'
;
import
MyDivider
from
'@fastgpt/web/components/common/MyDivider'
;
import
{
defaultAppSelectFileConfig
}
from
'@fastgpt/global/core/app/constants'
;
const
FileSelect
=
({
const
FileSelect
=
({
forbidVision
=
false
,
forbidVision
=
false
,
...
...
projects/app/src/global/core/workflow/api.d.ts
View file @
85ea1174
...
@@ -5,21 +5,18 @@ import type { WorkflowInteractiveResponseType } from '@fastgpt/global/core/workf
...
@@ -5,21 +5,18 @@ import type { WorkflowInteractiveResponseType } from '@fastgpt/global/core/workf
import
{
StoreNodeItemType
}
from
'@fastgpt/global/core/workflow/type'
;
import
{
StoreNodeItemType
}
from
'@fastgpt/global/core/workflow/type'
;
import
type
{
RuntimeEdgeItemType
}
from
'@fastgpt/global/core/workflow/type/edge'
;
import
type
{
RuntimeEdgeItemType
}
from
'@fastgpt/global/core/workflow/type/edge'
;
import
{
StoreEdgeItemType
}
from
'@fastgpt/global/core/workflow/type/edge'
;
import
{
StoreEdgeItemType
}
from
'@fastgpt/global/core/workflow/type/edge'
;
import
type
{
WorkflowDebugResponse
}
from
'@fastgpt/service/core/workflow/dispatch/type'
;
export
type
PostWorkflowDebugProps
=
{
export
type
PostWorkflowDebugProps
=
{
nodes
:
RuntimeNodeItemType
[];
nodes
:
RuntimeNodeItemType
[];
edges
:
RuntimeEdgeItemType
[];
edges
:
RuntimeEdgeItemType
[];
skipNodeQueue
?:
WorkflowDebugResponse
[
'skipNodeQueue'
];
variables
:
Record
<
string
,
any
>
;
variables
:
Record
<
string
,
any
>
;
appId
:
string
;
appId
:
string
;
query
?:
UserChatItemValueItemType
[];
query
?:
UserChatItemValueItemType
[];
history
?:
ChatItemType
[];
history
?:
ChatItemType
[];
};
};
export
type
PostWorkflowDebugResponse
=
{
export
type
PostWorkflowDebugResponse
=
WorkflowDebugResponse
&
{
finishedNodes
:
RuntimeNodeItemType
[];
finishedEdges
:
RuntimeEdgeItemType
[];
nextStepRunNodes
:
RuntimeNodeItemType
[];
flowResponses
:
ChatHistoryItemResType
[];
workflowInteractiveResponse
?:
WorkflowInteractiveResponseType
;
newVariables
:
Record
<
string
,
any
>
;
newVariables
:
Record
<
string
,
any
>
;
};
};
projects/app/src/pageComponents/app/detail/SimpleApp/EditForm.tsx
View file @
85ea1174
...
@@ -31,7 +31,6 @@ import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
...
@@ -31,7 +31,6 @@ import FormLabel from '@fastgpt/web/components/common/MyBox/FormLabel';
import
VariableTip
from
'@/components/common/Textarea/MyTextarea/VariableTip'
;
import
VariableTip
from
'@/components/common/Textarea/MyTextarea/VariableTip'
;
import
{
getWebLLMModel
}
from
'@/web/common/system/utils'
;
import
{
getWebLLMModel
}
from
'@/web/common/system/utils'
;
import
ToolSelect
from
'./components/ToolSelect'
;
import
ToolSelect
from
'./components/ToolSelect'
;
import
{
useSystemStore
}
from
'@/web/common/system/useSystemStore'
;
import
OptimizerPopover
from
'@/components/common/PromptEditor/OptimizerPopover'
;
import
OptimizerPopover
from
'@/components/common/PromptEditor/OptimizerPopover'
;
const
DatasetSelectModal
=
dynamic
(()
=>
import
(
'@/components/core/app/DatasetSelectModal'
));
const
DatasetSelectModal
=
dynamic
(()
=>
import
(
'@/components/core/app/DatasetSelectModal'
));
...
@@ -148,7 +147,7 @@ const EditForm = ({
...
@@ -148,7 +147,7 @@ const EditForm = ({
},
},
[
appForm
.
aiSettings
.
systemPrompt
,
setAppForm
]
[
appForm
.
aiSettings
.
systemPrompt
,
setAppForm
]
);
);
console
.
log
(
appForm
.
chatConfig
.
fileSelectConfig
);
return
(
return
(
<>
<>
<
Box
>
<
Box
>
...
...
projects/app/src/pageComponents/app/detail/SimpleApp/index.tsx
View file @
85ea1174
...
@@ -11,6 +11,7 @@ import { type SimpleAppSnapshotType, useSimpleAppSnapshots } from './useSnapshot
...
@@ -11,6 +11,7 @@ import { type SimpleAppSnapshotType, useSimpleAppSnapshots } from './useSnapshot
import
{
useDebounceEffect
,
useMount
}
from
'ahooks'
;
import
{
useDebounceEffect
,
useMount
}
from
'ahooks'
;
import
{
v1Workflow2V2
}
from
'@/web/core/workflow/adapt'
;
import
{
v1Workflow2V2
}
from
'@/web/core/workflow/adapt'
;
import
{
getAppConfigByDiff
}
from
'@/web/core/app/diff'
;
import
{
getAppConfigByDiff
}
from
'@/web/core/app/diff'
;
import
{
defaultAppSelectFileConfig
}
from
'@fastgpt/global/core/app/constants'
;
const
Edit
=
dynamic
(()
=>
import
(
'./Edit'
));
const
Edit
=
dynamic
(()
=>
import
(
'./Edit'
));
const
Logs
=
dynamic
(()
=>
import
(
'../Logs/index'
));
const
Logs
=
dynamic
(()
=>
import
(
'../Logs/index'
));
...
@@ -79,7 +80,13 @@ const SimpleEdit = () => {
...
@@ -79,7 +80,13 @@ const SimpleEdit = () => {
if
(
past
.
length
===
0
)
{
if
(
past
.
length
===
0
)
{
const
appForm
=
appWorkflow2Form
({
const
appForm
=
appWorkflow2Form
({
nodes
:
appDetail
.
modules
,
nodes
:
appDetail
.
modules
,
chatConfig
:
appDetail
.
chatConfig
chatConfig
:
{
...
appDetail
.
chatConfig
,
fileSelectConfig
:
appDetail
.
chatConfig
.
fileSelectConfig
||
{
...
defaultAppSelectFileConfig
,
canSelectFile
:
true
}
}
});
});
saveSnapshot
({
saveSnapshot
({
appForm
,
appForm
,
...
...
projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/nodes/render/RenderDebug/NodeDebugResponse.tsx
View file @
85ea1174
...
@@ -127,11 +127,9 @@ const NodeDebugResponse = ({ nodeId, debugResult }: NodeDebugResponseProps) => {
...
@@ -127,11 +127,9 @@ const NodeDebugResponse = ({ nodeId, debugResult }: NodeDebugResponseProps) => {
}
}
];
];
const
lastInteractive
=
getLastInteractiveValue
(
mockHistory
);
onNextNodeDebug
({
onNextNodeDebug
({
...
workflowDebugData
,
...
workflowDebugData
,
// Rewrite runtimeEdges
runtimeEdges
:
workflowDebugData
.
runtimeEdges
,
runtimeEdges
:
storeEdges2RuntimeEdges
(
workflowDebugData
.
runtimeEdges
,
lastInteractive
),
query
:
updatedQuery
,
query
:
updatedQuery
,
history
:
mockHistory
history
:
mockHistory
});
});
...
@@ -189,7 +187,7 @@ const NodeDebugResponse = ({ nodeId, debugResult }: NodeDebugResponseProps) => {
...
@@ -189,7 +187,7 @@ const NodeDebugResponse = ({ nodeId, debugResult }: NodeDebugResponseProps) => {
<
Box
fontWeight=
{
'bold'
}
flex=
{
'1'
}
>
<
Box
fontWeight=
{
'bold'
}
flex=
{
'1'
}
>
{
t
(
'common:core.workflow.debug.Run result'
)
}
{
t
(
'common:core.workflow.debug.Run result'
)
}
</
Box
>
</
Box
>
{
workflowDebugData
?.
nextRunNode
s
.
length
!==
0
&&
(
{
workflowDebugData
?.
entryNodeId
s
.
length
!==
0
&&
(
<
PopoverConfirm
<
PopoverConfirm
Trigger=
{
Trigger=
{
<
Button
<
Button
...
@@ -209,8 +207,8 @@ const NodeDebugResponse = ({ nodeId, debugResult }: NodeDebugResponseProps) => {
...
@@ -209,8 +207,8 @@ const NodeDebugResponse = ({ nodeId, debugResult }: NodeDebugResponseProps) => {
<>
<>
{
(
debugResult
.
status
===
'success'
||
debugResult
.
status
===
'skipped'
)
&&
{
(
debugResult
.
status
===
'success'
||
debugResult
.
status
===
'skipped'
)
&&
!
debugResult
.
isExpired
&&
!
debugResult
.
isExpired
&&
workflowDebugData
?.
nextRunNode
s
&&
workflowDebugData
?.
entryNodeId
s
&&
workflowDebugData
.
nextRunNode
s
.
length
>
0
&&
(
workflowDebugData
.
entryNodeId
s
.
length
>
0
&&
(
<
Button
<
Button
ml=
{
2
}
ml=
{
2
}
size=
{
'sm'
}
size=
{
'sm'
}
...
@@ -221,8 +219,8 @@ const NodeDebugResponse = ({ nodeId, debugResult }: NodeDebugResponseProps) => {
...
@@ -221,8 +219,8 @@ const NodeDebugResponse = ({ nodeId, debugResult }: NodeDebugResponseProps) => {
{
t
(
'common:next_step'
)
}
{
t
(
'common:next_step'
)
}
</
Button
>
</
Button
>
)
}
)
}
{
workflowDebugData
?.
nextRunNode
s
&&
{
workflowDebugData
?.
entryNodeId
s
&&
workflowDebugData
?.
nextRunNode
s
.
length
===
0
&&
(
workflowDebugData
?.
entryNodeId
s
.
length
===
0
&&
(
<
Button
ml=
{
2
}
size=
{
'sm'
}
variant=
{
'primary'
}
onClick=
{
onStopNodeDebug
}
>
<
Button
ml=
{
2
}
size=
{
'sm'
}
variant=
{
'primary'
}
onClick=
{
onStopNodeDebug
}
>
{
t
(
'common:core.workflow.debug.Done'
)
}
{
t
(
'common:core.workflow.debug.Done'
)
}
</
Button
>
</
Button
>
...
...
projects/app/src/pageComponents/app/detail/WorkflowComponents/context/index.tsx
View file @
85ea1174
...
@@ -54,12 +54,12 @@ import { cloneDeep } from 'lodash';
...
@@ -54,12 +54,12 @@ import { cloneDeep } from 'lodash';
import
{
type
AppVersionSchemaType
}
from
'@fastgpt/global/core/app/version'
;
import
{
type
AppVersionSchemaType
}
from
'@fastgpt/global/core/app/version'
;
import
WorkflowInitContextProvider
,
{
WorkflowNodeEdgeContext
}
from
'./workflowInitContext'
;
import
WorkflowInitContextProvider
,
{
WorkflowNodeEdgeContext
}
from
'./workflowInitContext'
;
import
WorkflowEventContextProvider
from
'./workflowEventContext'
;
import
WorkflowEventContextProvider
from
'./workflowEventContext'
;
import
{
getAppConfigByDiff
}
from
'@/web/core/app/diff'
;
import
WorkflowStatusContextProvider
from
'./workflowStatusContext'
;
import
WorkflowStatusContextProvider
from
'./workflowStatusContext'
;
import
{
type
ChatItemType
,
type
UserChatItemValueItemType
}
from
'@fastgpt/global/core/chat/type'
;
import
{
type
ChatItemType
,
type
UserChatItemValueItemType
}
from
'@fastgpt/global/core/chat/type'
;
import
{
type
WorkflowInteractiveResponseType
}
from
'@fastgpt/global/core/workflow/template/system/interactive/type'
;
import
{
type
WorkflowInteractiveResponseType
}
from
'@fastgpt/global/core/workflow/template/system/interactive/type'
;
import
{
FlowNodeOutputTypeEnum
}
from
'@fastgpt/global/core/workflow/node/constant'
;
import
{
FlowNodeOutputTypeEnum
}
from
'@fastgpt/global/core/workflow/node/constant'
;
import
{
useChatStore
}
from
'@/web/core/chat/context/useChatStore'
;
import
{
useChatStore
}
from
'@/web/core/chat/context/useChatStore'
;
import
type
{
WorkflowDebugResponse
}
from
'@fastgpt/service/core/workflow/dispatch/type'
;
/*
/*
Context
Context
...
@@ -266,7 +266,9 @@ type WorkflowContextType = {
...
@@ -266,7 +266,9 @@ type WorkflowContextType = {
export
type
DebugDataType
=
{
export
type
DebugDataType
=
{
runtimeNodes
:
RuntimeNodeItemType
[];
runtimeNodes
:
RuntimeNodeItemType
[];
runtimeEdges
:
RuntimeEdgeItemType
[];
runtimeEdges
:
RuntimeEdgeItemType
[];
nextRunNodes
:
RuntimeNodeItemType
[];
entryNodeIds
:
string
[];
skipNodeQueue
?:
WorkflowDebugResponse
[
'skipNodeQueue'
];
variables
:
Record
<
string
,
any
>
;
variables
:
Record
<
string
,
any
>
;
history
?:
ChatItemType
[];
history
?:
ChatItemType
[];
query
?:
UserChatItemValueItemType
[];
query
?:
UserChatItemValueItemType
[];
...
@@ -686,58 +688,30 @@ const WorkflowContextProvider = ({
...
@@ -686,58 +688,30 @@ const WorkflowContextProvider = ({
}))
}))
);
);
// 2. Set isEntry field and get entryNodes
// 2. Set isEntry field and get entryNodes
, and set running status
const
runtimeNodes
=
debugData
.
runtimeNodes
.
map
((
item
)
=>
({
const
runtimeNodes
=
debugData
.
runtimeNodes
.
map
((
item
)
=>
({
...
item
,
...
item
,
isEntry
:
debugData
.
nextRunNodes
.
some
((
node
)
=>
node
.
nodeI
d
===
item
.
nodeId
)
isEntry
:
debugData
.
entryNodeIds
.
some
((
id
)
=>
i
d
===
item
.
nodeId
)
}));
}));
const
entryNodes
=
runtimeNodes
.
filter
((
item
)
=>
item
.
isEntry
);
const
entryNodes
=
runtimeNodes
.
filter
((
item
)
=>
{
if
(
item
.
isEntry
)
{
const
runtimeNodeStatus
:
Record
<
string
,
string
>
=
entryNodes
.
map
((
node
)
=>
{
const
status
=
checkNodeRunStatus
({
node
,
nodesMap
:
new
Map
(
runtimeNodes
.
map
((
item
)
=>
[
item
.
nodeId
,
item
])),
runtimeEdges
:
debugData
?.
runtimeEdges
||
[]
});
return
{
nodeId
:
node
.
nodeId
,
status
};
})
.
reduce
(
(
acc
,
cur
)
=>
({
...
acc
,
[
cur
.
nodeId
]:
cur
.
status
}),
{}
);
// 3. Set entry node status to running
entryNodes
.
forEach
((
node
)
=>
{
if
(
runtimeNodeStatus
[
node
.
nodeId
]
!==
'wait'
)
{
onChangeNode
({
onChangeNode
({
nodeId
:
node
.
nodeId
,
nodeId
:
item
.
nodeId
,
type
:
'attr'
,
type
:
'attr'
,
key
:
'debugResult'
,
key
:
'debugResult'
,
value
:
defaultRunningStatus
value
:
defaultRunningStatus
});
});
return
true
;
}
}
});
});
try
{
try
{
// 4. Run one step
// 3. Run one step
const
{
const
{
memoryEdges
,
entryNodeIds
,
skipNodeQueue
,
nodeResponses
,
newVariables
}
=
finishedEdges
,
await
postWorkflowDebug
({
finishedNodes
,
nextStepRunNodes
,
flowResponses
,
newVariables
,
workflowInteractiveResponse
}
=
await
postWorkflowDebug
({
nodes
:
runtimeNodes
,
nodes
:
runtimeNodes
,
edges
:
debugData
.
runtimeEdges
,
edges
:
debugData
.
runtimeEdges
,
skipNodeQueue
:
debugData
.
skipNodeQueue
,
variables
:
{
variables
:
{
appId
,
appId
,
cTime
:
formatTime2YMDHMW
(),
cTime
:
formatTime2YMDHMW
(),
...
@@ -748,50 +722,33 @@ const WorkflowContextProvider = ({
...
@@ -748,50 +722,33 @@ const WorkflowContextProvider = ({
appId
appId
});
});
//
5
. Store debug result
//
4
. Store debug result
setWorkflowDebugData
({
setWorkflowDebugData
({
runtimeNodes
:
finishedNodes
,
runtimeNodes
:
debugData
.
runtimeNodes
,
// edges need to save status
runtimeEdges
:
memoryEdges
,
runtimeEdges
:
finishedEdges
,
entryNodeIds
,
nextRunNodes
:
nextStepRunNodes
,
skipNodeQueue
,
variables
:
newVariables
,
variables
:
newVariables
workflowInteractiveResponse
:
workflowInteractiveResponse
});
});
//
6
. selected entry node and Update entry node debug result
//
5
. selected entry node and Update entry node debug result
setNodes
((
state
)
=>
setNodes
((
state
)
=>
state
.
map
((
node
)
=>
{
state
.
map
((
node
)
=>
{
const
isEntryNode
=
entryNodes
.
some
((
item
)
=>
item
.
nodeId
===
node
.
data
.
nodeId
);
const
isEntryNode
=
entryNodes
.
some
((
item
)
=>
item
.
nodeId
===
node
.
data
.
nodeId
);
if
(
!
isEntryNode
||
runtimeNodeStatus
[
node
.
data
.
nodeId
]
===
'wait'
)
return
node
;
const
result
=
nodeResponses
[
node
.
data
.
nodeId
];
if
(
!
result
)
return
node
;
const
result
=
flowResponses
.
find
((
item
)
=>
item
.
nodeId
===
node
.
data
.
nodeId
);
if
(
runtimeNodeStatus
[
node
.
data
.
nodeId
]
===
'skip'
)
{
return
{
return
{
...
node
,
...
node
,
selected
:
isEntryNode
,
selected
:
result
.
type
===
'run'
&&
isEntryNode
,
data
:
{
data
:
{
...
node
.
data
,
...
node
.
data
,
debugResult
:
{
debugResult
:
{
status
:
'skipped'
,
status
:
result
.
type
===
'run'
?
'success'
:
'skipped'
,
showResult
:
true
,
response
:
result
.
response
,
isExpired
:
false
}
}
};
}
return
{
...
node
,
selected
:
isEntryNode
,
data
:
{
...
node
.
data
,
debugResult
:
{
status
:
'success'
,
response
:
result
,
showResult
:
true
,
showResult
:
true
,
isExpired
:
false
,
isExpired
:
false
,
workflowInteractiveResponse
:
workflowI
nteractiveResponse
workflowInteractiveResponse
:
result
.
i
nteractiveResponse
}
}
}
}
};
};
...
@@ -799,13 +756,9 @@ const WorkflowContextProvider = ({
...
@@ -799,13 +756,9 @@ const WorkflowContextProvider = ({
);
);
// Check for an empty response(Skip node)
// Check for an empty response(Skip node)
if
(
// if (!workflowInteractiveResponse && flowResponses.length === 0 && entryNodeIds.length > 0) {
!
workflowInteractiveResponse
&&
// onNextNodeDebug(debugData);
flowResponses
.
length
===
0
&&
// }
nextStepRunNodes
.
length
>
0
)
{
onNextNodeDebug
(
debugData
);
}
}
catch
(
error
)
{
}
catch
(
error
)
{
entryNodes
.
forEach
((
node
)
=>
{
entryNodes
.
forEach
((
node
)
=>
{
onChangeNode
({
onChangeNode
({
...
@@ -856,7 +809,10 @@ const WorkflowContextProvider = ({
...
@@ -856,7 +809,10 @@ const WorkflowContextProvider = ({
const
data
:
DebugDataType
=
{
const
data
:
DebugDataType
=
{
runtimeNodes
,
runtimeNodes
,
runtimeEdges
,
runtimeEdges
,
nextRunNodes
:
runtimeNodes
.
filter
((
node
)
=>
node
.
nodeId
===
entryNodeId
),
entryNodeIds
:
runtimeNodes
.
filter
((
node
)
=>
node
.
nodeId
===
entryNodeId
)
.
map
((
node
)
=>
node
.
nodeId
),
skipNodeQueue
:
[],
variables
,
variables
,
query
,
query
,
history
history
...
...
projects/app/src/pages/api/core/workflow/debug.ts
View file @
85ea1174
...
@@ -21,6 +21,7 @@ async function handler(
...
@@ -21,6 +21,7 @@ async function handler(
const
{
const
{
nodes
=
[],
nodes
=
[],
edges
=
[],
edges
=
[],
skipNodeQueue
,
variables
=
{},
variables
=
{},
appId
,
appId
,
query
=
[],
query
=
[],
...
@@ -47,11 +48,10 @@ async function handler(
...
@@ -47,11 +48,10 @@ async function handler(
// auth balance
// auth balance
const
{
timezone
,
externalProvider
}
=
await
getUserChatInfoAndAuthTeamPoints
(
tmbId
);
const
{
timezone
,
externalProvider
}
=
await
getUserChatInfoAndAuthTeamPoints
(
tmbId
);
const
lastI
nteractive
=
getLastInteractiveValue
(
history
);
const
i
nteractive
=
getLastInteractiveValue
(
history
);
/* start process */
/* start process */
const
{
flowUsages
,
flowResponses
,
debugResponse
,
newVariables
,
workflowInteractiveResponse
}
=
const
{
flowUsages
,
debugResponse
,
newVariables
}
=
await
dispatchWorkFlow
({
await
dispatchWorkFlow
({
res
,
res
,
lang
:
getLocale
(
req
),
lang
:
getLocale
(
req
),
requestOrigin
:
req
.
headers
.
origin
,
requestOrigin
:
req
.
headers
.
origin
,
...
@@ -67,7 +67,8 @@ async function handler(
...
@@ -67,7 +67,8 @@ async function handler(
runningUserInfo
:
await
getRunningUserInfoByTmbId
(
tmbId
),
runningUserInfo
:
await
getRunningUserInfoByTmbId
(
tmbId
),
runtimeNodes
:
nodes
,
runtimeNodes
:
nodes
,
runtimeEdges
:
edges
,
runtimeEdges
:
edges
,
lastInteractive
,
defaultSkipNodeQueue
:
skipNodeQueue
,
lastInteractive
:
interactive
,
variables
,
variables
,
query
:
query
,
query
:
query
,
chatConfig
:
defaultApp
.
chatConfig
,
chatConfig
:
defaultApp
.
chatConfig
,
...
@@ -86,10 +87,8 @@ async function handler(
...
@@ -86,10 +87,8 @@ async function handler(
});
});
return
{
return
{
...
debugResponse
,
...
debugResponse
!
,
newVariables
,
newVariables
flowResponses
,
workflowInteractiveResponse
};
};
}
}
...
...
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