Skip to content

Commit d78a0e9

Browse files
authored
feat: add toolDescription field across various schemas and update related functions (#5452)
1 parent 5cd1c2a commit d78a0e9

File tree

12 files changed

+35
-13
lines changed

12 files changed

+35
-13
lines changed

packages/global/core/workflow/runtime/type.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export type RuntimeNodeItemType = {
101101
name: StoreNodeItemType['name'];
102102
avatar: StoreNodeItemType['avatar'];
103103
intro?: StoreNodeItemType['intro'];
104+
toolDescription?: StoreNodeItemType['toolDescription'];
104105
flowNodeType: StoreNodeItemType['flowNodeType'];
105106
showStatus?: StoreNodeItemType['showStatus'];
106107
isEntry?: boolean;

packages/global/core/workflow/runtime/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ export const storeNodes2RuntimeNodes = (
252252
name: node.name,
253253
avatar: node.avatar,
254254
intro: node.intro,
255+
toolDescription: node.toolDescription,
255256
flowNodeType: node.flowNodeType,
256257
showStatus: node.showStatus,
257258
isEntry: entryNodeIds.includes(node.nodeId),

packages/global/core/workflow/type/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export type WorkflowTemplateType = {
3737
avatar: string;
3838
name: I18nStringType | string;
3939
intro?: I18nStringType | string;
40+
toolDescription?: string;
4041

4142
author?: string;
4243
courseUrl?: string;

packages/global/core/workflow/type/node.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export type FlowNodeCommonType = {
5656
avatar?: string;
5757
name: string;
5858
intro?: string; // template list intro
59+
toolDescription?: string;
5960
showStatus?: boolean; // chatting response step status
6061

6162
version?: string;

packages/service/core/app/plugin/controller.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,11 @@ export async function getChildAppPreviewNode({
314314
}))
315315
}
316316
}
317-
: { systemTool: { toolId: app.id } })
317+
: {
318+
systemTool: {
319+
toolId: app.id
320+
}
321+
})
318322
},
319323
showSourceHandle: app.isFolder ? false : true,
320324
showTargetHandle: app.isFolder ? false : true
@@ -368,6 +372,7 @@ export async function getChildAppPreviewNode({
368372
avatar: app.avatar,
369373
name: parseI18nString(app.name, lang),
370374
intro: parseI18nString(app.intro, lang),
375+
toolDescription: app.toolDescription,
371376
courseUrl: app.courseUrl,
372377
userGuide: app.userGuide,
373378
showStatus: true,
@@ -462,8 +467,17 @@ export async function getChildAppRuntimeById({
462467
}
463468

464469
const dbPluginFormat = (item: SystemPluginConfigSchemaType): SystemPluginTemplateItemType => {
465-
const { name, avatar, intro, version, weight, templateType, associatedPluginId, userGuide } =
466-
item.customConfig!;
470+
const {
471+
name,
472+
avatar,
473+
intro,
474+
toolDescription,
475+
version,
476+
weight,
477+
templateType,
478+
associatedPluginId,
479+
userGuide
480+
} = item.customConfig!;
467481

468482
return {
469483
id: item.pluginId,
@@ -475,6 +489,7 @@ const dbPluginFormat = (item: SystemPluginConfigSchemaType): SystemPluginTemplat
475489
name,
476490
avatar,
477491
intro,
492+
toolDescription,
478493
weight,
479494
templateType,
480495
originCost: item.originCost,
@@ -556,6 +571,7 @@ export const getSystemTools = async (): Promise<SystemPluginTemplateItemType[]>
556571
name: item.name,
557572
avatar: item.avatar,
558573
intro: item.description,
574+
toolDescription: item.toolDescription,
559575
author: item.author,
560576
courseUrl: item.courseUrl,
561577
instructions: dbPluginConfig?.customConfig?.userGuide,

packages/service/core/app/plugin/type.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type SystemPluginConfigSchemaType = {
1717
name: string;
1818
avatar: string;
1919
intro?: string;
20+
toolDescription?: string;
2021
version: string;
2122
weight?: number;
2223
templateType: string;

packages/service/core/workflow/dispatch/ai/agent/functionCall.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export const runToolWithFunctionCall = async (
189189

190190
return {
191191
name: item.nodeId,
192-
description: item.intro,
192+
description: item.toolDescription || item.intro,
193193
parameters: {
194194
type: 'object',
195195
properties,

packages/service/core/workflow/dispatch/ai/agent/promptCall.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export const runToolWithPromptCall = async (
193193

194194
return {
195195
toolId: item.nodeId,
196-
description: item.intro,
196+
description: item.toolDescription || item.intro,
197197
parameters: {
198198
type: 'object',
199199
properties,

packages/service/core/workflow/dispatch/ai/agent/toolChoice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export const runToolWithToolChoice = async (
246246
type: 'function',
247247
function: {
248248
name: item.nodeId,
249-
description: item.intro || item.name,
249+
description: item.toolDescription || item.intro || item.name,
250250
parameters: {
251251
type: 'object',
252252
properties,

packages/service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "1.0.0",
44
"type": "module",
55
"dependencies": {
6-
"@fastgpt-sdk/plugin": "^0.1.8",
6+
"@fastgpt-sdk/plugin": "^0.1.9",
77
"@fastgpt/global": "workspace:*",
88
"@modelcontextprotocol/sdk": "^1.12.1",
99
"@node-rs/jieba": "2.0.1",

0 commit comments

Comments
 (0)