mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-22 11:55:07 +00:00
fix: plugin not get system input config (#5363)
* doc * fix: action * fix: plugin not get system input config * perf: rewrite toolset
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { getErrText } from '@fastgpt/global/common/error/utils';
|
||||
import { ChatRoleEnum } from '@fastgpt/global/core/chat/constants';
|
||||
import type { ChatItemType } from '@fastgpt/global/core/chat/type.d';
|
||||
import { NodeInputKeyEnum, NodeOutputKeyEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import { NodeOutputKeyEnum } from '@fastgpt/global/core/workflow/constants';
|
||||
import {
|
||||
type RuntimeEdgeItemType,
|
||||
type RuntimeNodeItemType,
|
||||
@@ -17,12 +17,9 @@ import { getNanoid } from '@fastgpt/global/common/string/tools';
|
||||
import { type SearchDataResponseItemType } from '@fastgpt/global/core/dataset/type';
|
||||
import { getMCPToolRuntimeNode } from '@fastgpt/global/core/app/mcpTools/utils';
|
||||
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
|
||||
import {
|
||||
getSystemPluginRuntimeNodeById,
|
||||
getSystemTools
|
||||
} from '../../../core/app/plugin/controller';
|
||||
import { MongoApp } from '../../../core/app/schema';
|
||||
import { getMCPChildren } from '../../../core/app/mcp';
|
||||
import { getSystemToolRunTimeNodeFromSystemToolset } from '../utils';
|
||||
|
||||
export const getWorkflowResponseWrite = ({
|
||||
res,
|
||||
@@ -197,29 +194,13 @@ export const rewriteRuntimeWorkFlow = async ({
|
||||
|
||||
// systemTool
|
||||
if (systemToolId) {
|
||||
const toolsetInputConfig = toolSetNode.inputs.find(
|
||||
(item) => item.key === NodeInputKeyEnum.systemInputConfig
|
||||
);
|
||||
const tools = await getSystemTools();
|
||||
const children = tools.filter((item) => item.parentId === systemToolId);
|
||||
for (const child of children) {
|
||||
const toolListItem = toolSetNode.toolConfig?.systemToolSet?.toolList.find(
|
||||
(item) => item.toolId === child.id
|
||||
)!;
|
||||
const newNode = await getSystemPluginRuntimeNodeById({
|
||||
pluginId: child.id,
|
||||
name: toolListItem?.name,
|
||||
intro: toolListItem?.description
|
||||
});
|
||||
const newNodeInputConfig = newNode.inputs.find(
|
||||
(item) => item.key === NodeInputKeyEnum.systemInputConfig
|
||||
);
|
||||
if (newNodeInputConfig) {
|
||||
newNodeInputConfig.value = toolsetInputConfig?.value;
|
||||
}
|
||||
nodes.push(newNode);
|
||||
pushEdges(newNode.nodeId);
|
||||
}
|
||||
const children = await getSystemToolRunTimeNodeFromSystemToolset({
|
||||
toolSetNode
|
||||
});
|
||||
children.forEach((node) => {
|
||||
nodes.push(node);
|
||||
pushEdges(node.nodeId);
|
||||
});
|
||||
} else if (mcpToolsetVal) {
|
||||
const app = await MongoApp.findOne({ _id: toolSetNode.pluginId }).lean();
|
||||
if (!app) continue;
|
||||
|
||||
Reference in New Issue
Block a user