mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
App run node update (#2542)
* feat(workflow): allow apps to be invoked like plugins (#2521) * feat(workflow): allow apps to be invoked like plugins * fix type * Encapsulate SSE response methods (#2530) * perf: sse response fn * perf: sse response * fix: ts * perf: not ssl copy * perf: myselect auto scroll * perf: run app code * fix: app plugin (#2538) --------- Co-authored-by: heheer <heheer@sealos.io>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { FlowNodeTemplateType } from '@fastgpt/global/core/workflow/type/node.d';
|
||||
import { FlowNodeTypeEnum, defaultNodeVersion } from '@fastgpt/global/core/workflow/node/constant';
|
||||
import { pluginData2FlowNodeIO } from '@fastgpt/global/core/workflow/utils';
|
||||
import { appData2FlowNodeIO, pluginData2FlowNodeIO } from '@fastgpt/global/core/workflow/utils';
|
||||
import { PluginSourceEnum } from '@fastgpt/global/core/plugin/constants';
|
||||
import type { PluginRuntimeType } from '@fastgpt/global/core/workflow/runtime/type';
|
||||
import { FlowNodeTemplateTypeEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
@@ -52,10 +52,10 @@ const getPluginTemplateById = async (
|
||||
showStatus: true,
|
||||
workflow: {
|
||||
nodes: item.modules,
|
||||
edges: item.edges
|
||||
edges: item.edges,
|
||||
chatConfig: item.chatConfig
|
||||
},
|
||||
templateType: FlowNodeTemplateTypeEnum.teamApp,
|
||||
isTool: true,
|
||||
version: item?.pluginData?.nodeVersion || defaultNodeVersion,
|
||||
originCost: 0,
|
||||
currentCost: 0
|
||||
@@ -71,22 +71,27 @@ const getPluginTemplateById = async (
|
||||
/* format plugin modules to plugin preview module */
|
||||
export async function getPluginPreviewNode({ id }: { id: string }): Promise<FlowNodeTemplateType> {
|
||||
const plugin = await getPluginTemplateById(id);
|
||||
const isPlugin = !!plugin.workflow.nodes.find(
|
||||
(node) => node.flowNodeType === FlowNodeTypeEnum.pluginInput
|
||||
);
|
||||
|
||||
return {
|
||||
id: getNanoid(),
|
||||
pluginId: plugin.id,
|
||||
templateType: plugin.templateType,
|
||||
flowNodeType: FlowNodeTypeEnum.pluginModule,
|
||||
flowNodeType: isPlugin ? FlowNodeTypeEnum.pluginModule : FlowNodeTypeEnum.appModule,
|
||||
avatar: plugin.avatar,
|
||||
name: plugin.name,
|
||||
intro: plugin.intro,
|
||||
inputExplanationUrl: plugin.inputExplanationUrl,
|
||||
showStatus: plugin.showStatus,
|
||||
isTool: plugin.isTool,
|
||||
isTool: isPlugin,
|
||||
version: plugin.version,
|
||||
sourceHandle: getHandleConfig(true, true, true, true),
|
||||
targetHandle: getHandleConfig(true, true, true, true),
|
||||
...pluginData2FlowNodeIO(plugin.workflow.nodes)
|
||||
...(isPlugin
|
||||
? pluginData2FlowNodeIO({ nodes: plugin.workflow.nodes })
|
||||
: appData2FlowNodeIO({ chatConfig: plugin.workflow.chatConfig }))
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user