From 7495b6449997c8af754bcf980e3fb03c6e044e13 Mon Sep 17 00:00:00 2001 From: sd0ric4 <1286518974@qq.com> Date: Wed, 26 Mar 2025 19:19:36 +0800 Subject: [PATCH] feat: Update the handler function to use default parameters to simplify the code --- projects/app/src/pages/api/core/workflow/debug.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/projects/app/src/pages/api/core/workflow/debug.ts b/projects/app/src/pages/api/core/workflow/debug.ts index 9571a71f8..78f5d6bba 100644 --- a/projects/app/src/pages/api/core/workflow/debug.ts +++ b/projects/app/src/pages/api/core/workflow/debug.ts @@ -21,8 +21,8 @@ async function handler( edges = [], variables = {}, appId, - query: requestQuery, - history: requestHistories + query = [], + history = [] } = req.body as PostWorkflowDebugProps; if (!nodes) { @@ -39,9 +39,6 @@ async function handler( throw new Error('No entry node found'); } - const histories: ChatItemType[] = requestHistories || []; - const query: UserChatItemValueItemType[] = requestQuery || []; - /* user auth */ const [{ teamId, tmbId }, { app }] = await Promise.all([ authCert({ @@ -78,7 +75,7 @@ async function handler( variables, query: query, chatConfig: defaultApp.chatConfig, - histories: histories, + histories: history, stream: false, maxRunTimes: WORKFLOW_MAX_RUN_TIMES });