fix child app update variables (#4385)

This commit is contained in:
heheer
2025-03-28 17:36:07 +08:00
committed by GitHub
parent 0ed99d8c9a
commit a37c75159f
5 changed files with 20 additions and 8 deletions

View File

@@ -40,6 +40,7 @@ export type ChatDispatchProps = {
id: string; // May be the id of the system plug-in (cannot be used directly to look up the table) id: string; // May be the id of the system plug-in (cannot be used directly to look up the table)
teamId: string; teamId: string;
tmbId: string; // App tmbId tmbId: string; // App tmbId
isChildApp?: boolean;
}; };
runningUserInfo: { runningUserInfo: {
teamId: string; teamId: string;

View File

@@ -90,7 +90,8 @@ export const dispatchRunPlugin = async (props: RunPluginProps): Promise<RunPlugi
id: String(plugin.id), id: String(plugin.id),
// 如果系统插件有 teamId 和 tmbId则使用系统插件的 teamId 和 tmbId管理员指定了插件作为系统插件 // 如果系统插件有 teamId 和 tmbId则使用系统插件的 teamId 和 tmbId管理员指定了插件作为系统插件
teamId: plugin.teamId || runningAppInfo.teamId, teamId: plugin.teamId || runningAppInfo.teamId,
tmbId: plugin.tmbId || runningAppInfo.tmbId tmbId: plugin.tmbId || runningAppInfo.tmbId,
isChildApp: true
}, },
variables: runtimeVariables, variables: runtimeVariables,
query: getPluginRunUserQuery({ query: getPluginRunUserQuery({

View File

@@ -112,7 +112,8 @@ export const dispatchRunAppNode = async (props: Props): Promise<Response> => {
runningAppInfo: { runningAppInfo: {
id: String(appData._id), id: String(appData._id),
teamId: String(appData.teamId), teamId: String(appData.teamId),
tmbId: String(appData.tmbId) tmbId: String(appData.tmbId),
isChildApp: true
}, },
runtimeNodes: storeNodes2RuntimeNodes(nodes, getWorkflowEntryNodeIds(nodes)), runtimeNodes: storeNodes2RuntimeNodes(nodes, getWorkflowEntryNodeIds(nodes)),
runtimeEdges: initWorkflowEdgeStatus(edges), runtimeEdges: initWorkflowEdgeStatus(edges),

View File

@@ -19,7 +19,14 @@ type Props = ModuleDispatchProps<{
type Response = DispatchNodeResultType<{}>; type Response = DispatchNodeResultType<{}>;
export const dispatchUpdateVariable = async (props: Props): Promise<Response> => { export const dispatchUpdateVariable = async (props: Props): Promise<Response> => {
const { params, variables, runtimeNodes, workflowStreamResponse, externalProvider } = props; const {
params,
variables,
runtimeNodes,
workflowStreamResponse,
externalProvider,
runningAppInfo
} = props;
const { updateList } = params; const { updateList } = params;
const nodeIds = runtimeNodes.map((node) => node.nodeId); const nodeIds = runtimeNodes.map((node) => node.nodeId);
@@ -78,10 +85,12 @@ export const dispatchUpdateVariable = async (props: Props): Promise<Response> =>
return value; return value;
}); });
workflowStreamResponse?.({ if (!runningAppInfo.isChildApp) {
event: SseResponseEventEnum.updateVariables, workflowStreamResponse?.({
data: removeSystemVariable(variables, externalProvider.externalWorkflowVariables) event: SseResponseEventEnum.updateVariables,
}); data: removeSystemVariable(variables, externalProvider.externalWorkflowVariables)
});
}
return { return {
[DispatchNodeResponseKeyEnum.newVariables]: variables, [DispatchNodeResponseKeyEnum.newVariables]: variables,

View File

@@ -65,7 +65,7 @@ const ChatTest = ({ isOpen, nodes = [], edges = [], onClose }: Props) => {
}} }}
/> />
<MyBox <MyBox
isLoading={loading} isLoading={isPlugin && loading}
zIndex={300} zIndex={300}
display={'flex'} display={'flex'}
flexDirection={'column'} flexDirection={'column'}