feat: add toolDescription field across various schemas and update related functions (#5452)

This commit is contained in:
Ctrlz
2025-08-15 14:13:14 +08:00
committed by GitHub
parent 5cd1c2af14
commit d78a0e9e4b
12 changed files with 35 additions and 13 deletions

View File

@@ -101,6 +101,7 @@ export type RuntimeNodeItemType = {
name: StoreNodeItemType['name']; name: StoreNodeItemType['name'];
avatar: StoreNodeItemType['avatar']; avatar: StoreNodeItemType['avatar'];
intro?: StoreNodeItemType['intro']; intro?: StoreNodeItemType['intro'];
toolDescription?: StoreNodeItemType['toolDescription'];
flowNodeType: StoreNodeItemType['flowNodeType']; flowNodeType: StoreNodeItemType['flowNodeType'];
showStatus?: StoreNodeItemType['showStatus']; showStatus?: StoreNodeItemType['showStatus'];
isEntry?: boolean; isEntry?: boolean;

View File

@@ -252,6 +252,7 @@ export const storeNodes2RuntimeNodes = (
name: node.name, name: node.name,
avatar: node.avatar, avatar: node.avatar,
intro: node.intro, intro: node.intro,
toolDescription: node.toolDescription,
flowNodeType: node.flowNodeType, flowNodeType: node.flowNodeType,
showStatus: node.showStatus, showStatus: node.showStatus,
isEntry: entryNodeIds.includes(node.nodeId), isEntry: entryNodeIds.includes(node.nodeId),

View File

@@ -37,6 +37,7 @@ export type WorkflowTemplateType = {
avatar: string; avatar: string;
name: I18nStringType | string; name: I18nStringType | string;
intro?: I18nStringType | string; intro?: I18nStringType | string;
toolDescription?: string;
author?: string; author?: string;
courseUrl?: string; courseUrl?: string;

View File

@@ -56,6 +56,7 @@ export type FlowNodeCommonType = {
avatar?: string; avatar?: string;
name: string; name: string;
intro?: string; // template list intro intro?: string; // template list intro
toolDescription?: string;
showStatus?: boolean; // chatting response step status showStatus?: boolean; // chatting response step status
version?: string; version?: string;

View File

@@ -314,7 +314,11 @@ export async function getChildAppPreviewNode({
})) }))
} }
} }
: { systemTool: { toolId: app.id } }) : {
systemTool: {
toolId: app.id
}
})
}, },
showSourceHandle: app.isFolder ? false : true, showSourceHandle: app.isFolder ? false : true,
showTargetHandle: app.isFolder ? false : true showTargetHandle: app.isFolder ? false : true
@@ -368,6 +372,7 @@ export async function getChildAppPreviewNode({
avatar: app.avatar, avatar: app.avatar,
name: parseI18nString(app.name, lang), name: parseI18nString(app.name, lang),
intro: parseI18nString(app.intro, lang), intro: parseI18nString(app.intro, lang),
toolDescription: app.toolDescription,
courseUrl: app.courseUrl, courseUrl: app.courseUrl,
userGuide: app.userGuide, userGuide: app.userGuide,
showStatus: true, showStatus: true,
@@ -462,8 +467,17 @@ export async function getChildAppRuntimeById({
} }
const dbPluginFormat = (item: SystemPluginConfigSchemaType): SystemPluginTemplateItemType => { const dbPluginFormat = (item: SystemPluginConfigSchemaType): SystemPluginTemplateItemType => {
const { name, avatar, intro, version, weight, templateType, associatedPluginId, userGuide } = const {
item.customConfig!; name,
avatar,
intro,
toolDescription,
version,
weight,
templateType,
associatedPluginId,
userGuide
} = item.customConfig!;
return { return {
id: item.pluginId, id: item.pluginId,
@@ -475,6 +489,7 @@ const dbPluginFormat = (item: SystemPluginConfigSchemaType): SystemPluginTemplat
name, name,
avatar, avatar,
intro, intro,
toolDescription,
weight, weight,
templateType, templateType,
originCost: item.originCost, originCost: item.originCost,
@@ -556,6 +571,7 @@ export const getSystemTools = async (): Promise<SystemPluginTemplateItemType[]>
name: item.name, name: item.name,
avatar: item.avatar, avatar: item.avatar,
intro: item.description, intro: item.description,
toolDescription: item.toolDescription,
author: item.author, author: item.author,
courseUrl: item.courseUrl, courseUrl: item.courseUrl,
instructions: dbPluginConfig?.customConfig?.userGuide, instructions: dbPluginConfig?.customConfig?.userGuide,

View File

@@ -17,6 +17,7 @@ export type SystemPluginConfigSchemaType = {
name: string; name: string;
avatar: string; avatar: string;
intro?: string; intro?: string;
toolDescription?: string;
version: string; version: string;
weight?: number; weight?: number;
templateType: string; templateType: string;

View File

@@ -189,7 +189,7 @@ export const runToolWithFunctionCall = async (
return { return {
name: item.nodeId, name: item.nodeId,
description: item.intro, description: item.toolDescription || item.intro,
parameters: { parameters: {
type: 'object', type: 'object',
properties, properties,

View File

@@ -193,7 +193,7 @@ export const runToolWithPromptCall = async (
return { return {
toolId: item.nodeId, toolId: item.nodeId,
description: item.intro, description: item.toolDescription || item.intro,
parameters: { parameters: {
type: 'object', type: 'object',
properties, properties,

View File

@@ -246,7 +246,7 @@ export const runToolWithToolChoice = async (
type: 'function', type: 'function',
function: { function: {
name: item.nodeId, name: item.nodeId,
description: item.intro || item.name, description: item.toolDescription || item.intro || item.name,
parameters: { parameters: {
type: 'object', type: 'object',
properties, properties,

View File

@@ -3,7 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@fastgpt-sdk/plugin": "^0.1.8", "@fastgpt-sdk/plugin": "^0.1.9",
"@fastgpt/global": "workspace:*", "@fastgpt/global": "workspace:*",
"@modelcontextprotocol/sdk": "^1.12.1", "@modelcontextprotocol/sdk": "^1.12.1",
"@node-rs/jieba": "2.0.1", "@node-rs/jieba": "2.0.1",

10
pnpm-lock.yaml generated
View File

@@ -121,8 +121,8 @@ importers:
packages/service: packages/service:
dependencies: dependencies:
'@fastgpt-sdk/plugin': '@fastgpt-sdk/plugin':
specifier: ^0.1.8 specifier: ^0.1.9
version: 0.1.8(@types/node@20.17.24) version: 0.1.9(@types/node@20.17.24)
'@fastgpt/global': '@fastgpt/global':
specifier: workspace:* specifier: workspace:*
version: link:../global version: link:../global
@@ -1973,8 +1973,8 @@ packages:
resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==} resolution: {integrity: sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
'@fastgpt-sdk/plugin@0.1.8': '@fastgpt-sdk/plugin@0.1.9':
resolution: {integrity: sha512-Db4wWJV/NjWcsKXXOUeNRNYeVBmW9yn9IqjYr7Mj+Z77YwN0gUFIek4tv+zQzsr9IoQgq+vptCEf6Ae9d48uaA==} resolution: {integrity: sha512-9OBflL5W9SSEnhlNR/deL7+AMVkj7DKZcHlHELZFCMX+y0dhHmpHIh5bDon3zaeny40K35iI7md6pqDZ5xp5tw==}
'@fastify/accept-negotiator@1.1.0': '@fastify/accept-negotiator@1.1.0':
resolution: {integrity: sha512-OIHZrb2ImZ7XG85HXOONLcJWGosv7sIvM2ifAPQVhg9Lv7qdmMBNVaai4QTdyuaqbKM5eO6sLSQOYI7wEQeCJQ==} resolution: {integrity: sha512-OIHZrb2ImZ7XG85HXOONLcJWGosv7sIvM2ifAPQVhg9Lv7qdmMBNVaai4QTdyuaqbKM5eO6sLSQOYI7wEQeCJQ==}
@@ -11208,7 +11208,7 @@ snapshots:
'@eslint/js@8.57.1': {} '@eslint/js@8.57.1': {}
'@fastgpt-sdk/plugin@0.1.8(@types/node@20.17.24)': '@fastgpt-sdk/plugin@0.1.9(@types/node@20.17.24)':
dependencies: dependencies:
'@fortaine/fetch-event-source': 3.0.6 '@fortaine/fetch-event-source': 3.0.6
'@ts-rest/core': 3.52.1(@types/node@20.17.24)(zod@3.25.51) '@ts-rest/core': 3.52.1(@types/node@20.17.24)(zod@3.25.51)

View File

@@ -36,7 +36,8 @@ async function handler(
flowNodeType: plugin.isFolder ? FlowNodeTypeEnum.toolSet : FlowNodeTypeEnum.tool, flowNodeType: plugin.isFolder ? FlowNodeTypeEnum.toolSet : FlowNodeTypeEnum.tool,
name: parseI18nString(plugin.name, lang), name: parseI18nString(plugin.name, lang),
intro: parseI18nString(plugin.intro ?? '', lang), intro: parseI18nString(plugin.intro ?? '', lang),
instructions: parseI18nString(plugin.userGuide ?? '', lang) instructions: parseI18nString(plugin.userGuide ?? '', lang),
toolDescription: plugin.toolDescription
})) }))
.filter((item) => { .filter((item) => {
if (searchKey) { if (searchKey) {