feature: V4.11.1 (#5350)

* perf: system toolset & mcp (#5200)

* feat: support system toolset

* fix: type

* fix: system tool config

* chore: mcptool config migrate

* refactor: mcp toolset

* fix: fe type error

* fix: type error

* fix: show version

* chore: support extract tool's secretInputConfig out of inputs

* chore: compatible with old version mcp

* chore: adjust

* deps: update dependency @fastgpt-skd/plugin

* fix: version

* fix: some bug (#5316)

* chore: compatible with old version mcp

* fix: version

* fix: compatible bug

* fix: mcp object params

* fix: type error

* chore: update test cases

* chore: remove log

* fix: toolset node name

* optimize app logs sort (#5310)

* log keys config modal

* multiple select

* api

* fontsize

* code

* chatid

* fix build

* fix

* fix component

* change name

* log keys config

* fix

* delete unused

* fix

* perf: log code

* perf: send auth code modal enter press

* fix log (#5328)

* perf: mcp toolset comment

* perf: log ui

* remove log (#5347)

* doc

* fix: action

* remove log

* fix: Table Optimization (#5319)

* feat: table test: 1

* feat: table test: 2

* feat: table test: 3

* feat: table test: 4

* feat: table test : 5 把maxSize改回chunkSize

* feat: table test : 6 都删了,只看maxSize

* feat: table test : 7 恢复初始,接下来删除标签功能

* feat: table test : 8 删除标签功能

* feat: table test : 9 删除标签功能成功

* feat: table test : 10 继续调试,修改trainingStates

* feat: table test : 11 修改第一步

* feat: table test : 12 修改第二步

* feat: table test : 13 修改了HtmlTable2Md

* feat: table test : 14 修改表头分块规则

* feat: table test : 15 前面表格分的太细了

* feat: table test : 16 改着改着表头又不加了

* feat: table test : 17 用CUSTOM_SPLIT_SIGN不行,重新改

* feat: table test : 18 表头仍然还会多加,但现在分块搞的合理了终于

* feat: table test : 19 还是需要搞好表头问题,先保存一下调试情况

* feat: table test : 20 调试结束,看一下replace有没有问题,没问题就pr

* feat: table test : 21 先把注释删了

* feat: table test : 21 注释replace都改了,下面切main分支看看情况

* feat: table test : 22 修改旧文件

* feat: table test : 23 修改测试文件

* feat: table test : 24 xlsx表格处理

* feat: table test : 25 刚才没保存先com了

* feat: table test : 26 fix

* feat: table test : 27 先com一版调试

* feat: table test : 28 试试放format2csv里

* feat: table test : 29 xlsx解决

* feat: table test : 30 tablesplit解决

* feat: table test : 31

* feat: table test : 32

* perf: table split

* perf: mcp old version compatibility (#5342)

* fix: system-tool secret inputs

* fix: rewrite runtime node i18n for system tool

* perf: mcp old version compatibility

* fix: splitPluginId

* fix: old mcp toolId

* fix: filter secret key

* feat: support system toolset activation

* chore: remove log

* perf: mcp update

* perf: rewrite toolset

* fix:delete variable id (#5335)

* perf: variable update

* fix: multiple select ui

* perf: model config move to plugin

* fix: var conflit

* perf: variable checker

* Avoid empty number

* update doc time

* fix: test

* fix: mcp object

* update count app

* update count app

---------

Co-authored-by: Finley Ge <32237950+FinleyGe@users.noreply.github.com>
Co-authored-by: heheer <heheer@sealos.io>
Co-authored-by: heheer <zhiyu44@qq.com>
Co-authored-by: colnii <1286949794@qq.com>
Co-authored-by: dreamer6680 <1468683855@qq.com>
This commit is contained in:
Archer
2025-08-01 16:08:20 +08:00
committed by GitHub
parent e0c21a949c
commit e25d7efb5b
143 changed files with 2596 additions and 4177 deletions
+14 -2
View File
@@ -1,6 +1,7 @@
import { type AppSchema } from '@fastgpt/global/core/app/type';
import { NodeInputKeyEnum } from '@fastgpt/global/core/workflow/constants';
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import { MongoApp } from './schema';
import type { StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node';
import { encryptSecretValue, storeSecretValue } from '../../common/secret/utils';
@@ -19,6 +20,7 @@ import { MongoResourcePermission } from '../../support/permission/schema';
import { PerResourceTypeEnum } from '@fastgpt/global/support/permission/constant';
import { removeImageByPath } from '../../common/file/image/controller';
import { mongoSessionRun } from '../../common/mongo/sessionRun';
import { MongoAppLogKeys } from './logs/logkeysSchema';
export const beforeUpdateAppFormat = ({ nodes }: { nodes?: StoreNodeItemType[] }) => {
if (!nodes) return;
@@ -140,6 +142,10 @@ export const onDelOneApp = async ({
fields: '_id avatar'
});
const deletedAppIds = apps
.filter((app) => app.type !== AppTypeEnum.folder)
.map((app) => String(app._id));
// Remove eval job
const evalJobs = await MongoEvaluation.find(
{
@@ -191,6 +197,10 @@ export const onDelOneApp = async ({
resourceId: appId
}).session(session);
await MongoAppLogKeys.deleteMany({
appId
}).session(session);
// delete app
await MongoApp.deleteOne(
{
@@ -204,8 +214,10 @@ export const onDelOneApp = async ({
};
if (session) {
return del(session);
await del(session);
return deletedAppIds;
}
return mongoSessionRun(del);
await mongoSessionRun(del);
return deletedAppIds;
};
@@ -0,0 +1,32 @@
import type { AppLogKeysSchemaType } from '@fastgpt/global/core/app/logs/type';
import { connectionMongo, getMongoModel } from '../../../common/mongo';
import { AppCollectionName } from '../schema';
import { TeamCollectionName } from '@fastgpt/global/support/user/team/constant';
const { Schema } = connectionMongo;
export const AppLogKeysCollectionEnum = 'app_log_keys';
const AppLogKeysSchema = new Schema({
teamId: {
type: Schema.Types.ObjectId,
ref: TeamCollectionName,
required: true
},
appId: {
type: Schema.Types.ObjectId,
ref: AppCollectionName,
required: true
},
logKeys: {
type: Array,
required: true
}
});
AppLogKeysSchema.index({ teamId: 1, appId: 1 });
export const MongoAppLogKeys = getMongoModel<AppLogKeysSchemaType>(
AppLogKeysCollectionEnum,
AppLogKeysSchema
);
+36
View File
@@ -1,9 +1,13 @@
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
import type { AppSchema } from '@fastgpt/global/core/app/type';
import { type McpToolConfigType } from '@fastgpt/global/core/app/type';
import { addLog } from '../../common/system/log';
import { retryFn } from '@fastgpt/global/common/system/utils';
import { PluginSourceEnum } from '@fastgpt/global/core/app/plugin/constants';
import { MongoApp } from './schema';
import type { McpToolDataType } from '@fastgpt/global/core/app/mcpTools/type';
export class MCPClient {
private client: Client;
@@ -128,3 +132,35 @@ export class MCPClient {
}
}
}
export const getMCPChildren = async (app: AppSchema) => {
const isNewMcp = !!app.modules[0].toolConfig?.mcpToolSet;
const id = String(app._id);
if (isNewMcp) {
return (
app.modules[0].toolConfig?.mcpToolSet?.toolList.map((item) => ({
...item,
id: `${PluginSourceEnum.mcp}-${id}/${item.name}`,
avatar: app.avatar
})) ?? []
);
} else {
// Old mcp toolset
const children = await MongoApp.find({
teamId: app.teamId,
parentId: id
}).lean();
return children.map((item) => {
const node = item.modules[0];
const toolData: McpToolDataType = node.inputs[0].value;
return {
avatar: app.avatar,
id: `${PluginSourceEnum.mcp}-${id}/${item.name}`,
...toolData
};
});
}
};
+244 -130
View File
@@ -1,6 +1,10 @@
import { type FlowNodeTemplateType } from '@fastgpt/global/core/workflow/type/node.d';
import type {
NodeToolConfigType,
FlowNodeTemplateType
} from '@fastgpt/global/core/workflow/type/node.d';
import {
FlowNodeOutputTypeEnum,
FlowNodeInputTypeEnum,
FlowNodeTypeEnum
} from '@fastgpt/global/core/workflow/node/constant';
import {
@@ -28,7 +32,7 @@ import {
NodeInputKeyEnum
} from '@fastgpt/global/core/workflow/constants';
import { getNanoid } from '@fastgpt/global/common/string/tools';
import { getSystemToolList } from '../tool/api';
import { APIGetSystemToolList } from '../tool/api';
import { Types } from '../../../common/mongo';
import type { SystemPluginConfigSchemaType } from './type';
import type {
@@ -37,37 +41,11 @@ import type {
} from '@fastgpt/global/core/workflow/type/io';
import { isProduction } from '@fastgpt/global/common/system/constants';
import { Output_Template_Error_Message } from '@fastgpt/global/core/workflow/template/output';
/**
plugin id rule:
- personal: ObjectId
- commercial: commercial-ObjectId
- systemtool: systemTool-id
(deprecated) community: community-id
*/
export function splitCombinePluginId(id: string) {
const splitRes = id.split('-');
if (splitRes.length === 1) {
// app id
return {
source: PluginSourceEnum.personal,
pluginId: id
};
}
const [source, pluginId] = id.split('-') as [PluginSourceEnum, string | undefined];
if (!source || !pluginId) throw new Error('pluginId not found');
// 兼容4.10.0 之前的插件
if (source === 'community' || id === 'commercial-dalle3') {
return {
source: PluginSourceEnum.systemTool,
pluginId: `${PluginSourceEnum.systemTool}-${pluginId}`
};
}
return { source, pluginId: id };
}
import type { RuntimeNodeItemType } from '@fastgpt/global/core/workflow/runtime/type';
import { splitCombinePluginId } from '@fastgpt/global/core/app/plugin/utils';
import { getMCPToolRuntimeNode } from '@fastgpt/global/core/app/mcpTools/utils';
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import { getMCPChildren } from '../mcp';
type ChildAppType = SystemPluginTemplateItemType & {
teamId?: string;
@@ -81,77 +59,102 @@ export const getSystemPluginByIdAndVersionId = async (
pluginId: string,
versionId?: string
): Promise<ChildAppType> => {
const plugin = await (async (): Promise<ChildAppType> => {
const plugin = await getSystemPluginById(pluginId);
const plugin = await getSystemToolById(pluginId);
// Admin selected system tool
if (plugin.associatedPluginId) {
// The verification plugin is set as a system plugin
const systemPlugin = await MongoSystemPlugin.findOne(
{ pluginId: plugin.id, 'customConfig.associatedPluginId': plugin.associatedPluginId },
'associatedPluginId'
).lean();
if (!systemPlugin) return Promise.reject(PluginErrEnum.unExist);
// Admin selected system tool
if (plugin.associatedPluginId) {
// The verification plugin is set as a system plugin
const systemPlugin = await MongoSystemPlugin.findOne(
{ pluginId: plugin.id, 'customConfig.associatedPluginId': plugin.associatedPluginId },
'associatedPluginId'
).lean();
if (!systemPlugin) return Promise.reject(PluginErrEnum.unExist);
const app = await MongoApp.findById(plugin.associatedPluginId).lean();
if (!app) return Promise.reject(PluginErrEnum.unExist);
const version = versionId
? await getAppVersionById({
appId: plugin.associatedPluginId,
versionId,
app
})
: await getAppLatestVersion(plugin.associatedPluginId, app);
if (!version.versionId) return Promise.reject('App version not found');
const isLatest = version.versionId
? await checkIsLatestVersion({
appId: plugin.associatedPluginId,
versionId: version.versionId
})
: true;
return {
...plugin,
workflow: {
nodes: version.nodes,
edges: version.edges,
chatConfig: version.chatConfig
},
version: versionId ? version?.versionId : '',
versionLabel: version?.versionName,
isLatestVersion: isLatest,
teamId: String(app.teamId),
tmbId: String(app.tmbId)
};
}
// System tool
const versionList = (plugin.versionList as SystemPluginTemplateItemType['versionList']) || [];
if (versionList.length === 0) {
return Promise.reject('Can not find plugin version list');
}
const app = await MongoApp.findById(plugin.associatedPluginId).lean();
if (!app) return Promise.reject(PluginErrEnum.unExist);
const version = versionId
? versionList.find((item) => item.value === versionId) ?? versionList[0]
: versionList[0];
const lastVersion = versionList[0];
? await getAppVersionById({
appId: plugin.associatedPluginId,
versionId,
app
})
: await getAppLatestVersion(plugin.associatedPluginId, app);
if (!version.versionId) return Promise.reject('App version not found');
const isLatest = version.versionId
? await checkIsLatestVersion({
appId: plugin.associatedPluginId,
versionId: version.versionId
})
: true;
return {
...plugin,
inputs: version.inputs,
outputs: version.outputs,
version: versionId ? version?.value : '',
versionLabel: versionId ? version?.value : '',
isLatestVersion: !version || !lastVersion || version.value === lastVersion?.value
workflow: {
nodes: version.nodes,
edges: version.edges,
chatConfig: version.chatConfig
},
version: versionId ? version?.versionId : '',
versionLabel: version?.versionName,
isLatestVersion: isLatest,
teamId: String(app.teamId),
tmbId: String(app.tmbId)
};
})();
}
return plugin;
// System toolset
if (plugin.isFolder) {
return {
...plugin,
inputs: [],
outputs: [],
inputList: plugin.inputList,
version: '',
isLatestVersion: true
};
}
// System tool
const versionList = (plugin.versionList as SystemPluginTemplateItemType['versionList']) || [];
if (versionList.length === 0) {
return Promise.reject('Can not find plugin version list');
}
const version = versionId
? versionList.find((item) => item.value === versionId) ?? versionList[0]
: versionList[0];
const lastVersion = versionList[0];
// concat parent (if exists) input config
const parent = plugin.parentId ? await getSystemToolById(plugin.parentId) : undefined;
if (parent && parent.inputList) {
plugin?.inputs?.push({
key: 'system_input_config',
label: '',
renderTypeList: [FlowNodeInputTypeEnum.hidden],
inputList: parent.inputList
});
}
return {
...plugin,
inputs: version.inputs,
outputs: version.outputs,
version: versionId ? version?.value : '',
versionLabel: versionId ? version?.value : '',
isLatestVersion: !version || !lastVersion || version.value === lastVersion?.value
};
};
/* Format plugin to workflow preview node data */
/*
Format plugin to workflow preview node data
Persion workflow/plugin: objectId
Persion mcptoolset: objectId
Persion mcp tool: mcp-parentId/name
System tool/toolset: system-toolId
*/
export async function getChildAppPreviewNode({
appId,
versionId,
@@ -164,6 +167,8 @@ export async function getChildAppPreviewNode({
const { source, pluginId } = splitCombinePluginId(appId);
const app: ChildAppType = await (async () => {
// 1. App
// 2. MCP ToolSets
if (source === PluginSourceEnum.personal) {
const item = await MongoApp.findById(pluginId).lean();
if (!item) return Promise.reject(PluginErrEnum.unExist);
@@ -178,6 +183,17 @@ export async function getChildAppPreviewNode({
})
: true;
if (item.type === AppTypeEnum.toolSet) {
const children = await getMCPChildren(item);
version.nodes[0].toolConfig = {
mcpToolSet: {
toolId: pluginId,
toolList: children,
url: ''
}
};
}
return {
id: String(item._id),
teamId: String(item.teamId),
@@ -201,29 +217,105 @@ export async function getChildAppPreviewNode({
hasTokenFee: false,
pluginOrder: 0
};
} else {
}
// mcp tool
else if (source === PluginSourceEnum.mcp) {
const [parentId, toolName] = pluginId.split('/');
// 1. get parentApp
const item = await MongoApp.findById(parentId).lean();
if (!item) return Promise.reject(PluginErrEnum.unExist);
const version = await getAppVersionById({ appId: parentId, versionId, app: item });
const toolConfig = version.nodes[0].toolConfig?.mcpToolSet;
const tool = toolConfig?.toolList.find((item) => item.name === toolName);
if (!tool || !toolConfig) return Promise.reject(PluginErrEnum.unExist);
return {
avatar: item.avatar,
id: appId,
name: tool.name,
templateType: FlowNodeTemplateTypeEnum.tools,
workflow: {
nodes: [
getMCPToolRuntimeNode({
tool: {
description: tool.description,
inputSchema: tool.inputSchema,
name: tool.name
},
avatar: item.avatar,
parentId: item._id
})
],
edges: []
},
version: '',
isLatestVersion: true
};
}
// 1. System Tools
// 2. System Plugins configured in Pro (has associatedPluginId)
else {
return getSystemPluginByIdAndVersionId(pluginId, versionId);
}
})();
const { flowNodeType, nodeIOConfig } = await (async () => {
const { flowNodeType, nodeIOConfig } = await (async (): Promise<{
flowNodeType: FlowNodeTypeEnum;
nodeIOConfig: {
inputs: FlowNodeInputItemType[];
outputs: FlowNodeOutputItemType[];
toolConfig?: NodeToolConfigType;
showSourceHandle?: boolean;
showTargetHandle?: boolean;
};
}> => {
if (source === PluginSourceEnum.systemTool) {
// system Tool or Toolsets
const children = app.isFolder
? (await getSystemTools()).filter((item) => item.parentId === pluginId)
: [];
return {
flowNodeType: FlowNodeTypeEnum.tool,
flowNodeType: app.isFolder ? FlowNodeTypeEnum.toolSet : FlowNodeTypeEnum.tool,
nodeIOConfig: {
inputs: app.inputs || [],
outputs: app.outputs || [],
inputs: [
...(app.inputList
? [
{
key: NodeInputKeyEnum.systemInputConfig,
label: '',
renderTypeList: [FlowNodeInputTypeEnum.hidden],
inputList: app.inputList
}
]
: []),
...(app.inputs ?? [])
],
outputs: app.outputs ?? [],
toolConfig: {
systemTool: {
toolId: app.id
}
}
...(app.isFolder
? {
systemToolSet: {
toolId: app.id,
toolList: children.map((item) => ({
toolId: item.id,
name: parseI18nString(item.name, lang),
description: parseI18nString(item.intro, lang)
}))
}
}
: { systemTool: { toolId: app.id } })
},
showSourceHandle: app.isFolder ? false : true,
showTargetHandle: app.isFolder ? false : true
}
};
}
// Plugin workflow
if (!!app.workflow.nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.pluginInput)) {
// plugin app
return {
flowNodeType: FlowNodeTypeEnum.pluginModule,
nodeIOConfig: pluginData2FlowNodeIO({ nodes: app.workflow.nodes })
@@ -235,6 +327,7 @@ export async function getChildAppPreviewNode({
!!app.workflow.nodes.find((node) => node.flowNodeType === FlowNodeTypeEnum.toolSet) &&
app.workflow.nodes.length === 1
) {
// mcp tools
return {
flowNodeType: FlowNodeTypeEnum.toolSet,
nodeIOConfig: toolSetData2FlowNodeIO({ nodes: app.workflow.nodes })
@@ -294,11 +387,15 @@ export async function getChildAppPreviewNode({
System plugin: plugin id
Personal plugin: Version id
*/
export async function getChildAppRuntimeById(
id: string,
versionId?: string,
lang: localeType = 'en'
): Promise<PluginRuntimeType> {
export async function getChildAppRuntimeById({
id,
versionId,
lang = 'en'
}: {
id: string;
versionId?: string;
lang?: localeType;
}): Promise<PluginRuntimeType> {
const app = await (async () => {
const { source, pluginId } = splitCombinePluginId(id);
@@ -351,6 +448,36 @@ export async function getChildAppRuntimeById(
};
}
export async function getSystemPluginRuntimeNodeById({
pluginId,
name,
intro
}: {
pluginId: string;
name: string;
intro: string;
}): Promise<RuntimeNodeItemType> {
const { source } = splitCombinePluginId(pluginId);
if (source === PluginSourceEnum.systemTool) {
const tool = await getSystemPluginByIdAndVersionId(pluginId);
return {
...tool,
name,
intro,
inputs: tool.inputs ?? [],
outputs: tool.outputs ?? [],
flowNodeType: FlowNodeTypeEnum.tool,
nodeId: getNanoid(),
toolConfig: {
systemTool: {
toolId: pluginId
}
}
};
}
return Promise.reject(PluginErrEnum.unExist);
}
const dbPluginFormat = (item: SystemPluginConfigSchemaType): SystemPluginTemplateItemType => {
const { name, avatar, intro, version, weight, templateType, associatedPluginId, userGuide } =
item.customConfig!;
@@ -405,11 +532,11 @@ export const refetchSystemPlugins = () => {
});
};
export const getSystemPlugins = async (): Promise<SystemPluginTemplateItemType[]> => {
export const getSystemTools = async (): Promise<SystemPluginTemplateItemType[]> => {
if (getCachedSystemPlugins().expires > Date.now() && isProduction) {
return getCachedSystemPlugins().data;
} else {
const tools = await getSystemToolList();
const tools = await APIGetSystemToolList();
// 从数据库里加载插件配置进行替换
const systemPluginsArray = await MongoSystemPlugin.find({}).lean();
@@ -436,34 +563,21 @@ export const getSystemPlugins = async (): Promise<SystemPluginTemplateItemType[]
const dbPluginConfig = systemPlugins.get(item.id);
const versionList = (item.versionList as SystemPluginTemplateItemType['versionList']) || [];
const inputs = versionList[0]?.inputs;
const inputs = versionList[0]?.inputs ?? [];
const outputs = versionList[0]?.outputs ?? [];
return {
isActive: item.isActive,
id: item.id,
parentId: item.parentId,
...item,
isFolder: tools.some((tool) => tool.parentId === item.id),
name: item.name,
avatar: item.avatar,
intro: item.intro,
author: item.author,
courseUrl: item.courseUrl,
showStatus: true,
weight: item.weight,
templateType: item.templateType,
originCost: item.originCost,
currentCost: item.currentCost,
hasTokenFee: item.hasTokenFee,
pluginOrder: item.pluginOrder,
workflow: {
nodes: [],
edges: []
},
versionList,
inputList: inputs?.find((input) => input.key === NodeInputKeyEnum.systemInputConfig)
?.inputList as any,
inputs,
outputs,
inputList: item?.secretInputConfig,
hasSystemSecret: !!dbPluginConfig?.inputListVal
};
});
@@ -484,10 +598,10 @@ export const getSystemPlugins = async (): Promise<SystemPluginTemplateItemType[]
}
};
export const getSystemPluginById = async (id: string): Promise<SystemPluginTemplateItemType> => {
export const getSystemToolById = async (id: string): Promise<SystemPluginTemplateItemType> => {
const { source, pluginId } = splitCombinePluginId(id);
if (source === PluginSourceEnum.systemTool) {
const tools = await getSystemPlugins();
const tools = await getSystemTools();
const tool = tools.find((item) => item.id === pluginId);
if (tool) {
return tool;
+2 -2
View File
@@ -1,9 +1,9 @@
import { type ChatNodeUsageType } from '@fastgpt/global/support/wallet/bill/type';
import { type PluginRuntimeType } from '@fastgpt/global/core/app/plugin/type';
import { splitCombinePluginId } from './controller';
import { PluginSourceEnum } from '@fastgpt/global/core/app/plugin/constants';
import { splitCombinePluginId } from '@fastgpt/global/core/app/plugin/utils';
/*
/*
Plugin points calculation:
1. 系统插件/商业版插件:
- 有错误:返回 0
+5 -12
View File
@@ -1,16 +1,9 @@
import createClient, { RunToolWithStream } from '@fastgpt-sdk/plugin';
import { RunToolWithStream } from '@fastgpt-sdk/plugin';
import { PluginSourceEnum } from '@fastgpt/global/core/app/plugin/constants';
import { pluginClient, BASE_URL, TOKEN } from '../../../thirdProvider/fastgptPlugin';
const BASE_URL = process.env.PLUGIN_BASE_URL || '';
const TOKEN = process.env.PLUGIN_TOKEN || '';
const client = createClient({
baseUrl: BASE_URL,
token: TOKEN
});
export async function getSystemToolList() {
const res = await client.tool.list();
export async function APIGetSystemToolList() {
const res = await pluginClient.tool.list();
if (res.status === 200) {
return res.body.map((item) => {
@@ -33,4 +26,4 @@ const runToolInstance = new RunToolWithStream({
baseUrl: BASE_URL,
token: TOKEN
});
export const runSystemTool = runToolInstance.run.bind(runToolInstance);
export const APIRunSystemTool = runToolInstance.run.bind(runToolInstance);
+11 -4
View File
@@ -3,11 +3,13 @@ import { getEmbeddingModel } from '../ai/model';
import { FlowNodeTypeEnum } from '@fastgpt/global/core/workflow/node/constant';
import { NodeInputKeyEnum } from '@fastgpt/global/core/workflow/constants';
import type { StoreNodeItemType } from '@fastgpt/global/core/workflow/type/node';
import { getChildAppPreviewNode, splitCombinePluginId } from './plugin/controller';
import { getChildAppPreviewNode } from './plugin/controller';
import { PluginSourceEnum } from '@fastgpt/global/core/app/plugin/constants';
import { authAppByTmbId } from '../../support/permission/app/auth';
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
import { getErrText } from '@fastgpt/global/common/error/utils';
import { splitCombinePluginId } from '@fastgpt/global/core/app/plugin/utils';
import type { localeType } from '@fastgpt/global/common/i18n/type';
export async function listAppDatasetDataByTeamIdAndDatasetIds({
teamId,
@@ -33,12 +35,14 @@ export async function rewriteAppWorkflowToDetail({
nodes,
teamId,
isRoot,
ownerTmbId
ownerTmbId,
lang
}: {
nodes: StoreNodeItemType[];
teamId: string;
isRoot: boolean;
ownerTmbId: string;
lang?: localeType;
}) {
const datasetIdSet = new Set<string>();
@@ -51,8 +55,9 @@ export async function rewriteAppWorkflowToDetail({
try {
const [preview] = await Promise.all([
getChildAppPreviewNode({
appId: pluginId,
versionId: node.version
appId: node.pluginId,
versionId: node.version,
lang
}),
...(source === PluginSourceEnum.personal
? [
@@ -80,6 +85,8 @@ export async function rewriteAppWorkflowToDetail({
node.hasTokenFee = preview.hasTokenFee;
node.hasSystemSecret = preview.hasSystemSecret;
node.toolConfig = preview.toolConfig;
// Latest version
if (!node.version) {
const inputsMap = new Map(node.inputs.map((item) => [item.key, item]));