mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-05 01:02:59 +08:00
var context (#6617)
This commit is contained in:
@@ -1386,8 +1386,6 @@ export class WorkflowQueue {
|
||||
}
|
||||
}
|
||||
export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowResponse> => {
|
||||
let { runtimeNodes = [], runtimeEdges = [], variables = {}, externalProvider } = data;
|
||||
|
||||
// Over max depth
|
||||
data.workflowDispatchDeep++;
|
||||
const isRootRuntime = data.workflowDispatchDeep === 1;
|
||||
@@ -1406,20 +1404,19 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
[DispatchNodeResponseKeyEnum.assistantResponses]: [],
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]: null,
|
||||
[DispatchNodeResponseKeyEnum.newVariables]: runtimeSystemVar2StoreType({
|
||||
variables,
|
||||
removeObj: externalProvider.externalWorkflowVariables,
|
||||
variables: data.variables,
|
||||
removeObj: data.externalProvider.externalWorkflowVariables,
|
||||
userVariablesConfigs: data.chatConfig?.variables
|
||||
}),
|
||||
durationSeconds: 0
|
||||
};
|
||||
}
|
||||
|
||||
runtimeEdges = filterOrphanEdges({
|
||||
edges: runtimeEdges,
|
||||
nodes: runtimeNodes,
|
||||
data.runtimeEdges = filterOrphanEdges({
|
||||
edges: data.runtimeEdges,
|
||||
nodes: data.runtimeNodes,
|
||||
workflowId: data.runningAppInfo.id
|
||||
});
|
||||
data.runtimeEdges = runtimeEdges;
|
||||
|
||||
return withActiveSpan(
|
||||
{
|
||||
@@ -1434,23 +1431,27 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
'fastgpt.workflow.chat_id': data.chatId,
|
||||
'fastgpt.workflow.app_version': data.apiVersion,
|
||||
'fastgpt.workflow.is_tool_call': !!data.isToolCall,
|
||||
'fastgpt.workflow.node_count': runtimeNodes.length,
|
||||
'fastgpt.workflow.edge_count': runtimeEdges.length
|
||||
'fastgpt.workflow.node_count': data.runtimeNodes.length,
|
||||
'fastgpt.workflow.edge_count': data.runtimeEdges.length
|
||||
}
|
||||
},
|
||||
async (workflowSpan) => {
|
||||
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
|
||||
data.retainDatasetCite = data.retainDatasetCite ?? true;
|
||||
data.responseDetail = data.responseDetail ?? true;
|
||||
data.responseAllData = data.responseAllData ?? true;
|
||||
|
||||
// Start process width initInput
|
||||
const entryNodes = runtimeNodes.filter((item) => item.isEntry);
|
||||
const entryNodes = data.runtimeNodes.filter((item) => item.isEntry);
|
||||
// Reset entry
|
||||
runtimeNodes.forEach((item) => {
|
||||
data.runtimeNodes.forEach((item) => {
|
||||
// Interactively nodes will use the "isEntry", which does not need to be updated
|
||||
if (
|
||||
item.flowNodeType !== FlowNodeTypeEnum.userSelect &&
|
||||
@@ -1519,8 +1520,8 @@ export const runWorkflow = async (data: RunWorkflowProps): Promise<DispatchFlowR
|
||||
),
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]: workflowQueue.toolRunResponse,
|
||||
[DispatchNodeResponseKeyEnum.newVariables]: runtimeSystemVar2StoreType({
|
||||
variables,
|
||||
removeObj: externalProvider.externalWorkflowVariables,
|
||||
variables: data.variables,
|
||||
removeObj: data.externalProvider.externalWorkflowVariables,
|
||||
userVariablesConfigs: data.chatConfig?.variables
|
||||
}),
|
||||
[DispatchNodeResponseKeyEnum.memories]:
|
||||
|
||||
@@ -175,12 +175,7 @@ export async function outlinkInvokeChat<T extends OutlinkAppType>({
|
||||
await appendRedisCache(streamResKey, '', 120);
|
||||
|
||||
// Merge global variables from database
|
||||
let variables = {};
|
||||
if (chatDetail?.variables) {
|
||||
variables = {
|
||||
...chatDetail.variables
|
||||
};
|
||||
}
|
||||
const variables = chatDetail?.variables ?? {};
|
||||
|
||||
const {
|
||||
assistantResponses,
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import React, { useState, useMemo, useRef, useEffect } from '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 type { Matcher } from 'react-day-picker';
|
||||
import { DayPicker } from 'react-day-picker';
|
||||
import { DayPicker, type Matcher } from 'react-day-picker';
|
||||
import 'react-day-picker/dist/style.css';
|
||||
import { zhCN } from 'date-fns/locale/zh-CN';
|
||||
import MyIcon from '../Icon';
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"papaparse": "^5.4.1",
|
||||
"react": "catalog:",
|
||||
"react-beautiful-dnd": "^13.1.1",
|
||||
"react-day-picker": "^8.7.1",
|
||||
"react-day-picker": "^9.14.0",
|
||||
"react-dom": "catalog:",
|
||||
"react-hook-form": "7.43.1",
|
||||
"react-i18next": "catalog:",
|
||||
|
||||
Generated
+36
-15
@@ -58,8 +58,8 @@ catalogs:
|
||||
specifier: 1.13.6
|
||||
version: 1.13.6
|
||||
date-fns:
|
||||
specifier: ^4
|
||||
version: 4.1.0
|
||||
specifier: ^3.6.0
|
||||
version: 3.6.0
|
||||
dayjs:
|
||||
specifier: 1.11.19
|
||||
version: 1.11.19
|
||||
@@ -296,7 +296,7 @@ importers:
|
||||
version: 0.7.2
|
||||
date-fns:
|
||||
specifier: 'catalog:'
|
||||
version: 4.1.0
|
||||
version: 3.6.0
|
||||
dayjs:
|
||||
specifier: 'catalog:'
|
||||
version: 1.11.19
|
||||
@@ -531,7 +531,7 @@ importers:
|
||||
version: 1.13.6
|
||||
date-fns:
|
||||
specifier: 'catalog:'
|
||||
version: 4.1.0
|
||||
version: 3.6.0
|
||||
dayjs:
|
||||
specifier: 'catalog:'
|
||||
version: 1.11.19
|
||||
@@ -563,8 +563,8 @@ importers:
|
||||
specifier: ^13.1.1
|
||||
version: 13.1.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
react-day-picker:
|
||||
specifier: ^8.7.1
|
||||
version: 8.10.1(date-fns@4.1.0)(react@18.3.1)
|
||||
specifier: ^9.14.0
|
||||
version: 9.14.0(react@18.3.1)
|
||||
react-dom:
|
||||
specifier: 'catalog:'
|
||||
version: 18.3.1(react@18.3.1)
|
||||
@@ -685,7 +685,7 @@ importers:
|
||||
version: 1.13.6
|
||||
date-fns:
|
||||
specifier: 'catalog:'
|
||||
version: 4.1.0
|
||||
version: 3.6.0
|
||||
dayjs:
|
||||
specifier: 'catalog:'
|
||||
version: 1.11.19
|
||||
@@ -755,9 +755,6 @@ importers:
|
||||
react:
|
||||
specifier: 'catalog:'
|
||||
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:
|
||||
specifier: 'catalog:'
|
||||
version: 18.3.1(react@18.3.1)
|
||||
@@ -2158,6 +2155,9 @@ packages:
|
||||
resolution: {integrity: sha512-mepCf/e9+SKYy1d02/UkvSy6+6MoyXhVxP8lLDfA7BPE1X1d4dR0sZznmbM8/XVJ1GPM+Svnx7Xj6ZweByWUkw==}
|
||||
engines: {node: '>17.0.0'}
|
||||
|
||||
'@date-fns/tz@1.4.1':
|
||||
resolution: {integrity: sha512-P5LUNhtbj6YfI3iJjw5EL9eUAG6OitD0W3fWQcpQjDRc/QIsL0tRNuO1PcDvPccWL1fSTXXdE1ds+l95DV/OFA==}
|
||||
|
||||
'@discoveryjs/json-ext@0.5.7':
|
||||
resolution: {integrity: sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
@@ -4638,6 +4638,10 @@ packages:
|
||||
zod:
|
||||
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':
|
||||
resolution: {integrity: sha512-DJSilV5+ytBP1FbFcEJovv4rnnm/CokuVvrBEtW/Va9DvuJ3HksbXUJEpI0aV1KtuL4ZoO9AVE6PyNLzF7tLeA==}
|
||||
|
||||
@@ -6321,6 +6325,12 @@ packages:
|
||||
resolution: {integrity: sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==}
|
||||
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:
|
||||
resolution: {integrity: sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==}
|
||||
|
||||
@@ -9691,11 +9701,11 @@ packages:
|
||||
peerDependencies:
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc
|
||||
|
||||
react-day-picker@8.10.1:
|
||||
resolution: {integrity: sha512-TMx7fNbhLk15eqcMt+7Z7S2KF7mfTId/XJDjKE8f+IUcFn0l08/kI4FiYTL/0yuOLmEcbR4Fwe3GJf/NiiMnPA==}
|
||||
react-day-picker@9.14.0:
|
||||
resolution: {integrity: sha512-tBaoDWjPwe0M5pGrum4H0SR6Lyk+BO9oHnp9JbKpGKW2mlraNPgP9BMfsg5pWpwrssARmeqk7YBl2oXutZTaHA==}
|
||||
engines: {node: '>=18'}
|
||||
peerDependencies:
|
||||
date-fns: ^2.28.0 || ^3.0.0
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0
|
||||
react: '>=16.8.0'
|
||||
|
||||
react-dom@18.3.1:
|
||||
resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==}
|
||||
@@ -13253,6 +13263,8 @@ snapshots:
|
||||
|
||||
'@dagrejs/graphlib@2.2.4': {}
|
||||
|
||||
'@date-fns/tz@1.4.1': {}
|
||||
|
||||
'@discoveryjs/json-ext@0.5.7': {}
|
||||
|
||||
'@dmsnell/diff-match-patch@1.1.0': {}
|
||||
@@ -15889,6 +15901,8 @@ snapshots:
|
||||
typescript: 5.9.3
|
||||
zod: 4.1.12
|
||||
|
||||
'@tabby_ai/hijri-converter@1.0.5': {}
|
||||
|
||||
'@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)':
|
||||
@@ -17949,6 +17963,10 @@ snapshots:
|
||||
es-errors: 1.3.0
|
||||
is-data-view: 1.0.2
|
||||
|
||||
date-fns-jalali@4.1.0-0: {}
|
||||
|
||||
date-fns@3.6.0: {}
|
||||
|
||||
date-fns@4.1.0: {}
|
||||
|
||||
dateformat@2.2.0: {}
|
||||
@@ -22068,9 +22086,12 @@ snapshots:
|
||||
'@babel/runtime': 7.26.10
|
||||
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:
|
||||
'@date-fns/tz': 1.4.1
|
||||
'@tabby_ai/hijri-converter': 1.0.5
|
||||
date-fns: 4.1.0
|
||||
date-fns-jalali: 4.1.0-0
|
||||
react: 18.3.1
|
||||
|
||||
react-dom@18.3.1(react@18.3.1):
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ catalog:
|
||||
'@types/react-dom': ^18
|
||||
'@types/node': ^20
|
||||
axios: 1.13.6
|
||||
date-fns: ^4
|
||||
date-fns: ^3.6.0
|
||||
dayjs: 1.11.19
|
||||
eslint: ^8
|
||||
eslint-config-next: 15.5.12
|
||||
|
||||
@@ -61,7 +61,6 @@
|
||||
"p-limit": "^7.2.0",
|
||||
"qrcode": "^1.5.4",
|
||||
"react": "catalog:",
|
||||
"react-day-picker": "^8.7.1",
|
||||
"react-dom": "catalog:",
|
||||
"react-hook-form": "7.43.1",
|
||||
"react-i18next": "catalog:",
|
||||
|
||||
Reference in New Issue
Block a user