Skip to content

Commit ce169c5

Browse files
committed
npm
1 parent d42eeb6 commit ce169c5

File tree

2 files changed

+25
-33
lines changed

2 files changed

+25
-33
lines changed

modules/tool/type/tool.ts

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,49 +37,41 @@ export const ToolConfigSchema = z
3737
})
3838
.describe('The Tool Config Schema');
3939

40-
export const ToolConfigWithCbSchema = ToolConfigSchema.merge(
41-
z.object({
42-
cb: ToolCallbackType.describe('The callback function of the tool')
43-
})
44-
);
40+
export const ToolConfigWithCbSchema = ToolConfigSchema.extend({
41+
cb: ToolCallbackType.describe('The callback function of the tool')
42+
});
4543

46-
export const ToolSchema = ToolConfigWithCbSchema.merge(
47-
z.object({
48-
// Required
49-
toolId: z.string().describe('The unique id of the tool'),
50-
tags: z.array(ToolTagEnum).optional().describe('The tags of the tool'),
51-
icon: z.string().describe('The icon of the tool'),
44+
export const ToolSchema = ToolConfigWithCbSchema.extend({
45+
// Required
46+
toolId: z.string().describe('The unique id of the tool'),
47+
tags: z.array(ToolTagEnum).optional().describe('The tags of the tool'),
48+
icon: z.string().describe('The icon of the tool'),
5249

53-
// Computed
54-
parentId: z.string().optional().describe('The parent id of the tool'),
55-
toolFilename: z.string(),
50+
// Computed
51+
parentId: z.string().optional().describe('The parent id of the tool'),
52+
toolFilename: z.string(),
5653

57-
// ToolSet Parent
58-
secretInputConfig: z
59-
.array(InputConfigSchema)
60-
.optional()
61-
.describe('The secret input list of the tool')
62-
})
63-
);
54+
// ToolSet Parent
55+
secretInputConfig: z
56+
.array(InputConfigSchema)
57+
.optional()
58+
.describe('The secret input list of the tool')
59+
});
6460

6561
export const ToolSetConfigSchema = ToolConfigSchema.omit({
6662
versionList: true
6763
})
68-
.merge(
69-
z.object({
70-
tags: z.array(ToolTagEnum).describe('The tags of the tool'),
71-
children: z.array(ToolConfigWithCbSchema).optional().describe('The children of the tool set')
72-
})
73-
)
64+
.extend({
65+
tags: z.array(ToolTagEnum).describe('The tags of the tool'),
66+
children: z.array(ToolConfigWithCbSchema).optional().describe('The children of the tool set')
67+
})
7468
.describe('The ToolSet Config Schema');
7569

7670
export const ToolSetSchema = ToolSchema.omit({
7771
cb: true,
7872
parentId: true
7973
})
80-
.merge(
81-
z.object({
82-
children: z.array(ToolSchema).describe('The children of the tool set')
83-
})
84-
)
74+
.extend({
75+
children: z.array(ToolSchema).describe('The children of the tool set')
76+
})
8577
.describe('The ToolSet Schema');

sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@fastgpt-sdk/plugin",
3-
"version": "0.2.2",
3+
"version": "0.2.4",
44
"description": "fastgpt-plugin sdk",
55
"main": "dist/client.js",
66
"types": "dist/client.d.ts",

0 commit comments

Comments
 (0)