From fa80ce3a77df90c46f4e28210c312b8f98b7875f Mon Sep 17 00:00:00 2001 From: heheer Date: Thu, 29 May 2025 13:37:59 +0800 Subject: [PATCH] fix child app external variables (#4919) --- packages/service/core/workflow/dispatch/index.ts | 1 - packages/service/core/workflow/dispatch/plugin/run.ts | 5 ++++- packages/service/core/workflow/dispatch/plugin/runApp.ts | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/service/core/workflow/dispatch/index.ts b/packages/service/core/workflow/dispatch/index.ts index ce0075f6e..17c3b870d 100644 --- a/packages/service/core/workflow/dispatch/index.ts +++ b/packages/service/core/workflow/dispatch/index.ts @@ -11,7 +11,6 @@ import type { SystemVariablesType } from '@fastgpt/global/core/workflow/runtime/type'; import type { RuntimeNodeItemType } from '@fastgpt/global/core/workflow/runtime/type.d'; -import type { FlowNodeOutputItemType } from '@fastgpt/global/core/workflow/type/io.d'; import type { AIChatItemValueItemType, ChatHistoryItemResType, diff --git a/packages/service/core/workflow/dispatch/plugin/run.ts b/packages/service/core/workflow/dispatch/plugin/run.ts index a1d56e18d..c774200ce 100644 --- a/packages/service/core/workflow/dispatch/plugin/run.ts +++ b/packages/service/core/workflow/dispatch/plugin/run.ts @@ -17,6 +17,7 @@ import { chatValue2RuntimePrompt } from '@fastgpt/global/core/chat/adapt'; import { getPluginRunUserQuery } from '@fastgpt/global/core/workflow/utils'; import { getPluginInputsFromStoreNodes } from '@fastgpt/global/core/app/plugin/utils'; import type { NodeInputKeyEnum } from '@fastgpt/global/core/workflow/constants'; +import { getUserChatInfoAndAuthTeamPoints } from '../../../../support/permission/auth/team'; type RunPluginProps = ModuleDispatchProps<{ [NodeInputKeyEnum.forbidStream]?: boolean; @@ -73,9 +74,11 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise => { // Rewrite children app variables const systemVariables = filterSystemVariables(variables); + const { externalProvider } = await getUserChatInfoAndAuthTeamPoints(appData.tmbId); const childrenRunVariables = { ...systemVariables, ...childrenAppVariables, histories: chatHistories, - appId: String(appData._id) + appId: String(appData._id), + ...(externalProvider ? externalProvider.externalWorkflowVariables : {}) }; const childrenInteractive =