Commit 79e5557e by Archer Committed by GitHub

var context (#6617)

parent a49321c8
...@@ -1386,8 +1386,6 @@ export class WorkflowQueue { ...@@ -1386,8 +1386,6 @@ export class WorkflowQueue {
} }
} }
export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowResponse> => { export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowResponse> => {
let { runtimeNodes = [], runtimeEdges = [], variables = {}, externalProvider } = data;
// Over max depth // Over max depth
data.workflowDispatchDeep++; data.workflowDispatchDeep++;
const isRootRuntime = data.workflowDispatchDeep === 1; const isRootRuntime = data.workflowDispatchDeep === 1;
...@@ -1406,20 +1404,19 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR ...@@ -1406,20 +1404,19 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
[DispatchNodeResponseKeyEnum.assistantResponses]: [], [DispatchNodeResponseKeyEnum.assistantResponses]: [],
[DispatchNodeResponseKeyEnum.toolResponses]: null, [DispatchNodeResponseKeyEnum.toolResponses]: null,
[DispatchNodeResponseKeyEnum.newVariables]: runtimeSystemVar2StoreType({ [DispatchNodeResponseKeyEnum.newVariables]: runtimeSystemVar2StoreType({
variables, variables: data.variables,
removeObj: externalProvider.externalWorkflowVariables, removeObj: data.externalProvider.externalWorkflowVariables,
userVariablesConfigs: data.chatConfig?.variables userVariablesConfigs: data.chatConfig?.variables
}), }),
durationSeconds: 0 durationSeconds: 0
}; };
} }
runtimeEdges = filterOrphanEdges({ data.runtimeEdges = filterOrphanEdges({
edges: runtimeEdges, edges: data.runtimeEdges,
nodes: runtimeNodes, nodes: data.runtimeNodes,
workflowId: data.runningAppInfo.id workflowId: data.runningAppInfo.id
}); });
data.runtimeEdges = runtimeEdges;
return withActiveSpan( return withActiveSpan(
{ {
...@@ -1434,23 +1431,27 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR ...@@ -1434,23 +1431,27 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
'fastgpt.workflow.chat_id': data.chatId, 'fastgpt.workflow.chat_id': data.chatId,
'fastgpt.workflow.app_version': data.apiVersion, 'fastgpt.workflow.app_version': data.apiVersion,
'fastgpt.workflow.is_tool_call': !!data.isToolCall, 'fastgpt.workflow.is_tool_call': !!data.isToolCall,
'fastgpt.workflow.node_count': runtimeNodes.length, 'fastgpt.workflow.node_count': data.runtimeNodes.length,
'fastgpt.workflow.edge_count': runtimeEdges.length 'fastgpt.workflow.edge_count': data.runtimeEdges.length
} }
}, },
async (workflowSpan) => { async (workflowSpan) => {
const startTime = Date.now(); const startTime = Date.now();
await rewriteRuntimeWorkFlow({ nodes: runtimeNodes, edges: runtimeEdges, lang: data.lang }); await rewriteRuntimeWorkFlow({
nodes: data.runtimeNodes,
edges: data.runtimeEdges,
lang: data.lang
});
// Init default value // Init default value
data.retainDatasetCite = data.retainDatasetCite ?? true; data.retainDatasetCite = data.retainDatasetCite ?? true;
data.responseDetail = data.responseDetail ?? true; data.responseDetail = data.responseDetail ?? true;
data.responseAllData = data.responseAllData ?? true; data.responseAllData = data.responseAllData ?? true;
// Start process width initInput // Start process width initInput
const entryNodes = runtimeNodes.filter((item) => item.isEntry); const entryNodes = data.runtimeNodes.filter((item) => item.isEntry);
// Reset entry // Reset entry
runtimeNodes.forEach((item) => { data.runtimeNodes.forEach((item) => {
// Interactively nodes will use the "isEntry", which does not need to be updated // Interactively nodes will use the "isEntry", which does not need to be updated
if ( if (
item.flowNodeType !== FlowNodeTypeEnum.userSelect && item.flowNodeType !== FlowNodeTypeEnum.userSelect &&
...@@ -1519,8 +1520,8 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR ...@@ -1519,8 +1520,8 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
), ),
[DispatchNodeResponseKeyEnum.toolResponses]: workflowQueue.toolRunResponse, [DispatchNodeResponseKeyEnum.toolResponses]: workflowQueue.toolRunResponse,
[DispatchNodeResponseKeyEnum.newVariables]: runtimeSystemVar2StoreType({ [DispatchNodeResponseKeyEnum.newVariables]: runtimeSystemVar2StoreType({
variables, variables: data.variables,
removeObj: externalProvider.externalWorkflowVariables, removeObj: data.externalProvider.externalWorkflowVariables,
userVariablesConfigs: data.chatConfig?.variables userVariablesConfigs: data.chatConfig?.variables
}), }),
[DispatchNodeResponseKeyEnum.memories]: [DispatchNodeResponseKeyEnum.memories]:
......
...@@ -175,12 +175,7 @@ export async function outlinkInvokeChat<T extends OutlinkAppType>({ ...@@ -175,12 +175,7 @@ export async function outlinkInvokeChat<T extends OutlinkAppType>({
await appendRedisCache(streamResKey, '', 120); await appendRedisCache(streamResKey, '', 120);
// Merge global variables from database // Merge global variables from database
let variables = {}; const variables = chatDetail?.variables ?? {};
if (chatDetail?.variables) {
variables = {
...chatDetail.variables
};
}
const { const {
assistantResponses, assistantResponses,
......
import React, { useState, useMemo, useRef, useEffect } from 'react'; import React, { useState, useMemo, useRef, useEffect } from 'react';
import type { BoxProps } from '@chakra-ui/react'; import type { BoxProps } from '@chakra-ui/react';
import { Box, Card, Flex, Portal, useOutsideClick } from '@chakra-ui/react'; import { Box, Card, Flex, Portal } from '@chakra-ui/react';
import { format } from 'date-fns'; import { format } from 'date-fns';
import type { Matcher } from 'react-day-picker'; import { DayPicker, type Matcher } from 'react-day-picker';
import { DayPicker } from 'react-day-picker';
import 'react-day-picker/dist/style.css'; import 'react-day-picker/dist/style.css';
import { zhCN } from 'date-fns/locale/zh-CN'; import { zhCN } from 'date-fns/locale/zh-CN';
import MyIcon from '../Icon'; import MyIcon from '../Icon';
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
"papaparse": "^5.4.1", "papaparse": "^5.4.1",
"react": "catalog:", "react": "catalog:",
"react-beautiful-dnd": "^13.1.1", "react-beautiful-dnd": "^13.1.1",
"react-day-picker": "^8.7.1", "react-day-picker": "^9.14.0",
"react-dom": "catalog:", "react-dom": "catalog:",
"react-hook-form": "7.43.1", "react-hook-form": "7.43.1",
"react-i18next": "catalog:", "react-i18next": "catalog:",
......
...@@ -58,8 +58,8 @@ catalogs: ...@@ -58,8 +58,8 @@ catalogs:
specifier: 1.13.6 specifier: 1.13.6
version: 1.13.6 version: 1.13.6
date-fns: date-fns:
specifier: ^4 specifier: ^3.6.0
version: 4.1.0 version: 3.6.0
dayjs: dayjs:
specifier: 1.11.19 specifier: 1.11.19
version: 1.11.19 version: 1.11.19
...@@ -296,7 +296,7 @@ importers: ...@@ -296,7 +296,7 @@ importers:
version: 0.7.2 version: 0.7.2
date-fns: date-fns:
specifier: 'catalog:' specifier: 'catalog:'
version: 4.1.0 version: 3.6.0
dayjs: dayjs:
specifier: 'catalog:' specifier: 'catalog:'
version: 1.11.19 version: 1.11.19
...@@ -531,7 +531,7 @@ importers: ...@@ -531,7 +531,7 @@ importers:
version: 1.13.6 version: 1.13.6
date-fns: date-fns:
specifier: 'catalog:' specifier: 'catalog:'
version: 4.1.0 version: 3.6.0
dayjs: dayjs:
specifier: 'catalog:' specifier: 'catalog:'
version: 1.11.19 version: 1.11.19
...@@ -563,8 +563,8 @@ importers: ...@@ -563,8 +563,8 @@ importers:
specifier: ^13.1.1 specifier: ^13.1.1
version: 13.1.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) version: 13.1.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
react-day-picker: react-day-picker:
specifier: ^8.7.1 specifier: ^9.14.0
version: 8.10.1(date-fns@4.1.0)(react@18.3.1) version: 9.14.0(react@18.3.1)
react-dom: react-dom:
specifier: 'catalog:' specifier: 'catalog:'
version: 18.3.1(react@18.3.1) version: 18.3.1(react@18.3.1)
...@@ -685,7 +685,7 @@ importers: ...@@ -685,7 +685,7 @@ importers:
version: 1.13.6 version: 1.13.6
date-fns: date-fns:
specifier: 'catalog:' specifier: 'catalog:'
version: 4.1.0 version: 3.6.0
dayjs: dayjs:
specifier: 'catalog:' specifier: 'catalog:'
version: 1.11.19 version: 1.11.19
...@@ -755,9 +755,6 @@ importers: ...@@ -755,9 +755,6 @@ importers:
react: react:
specifier: 'catalog:' specifier: 'catalog:'
version: 18.3.1 version: 18.3.1
react-day-picker:
specifier: ^8.7.1
version: 8.10.1(date-fns@4.1.0)(react@18.3.1)
react-dom: react-dom:
specifier: 'catalog:' specifier: 'catalog:'
version: 18.3.1(react@18.3.1) version: 18.3.1(react@18.3.1)
...@@ -2158,6 +2155,9 @@ packages: ...@@ -2158,6 +2155,9 @@ packages:
resolution: {integrity: sha512-mepCf/e9+SKYy1d02/UkvSy6+6MoyXhVxP8lLDfA7BPE1X1d4dR0sZznmbM8/XVJ1GPM+Svnx7Xj6ZweByWUkw==} resolution: {integrity: sha512-mepCf/e9+SKYy1d02/UkvSy6+6MoyXhVxP8lLDfA7BPE1X1d4dR0sZznmbM8/XVJ1GPM+Svnx7Xj6ZweByWUkw==}
engines: {node: '>17.0.0'} engines: {node: '>17.0.0'}
'@date-fns/tz@1.4.1':
resolution: {integrity: sha512-P5LUNhtbj6YfI3iJjw5EL9eUAG6OitD0W3fWQcpQjDRc/QIsL0tRNuO1PcDvPccWL1fSTXXdE1ds+l95DV/OFA==}
'@discoveryjs/json-ext@0.5.7': '@discoveryjs/json-ext@0.5.7':
resolution: {integrity: sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==} resolution: {integrity: sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==}
engines: {node: '>=10.0.0'} engines: {node: '>=10.0.0'}
...@@ -4638,6 +4638,10 @@ packages: ...@@ -4638,6 +4638,10 @@ packages:
zod: zod:
optional: true optional: true
'@tabby_ai/hijri-converter@1.0.5':
resolution: {integrity: sha512-r5bClKrcIusDoo049dSL8CawnHR6mRdDwhlQuIgZRNty68q0x8k3Lf1BtPAMxRf/GgnHBnIO4ujd3+GQdLWzxQ==}
engines: {node: '>=16.0.0'}
'@tanstack/query-core@4.36.1': '@tanstack/query-core@4.36.1':
resolution: {integrity: sha512-DJSilV5+ytBP1FbFcEJovv4rnnm/CokuVvrBEtW/Va9DvuJ3HksbXUJEpI0aV1KtuL4ZoO9AVE6PyNLzF7tLeA==} resolution: {integrity: sha512-DJSilV5+ytBP1FbFcEJovv4rnnm/CokuVvrBEtW/Va9DvuJ3HksbXUJEpI0aV1KtuL4ZoO9AVE6PyNLzF7tLeA==}
...@@ -6321,6 +6325,12 @@ packages: ...@@ -6321,6 +6325,12 @@ packages:
resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==} resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
date-fns-jalali@4.1.0-0:
resolution: {integrity: sha512-hTIP/z+t+qKwBDcmmsnmjWTduxCg+5KfdqWQvb2X/8C9+knYY6epN/pfxdDuyVlSVeFz0sM5eEfwIUQ70U4ckg==}
date-fns@3.6.0:
resolution: {integrity: sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==}
date-fns@4.1.0: date-fns@4.1.0:
resolution: {integrity: sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==} resolution: {integrity: sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==}
...@@ -9691,11 +9701,11 @@ packages: ...@@ -9691,11 +9701,11 @@ packages:
peerDependencies: peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
react-day-picker@8.10.1: react-day-picker@9.14.0:
resolution: {integrity: sha512-TMx7fNbhLk15eqcMt+7Z7S2KF7mfTId/XJDjKE8f+IUcFn0l08/kI4FiYTL/0yuOLmEcbR4Fwe3GJf/NiiMnPA==} resolution: {integrity: sha512-tBaoDWjPwe0M5pGrum4H0SR6Lyk+BO9oHnp9JbKpGKW2mlraNPgP9BMfsg5pWpwrssARmeqk7YBl2oXutZTaHA==}
engines: {node: '>=18'}
peerDependencies: peerDependencies:
date-fns: ^2.28.0 || ^3.0.0 react: '>=16.8.0'
react: ^16.8.0 || ^17.0.0 || ^18.0.0
react-dom@18.3.1: react-dom@18.3.1:
resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==} resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==}
...@@ -13253,6 +13263,8 @@ snapshots: ...@@ -13253,6 +13263,8 @@ snapshots:
'@dagrejs/graphlib@2.2.4': {} '@dagrejs/graphlib@2.2.4': {}
'@date-fns/tz@1.4.1': {}
'@discoveryjs/json-ext@0.5.7': {} '@discoveryjs/json-ext@0.5.7': {}
'@dmsnell/diff-match-patch@1.1.0': {} '@dmsnell/diff-match-patch@1.1.0': {}
...@@ -15889,6 +15901,8 @@ snapshots: ...@@ -15889,6 +15901,8 @@ snapshots:
typescript: 5.9.3 typescript: 5.9.3
zod: 4.1.12 zod: 4.1.12
'@tabby_ai/hijri-converter@1.0.5': {}
'@tanstack/query-core@4.36.1': {} '@tanstack/query-core@4.36.1': {}
'@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': '@tanstack/react-query@4.36.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)':
...@@ -17949,6 +17963,10 @@ snapshots: ...@@ -17949,6 +17963,10 @@ snapshots:
es-errors: 1.3.0 es-errors: 1.3.0
is-data-view: 1.0.2 is-data-view: 1.0.2
date-fns-jalali@4.1.0-0: {}
date-fns@3.6.0: {}
date-fns@4.1.0: {} date-fns@4.1.0: {}
dateformat@2.2.0: {} dateformat@2.2.0: {}
...@@ -22068,9 +22086,12 @@ snapshots: ...@@ -22068,9 +22086,12 @@ snapshots:
'@babel/runtime': 7.26.10 '@babel/runtime': 7.26.10
react: 18.3.1 react: 18.3.1
react-day-picker@8.10.1(date-fns@4.1.0)(react@18.3.1): react-day-picker@9.14.0(react@18.3.1):
dependencies: dependencies:
'@date-fns/tz': 1.4.1
'@tabby_ai/hijri-converter': 1.0.5
date-fns: 4.1.0 date-fns: 4.1.0
date-fns-jalali: 4.1.0-0
react: 18.3.1 react: 18.3.1
react-dom@18.3.1(react@18.3.1): react-dom@18.3.1(react@18.3.1):
......
...@@ -28,7 +28,7 @@ catalog: ...@@ -28,7 +28,7 @@ catalog:
'@types/react-dom': ^18 '@types/react-dom': ^18
'@types/node': ^20 '@types/node': ^20
axios: 1.13.6 axios: 1.13.6
date-fns: ^4 date-fns: ^3.6.0
dayjs: 1.11.19 dayjs: 1.11.19
eslint: ^8 eslint: ^8
eslint-config-next: 15.5.12 eslint-config-next: 15.5.12
......
...@@ -61,7 +61,6 @@ ...@@ -61,7 +61,6 @@
"p-limit": "^7.2.0", "p-limit": "^7.2.0",
"qrcode": "^1.5.4", "qrcode": "^1.5.4",
"react": "catalog:", "react": "catalog:",
"react-day-picker": "^8.7.1",
"react-dom": "catalog:", "react-dom": "catalog:",
"react-hook-form": "7.43.1", "react-hook-form": "7.43.1",
"react-i18next": "catalog:", "react-i18next": "catalog:",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment