@fastgpt-plugin/helpers 0.0.1-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/common/fn.d.ts +18 -0
  2. package/dist/common/fn.js +48 -0
  3. package/dist/common/fs.d.ts +12 -0
  4. package/dist/common/fs.js +24 -0
  5. package/dist/common/schemas/i18n.d.ts +17 -0
  6. package/dist/common/schemas/i18n.js +3 -0
  7. package/dist/common/schemas/s3.d.ts +2 -0
  8. package/dist/common/schemas/s3.js +14 -0
  9. package/dist/common/zip.d.ts +15 -0
  10. package/dist/common/zip.js +4 -0
  11. package/dist/events/index.d.ts +3 -0
  12. package/dist/events/index.js +1 -0
  13. package/dist/events/schemas.d.ts +3 -0
  14. package/dist/events/schemas.js +50 -0
  15. package/dist/events/type.d.ts +3 -0
  16. package/dist/events/type.js +1 -0
  17. package/dist/fastgpt-ATrPZt7b.js +122 -0
  18. package/dist/i18n-CEMsaKK_.js +16 -0
  19. package/dist/index.d.ts +13 -0
  20. package/dist/index.js +13 -0
  21. package/dist/models/schemas.d.ts +234 -0
  22. package/dist/models/schemas.js +74 -0
  23. package/dist/req-Cgf43aEm.js +55 -0
  24. package/dist/s3-CkZHJIa9.d.ts +14 -0
  25. package/dist/schemas-CMeQg8vV.d.ts +137 -0
  26. package/dist/tools/constants.d.ts +75 -0
  27. package/dist/tools/constants.js +72 -0
  28. package/dist/tools/helper.d.ts +260 -0
  29. package/dist/tools/helper.js +55 -0
  30. package/dist/tools/schemas/fastgpt.d.ts +203 -0
  31. package/dist/tools/schemas/fastgpt.js +3 -0
  32. package/dist/tools/schemas/req.d.ts +3 -0
  33. package/dist/tools/schemas/req.js +3 -0
  34. package/dist/tools/schemas/tool.d.ts +2157 -0
  35. package/dist/tools/schemas/tool.js +132 -0
  36. package/dist/workflows/schemas.d.ts +45 -0
  37. package/dist/workflows/schemas.js +26 -0
  38. package/dist/zip-DjBhByRt.js +8857 -0
  39. package/package.json +36 -0
@@ -0,0 +1,132 @@
1
+ import { t as I18nStringSchema } from "../../i18n-CEMsaKK_.js";
2
+ import "../../req-Cgf43aEm.js";
3
+ import { a as OutputSchema, o as SecretInputItemSchema, r as InputSchema } from "../../fastgpt-ATrPZt7b.js";
4
+ import { z as z$1 } from "zod";
5
+
6
+ //#region src/tools/schemas/tool.ts
7
+ const ToolTagEnum = z$1.enum([
8
+ "tools",
9
+ "search",
10
+ "multimodal",
11
+ "communication",
12
+ "finance",
13
+ "design",
14
+ "productivity",
15
+ "news",
16
+ "entertainment",
17
+ "social",
18
+ "scientific",
19
+ "other"
20
+ ]);
21
+ const VersionListItemSchema = z$1.object({
22
+ value: z$1.string(),
23
+ description: z$1.string().optional(),
24
+ inputs: z$1.array(InputSchema),
25
+ outputs: z$1.array(OutputSchema)
26
+ });
27
+ /**
28
+ * 工具的所有属性
29
+ */
30
+ const ToolSchema = z$1.object({
31
+ toolId: z$1.string(),
32
+ parentId: z$1.string().optional(),
33
+ name: I18nStringSchema,
34
+ description: I18nStringSchema,
35
+ toolDescription: z$1.string(),
36
+ versionList: z$1.array(VersionListItemSchema).optional(),
37
+ tags: z$1.array(ToolTagEnum).optional(),
38
+ icon: z$1.string(),
39
+ author: z$1.string().optional(),
40
+ tutorialUrl: z$1.url().optional(),
41
+ readmeUrl: z$1.url().optional(),
42
+ secretInputConfig: z$1.array(SecretInputItemSchema).optional(),
43
+ filename: z$1.string(),
44
+ etag: z$1.string().nonempty().optional()
45
+ });
46
+ /**
47
+ * 工具集的所有属性
48
+ */
49
+ const ToolSetSchema = z$1.object({
50
+ ...ToolSchema.omit({
51
+ parentId: true,
52
+ versionList: true
53
+ }).shape,
54
+ toolId: z$1.string().refine((data) => !data.includes("/")),
55
+ children: z$1.array(ToolSchema).min(1)
56
+ });
57
+ const UnifiedToolSchema = z$1.object({
58
+ ...ToolSchema.shape,
59
+ ...ToolSetSchema.shape
60
+ });
61
+ /**
62
+ * 构建产物中的 Tool 的类型
63
+ */
64
+ const ToolDistSchema = z$1.object({
65
+ ...ToolSetSchema.omit({ readmeUrl: true }).shape,
66
+ icon: z$1.string().optional(),
67
+ versionList: z$1.array(VersionListItemSchema).optional(),
68
+ children: z$1.array(z$1.object({
69
+ ...ToolSchema.omit({
70
+ parentId: true,
71
+ readmeUrl: true
72
+ }).shape,
73
+ icon: z$1.string().optional()
74
+ })).optional()
75
+ });
76
+ /**
77
+ * 工具配置
78
+ * defineTool 函数的参数, 继承自 ToolSchema, 部分参数会自动处理,因此是 optional
79
+ */
80
+ const ToolConfigSchema = z$1.object({
81
+ ...ToolSchema.omit({
82
+ filename: true,
83
+ readmeUrl: true
84
+ }).shape,
85
+ toolId: z$1.string().optional(),
86
+ toolDescription: z$1.string().optional(),
87
+ versionList: z$1.array(VersionListItemSchema).min(1),
88
+ tags: z$1.array(ToolTagEnum).optional(),
89
+ icon: z$1.string().optional(),
90
+ author: z$1.string().optional(),
91
+ tutorialLink: z$1.url().optional(),
92
+ secretInputConfig: z$1.array(SecretInputItemSchema).optional()
93
+ }).transform((data) => {
94
+ return {
95
+ ...data,
96
+ toolDescription: data.toolDescription ?? data.description
97
+ };
98
+ });
99
+ /**
100
+ * 工具集配置
101
+ */
102
+ const ToolSetConfigSchema = ToolSetSchema.extend({
103
+ toolId: z$1.string().optional(),
104
+ toolDescription: z$1.string().optional(),
105
+ tags: z$1.array(ToolTagEnum).optional(),
106
+ icon: z$1.string().optional(),
107
+ author: z$1.string().optional(),
108
+ tutorialLink: z$1.url().optional(),
109
+ secretInputConfig: z$1.array(SecretInputItemSchema).optional()
110
+ });
111
+ const ToolDetailSchema = UnifiedToolSchema.pick({
112
+ toolId: true,
113
+ name: true,
114
+ description: true,
115
+ toolDescription: true,
116
+ author: true,
117
+ tags: true,
118
+ icon: true,
119
+ tutorialUrl: true,
120
+ readmeUrl: true,
121
+ secretInputConfig: true,
122
+ etag: true,
123
+ versionList: true
124
+ });
125
+ const ToolSimpleSchema = ToolDetailSchema.omit({
126
+ secretInputConfig: true,
127
+ toolDescription: true,
128
+ versionList: true
129
+ });
130
+
131
+ //#endregion
132
+ export { ToolConfigSchema, ToolDetailSchema, ToolDistSchema, ToolSchema, ToolSetConfigSchema, ToolSetSchema, ToolSimpleSchema, ToolTagEnum, UnifiedToolSchema, VersionListItemSchema };
@@ -0,0 +1,45 @@
1
+ import { z as z$1 } from "zod";
2
+
3
+ //#region src/workflows/schemas.d.ts
4
+ declare const TemplateItemSchema: z$1.ZodObject<{
5
+ templateId: z$1.ZodString;
6
+ name: z$1.ZodString;
7
+ intro: z$1.ZodString;
8
+ avatar: z$1.ZodString;
9
+ tags: z$1.ZodArray<z$1.ZodString>;
10
+ type: z$1.ZodString;
11
+ author: z$1.ZodOptional<z$1.ZodString>;
12
+ isActive: z$1.ZodOptional<z$1.ZodBoolean>;
13
+ userGuide: z$1.ZodOptional<z$1.ZodString>;
14
+ isQuickTemplate: z$1.ZodOptional<z$1.ZodBoolean>;
15
+ order: z$1.ZodOptional<z$1.ZodNumber>;
16
+ weight: z$1.ZodOptional<z$1.ZodNumber>;
17
+ workflow: z$1.ZodObject<{
18
+ nodes: z$1.ZodArray<z$1.ZodAny>;
19
+ edges: z$1.ZodArray<z$1.ZodAny>;
20
+ chatConfig: z$1.ZodOptional<z$1.ZodAny>;
21
+ }, z$1.core.$strip>;
22
+ }, z$1.core.$strip>;
23
+ declare const TemplateListSchema: z$1.ZodArray<z$1.ZodObject<{
24
+ templateId: z$1.ZodString;
25
+ name: z$1.ZodString;
26
+ intro: z$1.ZodString;
27
+ avatar: z$1.ZodString;
28
+ tags: z$1.ZodArray<z$1.ZodString>;
29
+ type: z$1.ZodString;
30
+ author: z$1.ZodOptional<z$1.ZodString>;
31
+ isActive: z$1.ZodOptional<z$1.ZodBoolean>;
32
+ userGuide: z$1.ZodOptional<z$1.ZodString>;
33
+ isQuickTemplate: z$1.ZodOptional<z$1.ZodBoolean>;
34
+ order: z$1.ZodOptional<z$1.ZodNumber>;
35
+ weight: z$1.ZodOptional<z$1.ZodNumber>;
36
+ workflow: z$1.ZodObject<{
37
+ nodes: z$1.ZodArray<z$1.ZodAny>;
38
+ edges: z$1.ZodArray<z$1.ZodAny>;
39
+ chatConfig: z$1.ZodOptional<z$1.ZodAny>;
40
+ }, z$1.core.$strip>;
41
+ }, z$1.core.$strip>>;
42
+ type TemplateItemType = z$1.infer<typeof TemplateItemSchema>;
43
+ type TemplateListType = z$1.infer<typeof TemplateListSchema>;
44
+ //#endregion
45
+ export { TemplateItemSchema, TemplateItemType, TemplateListSchema, TemplateListType };
@@ -0,0 +1,26 @@
1
+ import { z as z$1 } from "zod";
2
+
3
+ //#region src/workflows/schemas.ts
4
+ const TemplateItemSchema = z$1.object({
5
+ templateId: z$1.string().describe("The unique id of the template"),
6
+ name: z$1.string().describe("The name of the template"),
7
+ intro: z$1.string().describe("The introduction of the template"),
8
+ avatar: z$1.string().describe("The icon of the template"),
9
+ tags: z$1.array(z$1.string()).describe("The tags of the template"),
10
+ type: z$1.string().describe("The type of the template"),
11
+ author: z$1.string().optional().describe("The author of the template"),
12
+ isActive: z$1.boolean().optional().describe("Whether it is active"),
13
+ userGuide: z$1.string().optional().describe("The user guide of the template"),
14
+ isQuickTemplate: z$1.boolean().optional().describe("Whether it is a quick template"),
15
+ order: z$1.number().optional().describe("The order of the template"),
16
+ weight: z$1.number().optional().describe("The weight of the template"),
17
+ workflow: z$1.object({
18
+ nodes: z$1.array(z$1.any()).describe("The nodes of the template"),
19
+ edges: z$1.array(z$1.any()).describe("The edges of the template"),
20
+ chatConfig: z$1.any().optional().describe("The chat config of the template")
21
+ })
22
+ });
23
+ const TemplateListSchema = z$1.array(TemplateItemSchema);
24
+
25
+ //#endregion
26
+ export { TemplateItemSchema, TemplateListSchema };