Skip to content

Commit 79e5557

Browse files
authored
var context (#6617)
1 parent a49321c commit 79e5557

7 files changed

Lines changed: 57 additions & 42 deletions

File tree

packages/service/core/workflow/dispatch/index.ts

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,8 +1386,6 @@ export class WorkflowQueue {
13861386
}
13871387
}
13881388
export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowResponse> => {
1389-
let { runtimeNodes = [], runtimeEdges = [], variables = {}, externalProvider } = data;
1390-
13911389
// Over max depth
13921390
data.workflowDispatchDeep++;
13931391
const isRootRuntime = data.workflowDispatchDeep === 1;
@@ -1406,20 +1404,19 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
14061404
[DispatchNodeResponseKeyEnum.assistantResponses]: [],
14071405
[DispatchNodeResponseKeyEnum.toolResponses]: null,
14081406
[DispatchNodeResponseKeyEnum.newVariables]: runtimeSystemVar2StoreType({
1409-
variables,
1410-
removeObj: externalProvider.externalWorkflowVariables,
1407+
variables: data.variables,
1408+
removeObj: data.externalProvider.externalWorkflowVariables,
14111409
userVariablesConfigs: data.chatConfig?.variables
14121410
}),
14131411
durationSeconds: 0
14141412
};
14151413
}
14161414

1417-
runtimeEdges = filterOrphanEdges({
1418-
edges: runtimeEdges,
1419-
nodes: runtimeNodes,
1415+
data.runtimeEdges = filterOrphanEdges({
1416+
edges: data.runtimeEdges,
1417+
nodes: data.runtimeNodes,
14201418
workflowId: data.runningAppInfo.id
14211419
});
1422-
data.runtimeEdges = runtimeEdges;
14231420

14241421
return withActiveSpan(
14251422
{
@@ -1434,23 +1431,27 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
14341431
'fastgpt.workflow.chat_id': data.chatId,
14351432
'fastgpt.workflow.app_version': data.apiVersion,
14361433
'fastgpt.workflow.is_tool_call': !!data.isToolCall,
1437-
'fastgpt.workflow.node_count': runtimeNodes.length,
1438-
'fastgpt.workflow.edge_count': runtimeEdges.length
1434+
'fastgpt.workflow.node_count': data.runtimeNodes.length,
1435+
'fastgpt.workflow.edge_count': data.runtimeEdges.length
14391436
}
14401437
},
14411438
async (workflowSpan) => {
14421439
const startTime = Date.now();
14431440

1444-
await rewriteRuntimeWorkFlow({ nodes: runtimeNodes, edges: runtimeEdges, lang: data.lang });
1441+
await rewriteRuntimeWorkFlow({
1442+
nodes: data.runtimeNodes,
1443+
edges: data.runtimeEdges,
1444+
lang: data.lang
1445+
});
14451446
// Init default value
14461447
data.retainDatasetCite = data.retainDatasetCite ?? true;
14471448
data.responseDetail = data.responseDetail ?? true;
14481449
data.responseAllData = data.responseAllData ?? true;
14491450

14501451
// Start process width initInput
1451-
const entryNodes = runtimeNodes.filter((item) => item.isEntry);
1452+
const entryNodes = data.runtimeNodes.filter((item) => item.isEntry);
14521453
// Reset entry
1453-
runtimeNodes.forEach((item) => {
1454+
data.runtimeNodes.forEach((item) => {
14541455
// Interactively nodes will use the "isEntry", which does not need to be updated
14551456
if (
14561457
item.flowNodeType !== FlowNodeTypeEnum.userSelect &&
@@ -1519,8 +1520,8 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
15191520
),
15201521
[DispatchNodeResponseKeyEnum.toolResponses]: workflowQueue.toolRunResponse,
15211522
[DispatchNodeResponseKeyEnum.newVariables]: runtimeSystemVar2StoreType({
1522-
variables,
1523-
removeObj: externalProvider.externalWorkflowVariables,
1523+
variables: data.variables,
1524+
removeObj: data.externalProvider.externalWorkflowVariables,
15241525
userVariablesConfigs: data.chatConfig?.variables
15251526
}),
15261527
[DispatchNodeResponseKeyEnum.memories]:

packages/service/support/outLink/runtime/utils.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,7 @@ export async function outlinkInvokeChat<T extends OutlinkAppType>({
175175
await appendRedisCache(streamResKey, '', 120);
176176

177177
// Merge global variables from database
178-
let variables = {};
179-
if (chatDetail?.variables) {
180-
variables = {
181-
...chatDetail.variables
182-
};
183-
}
178+
const variables = chatDetail?.variables ?? {};
184179

185180
const {
186181
assistantResponses,

packages/web/components/common/DateTimePicker/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React, { useState, useMemo, useRef, useEffect } from 'react';
22
import type { BoxProps } from '@chakra-ui/react';
3-
import { Box, Card, Flex, Portal, useOutsideClick } from '@chakra-ui/react';
3+
import { Box, Card, Flex, Portal } from '@chakra-ui/react';
44
import { format } from 'date-fns';
5-
import type { Matcher } from 'react-day-picker';
6-
import { DayPicker } from 'react-day-picker';
5+
import { DayPicker, type Matcher } from 'react-day-picker';
76
import 'react-day-picker/dist/style.css';
87
import { zhCN } from 'date-fns/locale/zh-CN';
98
import MyIcon from '../Icon';

packages/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"papaparse": "^5.4.1",
4040
"react": "catalog:",
4141
"react-beautiful-dnd": "^13.1.1",
42-
"react-day-picker": "^8.7.1",
42+
"react-day-picker": "^9.14.0",
4343
"react-dom": "catalog:",
4444
"react-hook-form": "7.43.1",
4545
"react-i18next": "catalog:",

pnpm-lock.yaml

Lines changed: 36 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ catalog:
2828
'@types/react-dom': ^18
2929
'@types/node': ^20
3030
axios: 1.13.6
31-
date-fns: ^4
31+
date-fns: ^3.6.0
3232
dayjs: 1.11.19
3333
eslint: ^8
3434
eslint-config-next: 15.5.12

projects/app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"p-limit": "^7.2.0",
6262
"qrcode": "^1.5.4",
6363
"react": "catalog:",
64-
"react-day-picker": "^8.7.1",
6564
"react-dom": "catalog:",
6665
"react-hook-form": "7.43.1",
6766
"react-i18next": "catalog:",

0 commit comments

Comments
 (0)