feat: Update the handler function to use default parameters to simplify the code
This commit is contained in:
@@ -21,8 +21,8 @@ async function handler(
|
|||||||
edges = [],
|
edges = [],
|
||||||
variables = {},
|
variables = {},
|
||||||
appId,
|
appId,
|
||||||
query: requestQuery,
|
query = [],
|
||||||
history: requestHistories
|
history = []
|
||||||
} = req.body as PostWorkflowDebugProps;
|
} = req.body as PostWorkflowDebugProps;
|
||||||
|
|
||||||
if (!nodes) {
|
if (!nodes) {
|
||||||
@@ -39,9 +39,6 @@ async function handler(
|
|||||||
throw new Error('No entry node found');
|
throw new Error('No entry node found');
|
||||||
}
|
}
|
||||||
|
|
||||||
const histories: ChatItemType[] = requestHistories || [];
|
|
||||||
const query: UserChatItemValueItemType[] = requestQuery || [];
|
|
||||||
|
|
||||||
/* user auth */
|
/* user auth */
|
||||||
const [{ teamId, tmbId }, { app }] = await Promise.all([
|
const [{ teamId, tmbId }, { app }] = await Promise.all([
|
||||||
authCert({
|
authCert({
|
||||||
@@ -78,7 +75,7 @@ async function handler(
|
|||||||
variables,
|
variables,
|
||||||
query: query,
|
query: query,
|
||||||
chatConfig: defaultApp.chatConfig,
|
chatConfig: defaultApp.chatConfig,
|
||||||
histories: histories,
|
histories: history,
|
||||||
stream: false,
|
stream: false,
|
||||||
maxRunTimes: WORKFLOW_MAX_RUN_TIMES
|
maxRunTimes: WORKFLOW_MAX_RUN_TIMES
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user