feat: Update the handler function to use default parameters to simplify the code

This commit is contained in:
sd0ric4
2025-03-26 19:19:36 +08:00
parent 604fb6f7da
commit 7495b64499

View File

@@ -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
});