Skip to content

Commit

Permalink
fix: workflow clear repeat check run (#2646)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu authored Sep 9, 2024
1 parent a1ae08f commit 3ea1853
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
9 changes: 4 additions & 5 deletions packages/service/core/workflow/dispatch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
};
}

// 每个节点 运行/跳过 ,初始化边的状态
function nodeRunAfterHook(node: RuntimeNodeItemType) {
// 每个节点确定 运行/跳过 ,初始化边的状态
function nodeRunBeforeHook(node: RuntimeNodeItemType) {
node.isEntry = false;

runtimeEdges.forEach((item) => {
Expand All @@ -331,11 +331,13 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
});
const nodeRunResult = await (() => {
if (status === 'run') {
nodeRunBeforeHook(node);
props.maxRunTimes--;
addLog.debug(`[dispatchWorkFlow] nodeRunWithActive: ${node.name}`);
return nodeRunWithActive(node);
}
if (status === 'skip' && !skippedNodeIdList.has(node.nodeId)) {
nodeRunBeforeHook(node);
props.maxRunTimes -= 0.1;
skippedNodeIdList.add(node.nodeId);
addLog.debug(`[dispatchWorkFlow] nodeRunWithSkip: ${node.name}`);
Expand Down Expand Up @@ -502,8 +504,6 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
dispatchRes[item.key] = valueTypeFormat(item.defaultValue, item.valueType);
});

nodeRunAfterHook(node);

return {
node,
runStatus: 'run',
Expand All @@ -520,7 +520,6 @@ export async function dispatchWorkFlow(data: Props): Promise<DispatchFlowRespons
}> {
// Set target edges status to skipped
const targetEdges = runtimeEdges.filter((item) => item.source === node.nodeId);
nodeRunAfterHook(node);

return {
node,
Expand Down
7 changes: 6 additions & 1 deletion projects/app/src/pages/api/common/system/getInitData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
data: {
feConfigs: global.feConfigs,
subPlans: global.subPlans,
llmModels: global.llmModels,
llmModels: global.llmModels.map((model) => ({
...model,
customCQPrompt: '',
customExtractPrompt: '',
defaultSystemChatPrompt: ''
})),
vectorModels: global.vectorModels,
reRankModels:
global.reRankModels?.map((item) => ({
Expand Down

0 comments on commit 3ea1853

Please sign in to comment.