mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
fix: get plugin input variables from history (#2255)
This commit is contained in:
@@ -5,6 +5,20 @@ import { FlowNodeTypeEnum } from '../../workflow/node/constant';
|
||||
export const getPluginInputsFromStoreNodes = (nodes: StoreNodeItemType[]) => {
|
||||
return nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginInput)?.inputs || [];
|
||||
};
|
||||
export const getPluginRunContent = (e: { pluginInputs: FlowNodeInputItemType[] }) => {
|
||||
return JSON.stringify(e);
|
||||
export const getPluginRunContent = ({
|
||||
pluginInputs,
|
||||
variables
|
||||
}: {
|
||||
pluginInputs: FlowNodeInputItemType[];
|
||||
variables: Record<string, any>;
|
||||
}) => {
|
||||
const pluginInputsWithValue = pluginInputs.map((input) => {
|
||||
const { key } = input;
|
||||
const value = variables?.hasOwnProperty(key) ? variables[key] : input.defaultValue;
|
||||
return {
|
||||
...input,
|
||||
value
|
||||
};
|
||||
});
|
||||
return JSON.stringify(pluginInputsWithValue);
|
||||
};
|
||||
|
Reference in New Issue
Block a user