diff --git a/packages/global/core/workflow/type/index.d.ts b/packages/global/core/workflow/type/index.d.ts index d5fae27ad3..d730f11472 100644 --- a/packages/global/core/workflow/type/index.d.ts +++ b/packages/global/core/workflow/type/index.d.ts @@ -6,8 +6,8 @@ import { VariableInputEnum } from '../constants'; import { DispatchNodeResponseKeyEnum } from '../runtime/constants'; -import type { FlowNodeInputItemType } from './io.d'; -import { CustomInputItemType, FlowNodeOutputItemType } from './io.d'; +import type { FlowNodeInputItemType, FlowNodeOutputItemType } from './io.d'; +import { CustomInputItemType } from './io.d'; import { ChatHistoryItemResType, ChatItemType, @@ -49,6 +49,8 @@ export type WorkflowTemplateType = { weight?: number; workflow: WorkflowTemplateBasicType; + inputs?: FlowNodeInputItemType[]; + outputs?: FlowNodeOutputItemType[]; }; // template market diff --git a/packages/global/core/workflow/utils.ts b/packages/global/core/workflow/utils.ts index ea7876eee7..2756f4537e 100644 --- a/packages/global/core/workflow/utils.ts +++ b/packages/global/core/workflow/utils.ts @@ -274,9 +274,6 @@ export const appData2FlowNodeIO = ({ }; }); - // const showFileLink = - // chatConfig?.fileSelectConfig?.canSelectFile || chatConfig?.fileSelectConfig?.canSelectImg; - return { inputs: [ Input_Template_Stream_MODE, diff --git a/packages/service/core/app/plugin/controller.ts b/packages/service/core/app/plugin/controller.ts index 7e3e34a20f..a4dbf752e3 100644 --- a/packages/service/core/app/plugin/controller.ts +++ b/packages/service/core/app/plugin/controller.ts @@ -20,10 +20,6 @@ import { type PluginRuntimeType } from '@fastgpt/global/core/plugin/type'; import { MongoSystemPlugin } from './systemPluginSchema'; import { PluginErrEnum } from '@fastgpt/global/common/error/code/plugin'; import { PluginSourceEnum } from '@fastgpt/global/core/plugin/constants'; -import type { - FlowNodeInputItemType, - FlowNodeOutputItemType -} from '@fastgpt/global/core/workflow/type/io'; import { FlowNodeTemplateTypeEnum, NodeInputKeyEnum @@ -32,7 +28,6 @@ import { getNanoid } from '@fastgpt/global/common/string/tools'; import { getSystemToolList } from '../tool/api'; import { Types } from '../../../common/mongo'; import type { SystemPluginConfigSchemaType } from './type'; -import { InputConfigType } from '@fastgpt-sdk/plugin'; /** plugin id rule: @@ -63,8 +58,6 @@ export function splitCombineToolId(id: string) { type ChildAppType = SystemPluginTemplateItemType & { teamId?: string; tmbId?: string; - inputs?: FlowNodeInputItemType[]; - outputs?: FlowNodeOutputItemType[]; }; export const getSystemPluginByIdAndVersionId = async ( @@ -73,6 +66,7 @@ export const getSystemPluginByIdAndVersionId = async ( ): Promise => { const plugin = await (async () => { const plugin = await getSystemPluginById(pluginId); + if (plugin.associatedPluginId) { // The verification plugin is set as a system plugin const systemPlugin = await MongoSystemPlugin.findOne( @@ -113,6 +107,7 @@ export const getSystemPluginByIdAndVersionId = async ( tmbId: String(app.tmbId) }; } + return plugin; })(); @@ -177,44 +172,8 @@ export async function getChildAppPreviewNode({ } })(); - const { isSystemTool, isPlugin, isTool, isToolSet } = (() => { - const isSystemTool = source === PluginSourceEnum.systemTool; - if (isSystemTool) { - return { isSystemTool }; - } - - const isPlugin = !!app.workflow.nodes.find( - (node) => node.flowNodeType === FlowNodeTypeEnum.pluginInput - ); - - const isTool = - !!app.workflow.nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.tool) && - app.workflow.nodes.length === 1; - - const isToolSet = - !!app.workflow.nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.toolSet) && - app.workflow.nodes.length === 1; - - return { isSystemTool, isPlugin, isTool, isToolSet }; - })(); - const { flowNodeType, nodeIOConfig } = (() => { - if (isToolSet) - return { - flowNodeType: FlowNodeTypeEnum.toolSet, - nodeIOConfig: toolSetData2FlowNodeIO({ nodes: app.workflow.nodes }) - }; - if (isTool) - return { - flowNodeType: FlowNodeTypeEnum.tool, - nodeIOConfig: toolData2FlowNodeIO({ nodes: app.workflow.nodes }) - }; - if (isPlugin) - return { - flowNodeType: FlowNodeTypeEnum.pluginModule, - nodeIOConfig: pluginData2FlowNodeIO({ nodes: app.workflow.nodes }) - }; - if (isSystemTool) { + if (source === PluginSourceEnum.systemTool) { return { flowNodeType: FlowNodeTypeEnum.tool, nodeIOConfig: { @@ -228,6 +187,34 @@ export async function getChildAppPreviewNode({ } }; } + + if (!!app.workflow.nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginInput)) { + return { + flowNodeType: FlowNodeTypeEnum.pluginModule, + nodeIOConfig: pluginData2FlowNodeIO({ nodes: app.workflow.nodes }) + }; + } + + if ( + !!app.workflow.nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.toolSet) && + app.workflow.nodes.length === 1 + ) { + return { + flowNodeType: FlowNodeTypeEnum.toolSet, + nodeIOConfig: toolSetData2FlowNodeIO({ nodes: app.workflow.nodes }) + }; + } + + if ( + !!app.workflow.nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.tool) && + app.workflow.nodes.length === 1 + ) { + return { + flowNodeType: FlowNodeTypeEnum.tool, + nodeIOConfig: toolData2FlowNodeIO({ nodes: app.workflow.nodes }) + }; + } + return { flowNodeType: FlowNodeTypeEnum.appModule, nodeIOConfig: appData2FlowNodeIO({ chatConfig: app.workflow.chatConfig }) @@ -420,15 +407,19 @@ export const getSystemPlugins = async (): Promise input.key === NodeInputKeyEnum.systemInputConfig) ?.inputList as any, diff --git a/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/components/ToolParamConfig.tsx b/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/components/ToolParamConfig.tsx index 9d75fcb63e..459aa7ecd6 100644 --- a/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/components/ToolParamConfig.tsx +++ b/projects/app/src/pageComponents/app/detail/WorkflowComponents/Flow/components/ToolParamConfig.tsx @@ -91,7 +91,7 @@ const ToolParamConfigModal = ({ {inputList.map((item, i) => { const inputKey = `value.${item.key}.value`; const value = getValues(`value.${item.key}`); - const showInput = !!value?.value || editIndex === i; + const showInput = !!value?.value || !value?.secret || editIndex === i; return (