@baishuyun/agents 0.0.2 → 0.0.4
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.
- package/CHANGELOG.md +25 -13
- package/index.ts +10 -10
- package/package.json +3 -3
- package/src/continue-confirmer/index.ts +41 -41
- package/src/continue-confirmer/prompt.ts +11 -11
- package/src/fields-builder/fields-builder.ts +43 -43
- package/src/fields-builder/index.ts +109 -109
- package/src/form-builder/consts/index.ts +5 -5
- package/src/form-builder/index.ts +24 -24
- package/src/form-builder/model/ds.ts +8 -8
- package/src/form-builder/model/openai.ts +7 -7
- package/src/form-builder/model/v0.ts +7 -7
- package/src/form-builder/model/xai.ts +7 -7
- package/src/form-builder/prompts/fields-design-docs.ts +3 -3
- package/src/form-builder/prompts/index.ts +32 -32
- package/src/form-builder/schema/index.ts +7 -7
- package/src/form-builder/tools/address.ts +58 -58
- package/src/form-builder/tools/attachment.ts +62 -62
- package/src/form-builder/tools/button.ts +73 -73
- package/src/form-builder/tools/checkbox.ts +55 -55
- package/src/form-builder/tools/confirm-to-create-fields-for-related-form.ts +16 -16
- package/src/form-builder/tools/confirm-to-create-form.ts +11 -11
- package/src/form-builder/tools/confirm-to-create-related-form.ts +16 -16
- package/src/form-builder/tools/confirm-to-save-checked-fields.ts +11 -11
- package/src/form-builder/tools/date-time.ts +73 -73
- package/src/form-builder/tools/department-group.ts +49 -49
- package/src/form-builder/tools/department.ts +49 -49
- package/src/form-builder/tools/image.ts +123 -123
- package/src/form-builder/tools/index.ts +27 -27
- package/src/form-builder/tools/input.ts +70 -70
- package/src/form-builder/tools/link-data.ts +70 -70
- package/src/form-builder/tools/load-data.ts +49 -49
- package/src/form-builder/tools/location.ts +94 -94
- package/src/form-builder/tools/member-group.ts +51 -51
- package/src/form-builder/tools/member.ts +51 -51
- package/src/form-builder/tools/number-input.ts +106 -106
- package/src/form-builder/tools/prompt-to-create-realted-form.ts +12 -12
- package/src/form-builder/tools/radio.ts +54 -54
- package/src/form-builder/tools/select-checker.ts +58 -58
- package/src/form-builder/tools/select.ts +56 -56
- package/src/form-builder/tools/serial-number.ts +75 -75
- package/src/form-builder/tools/signature.ts +38 -38
- package/src/form-builder/tools/splitline.ts +41 -41
- package/src/form-builder/tools/textarea.ts +55 -55
- package/src/form-builder/types/index.ts +53 -53
- package/src/form-builder/utils/index.ts +5 -5
- package/src/form-builder/utils/process-confirm-tool-call.ts +123 -123
- package/src/form-designer/index.ts +61 -61
- package/src/form-designer/prompts.ts +50 -50
- package/src/utils/index.ts +104 -104
- package/tsconfig.json +7 -7
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { tool } from 'ai';
|
|
3
|
-
import { buildWidgetName } from '../utils/index.js';
|
|
4
|
-
|
|
5
|
-
export const buildMemberGroupSelectField = tool({
|
|
6
|
-
name: 'buildMemberGroupSelectField',
|
|
7
|
-
description:
|
|
8
|
-
'Build a team member multipyle select field for a form. The field allows users to select multiple members from own orgnization.',
|
|
9
|
-
inputSchema: z.object({
|
|
10
|
-
label: z.string().min(1).max(100),
|
|
11
|
-
placeholder: z.string().min(1).max(100).optional(),
|
|
12
|
-
required: z.boolean().default(false),
|
|
13
|
-
fieldWidth: z.enum(['3', '4', '6', '8', '9', '12']).default('12'),
|
|
14
|
-
description: z.string().min(1).max(100).optional(),
|
|
15
|
-
}),
|
|
16
|
-
execute: (input) => {
|
|
17
|
-
const { label, required, fieldWidth, description } = input;
|
|
18
|
-
return {
|
|
19
|
-
widget: {
|
|
20
|
-
type: 'usergroup',
|
|
21
|
-
widgetName: buildWidgetName(),
|
|
22
|
-
widgetNameAlias: '',
|
|
23
|
-
customCls: null,
|
|
24
|
-
height: '34',
|
|
25
|
-
width: 350,
|
|
26
|
-
enable: true,
|
|
27
|
-
visible: true,
|
|
28
|
-
allowBlank: !required,
|
|
29
|
-
labelStyle: label,
|
|
30
|
-
funMode: 'module',
|
|
31
|
-
module: null,
|
|
32
|
-
libs: [],
|
|
33
|
-
extendSet: {
|
|
34
|
-
sort: ['datahelp', 'module', 'formEvent'],
|
|
35
|
-
status: true,
|
|
36
|
-
triggerField: '',
|
|
37
|
-
triggerFieldMode: 'none',
|
|
38
|
-
version: 1,
|
|
39
|
-
},
|
|
40
|
-
noRepeat: false,
|
|
41
|
-
limit: {},
|
|
42
|
-
limitWidget: null, //可选范围 由部门字段确定,如果有值 是 _widget_1762226067008 这种,另一个部门字段的id。和limit互斥,limit将为[]
|
|
43
|
-
valueOption: 0,
|
|
44
|
-
},
|
|
45
|
-
description,
|
|
46
|
-
label,
|
|
47
|
-
lineWidth: parseInt(fieldWidth),
|
|
48
|
-
tab: null,
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
});
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { buildWidgetName } from '../utils/index.js';
|
|
4
|
+
|
|
5
|
+
export const buildMemberGroupSelectField = tool({
|
|
6
|
+
name: 'buildMemberGroupSelectField',
|
|
7
|
+
description:
|
|
8
|
+
'Build a team member multipyle select field for a form. The field allows users to select multiple members from own orgnization.',
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
label: z.string().min(1).max(100),
|
|
11
|
+
placeholder: z.string().min(1).max(100).optional(),
|
|
12
|
+
required: z.boolean().default(false),
|
|
13
|
+
fieldWidth: z.enum(['3', '4', '6', '8', '9', '12']).default('12'),
|
|
14
|
+
description: z.string().min(1).max(100).optional(),
|
|
15
|
+
}),
|
|
16
|
+
execute: (input) => {
|
|
17
|
+
const { label, required, fieldWidth, description } = input;
|
|
18
|
+
return {
|
|
19
|
+
widget: {
|
|
20
|
+
type: 'usergroup',
|
|
21
|
+
widgetName: buildWidgetName(),
|
|
22
|
+
widgetNameAlias: '',
|
|
23
|
+
customCls: null,
|
|
24
|
+
height: '34',
|
|
25
|
+
width: 350,
|
|
26
|
+
enable: true,
|
|
27
|
+
visible: true,
|
|
28
|
+
allowBlank: !required,
|
|
29
|
+
labelStyle: label,
|
|
30
|
+
funMode: 'module',
|
|
31
|
+
module: null,
|
|
32
|
+
libs: [],
|
|
33
|
+
extendSet: {
|
|
34
|
+
sort: ['datahelp', 'module', 'formEvent'],
|
|
35
|
+
status: true,
|
|
36
|
+
triggerField: '',
|
|
37
|
+
triggerFieldMode: 'none',
|
|
38
|
+
version: 1,
|
|
39
|
+
},
|
|
40
|
+
noRepeat: false,
|
|
41
|
+
limit: {},
|
|
42
|
+
limitWidget: null, //可选范围 由部门字段确定,如果有值 是 _widget_1762226067008 这种,另一个部门字段的id。和limit互斥,limit将为[]
|
|
43
|
+
valueOption: 0,
|
|
44
|
+
},
|
|
45
|
+
description,
|
|
46
|
+
label,
|
|
47
|
+
lineWidth: parseInt(fieldWidth),
|
|
48
|
+
tab: null,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { tool } from 'ai';
|
|
3
|
-
import { buildWidgetName } from '../utils/index.js';
|
|
4
|
-
|
|
5
|
-
export const buildMemberSelectField = tool({
|
|
6
|
-
name: 'buildMemberSelectField',
|
|
7
|
-
description:
|
|
8
|
-
'Build a team member select field for a form. The field allows users to select one members from own orgnization.',
|
|
9
|
-
inputSchema: z.object({
|
|
10
|
-
label: z.string().min(1).max(100),
|
|
11
|
-
placeholder: z.string().min(1).max(100).optional(),
|
|
12
|
-
required: z.boolean().default(false),
|
|
13
|
-
fieldWidth: z.enum(['3', '4', '6', '8', '9', '12']).default('12'),
|
|
14
|
-
description: z.string().min(1).max(100).optional(),
|
|
15
|
-
}),
|
|
16
|
-
execute: (input) => {
|
|
17
|
-
const { label, required, fieldWidth, description } = input;
|
|
18
|
-
return {
|
|
19
|
-
widget: {
|
|
20
|
-
type: 'user',
|
|
21
|
-
widgetName: buildWidgetName(),
|
|
22
|
-
widgetNameAlias: '',
|
|
23
|
-
customCls: null,
|
|
24
|
-
height: '34',
|
|
25
|
-
width: 350,
|
|
26
|
-
enable: true,
|
|
27
|
-
visible: true,
|
|
28
|
-
allowBlank: !required,
|
|
29
|
-
labelStyle: label,
|
|
30
|
-
funMode: 'module',
|
|
31
|
-
module: null,
|
|
32
|
-
libs: [],
|
|
33
|
-
extendSet: {
|
|
34
|
-
sort: ['datahelp', 'module', 'formEvent'],
|
|
35
|
-
status: true,
|
|
36
|
-
triggerField: '',
|
|
37
|
-
triggerFieldMode: 'none',
|
|
38
|
-
version: 1,
|
|
39
|
-
},
|
|
40
|
-
noRepeat: false,
|
|
41
|
-
limit: {},
|
|
42
|
-
limitWidget: null, //可选范围 由部门字段确定,如果有值 是 _widget_1762226067008 这种,另一个部门字段的id。和limit互斥,limit将为[]
|
|
43
|
-
valueOption: 0,
|
|
44
|
-
},
|
|
45
|
-
description,
|
|
46
|
-
label,
|
|
47
|
-
lineWidth: parseInt(fieldWidth),
|
|
48
|
-
tab: null,
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
});
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { tool } from 'ai';
|
|
3
|
+
import { buildWidgetName } from '../utils/index.js';
|
|
4
|
+
|
|
5
|
+
export const buildMemberSelectField = tool({
|
|
6
|
+
name: 'buildMemberSelectField',
|
|
7
|
+
description:
|
|
8
|
+
'Build a team member select field for a form. The field allows users to select one members from own orgnization.',
|
|
9
|
+
inputSchema: z.object({
|
|
10
|
+
label: z.string().min(1).max(100),
|
|
11
|
+
placeholder: z.string().min(1).max(100).optional(),
|
|
12
|
+
required: z.boolean().default(false),
|
|
13
|
+
fieldWidth: z.enum(['3', '4', '6', '8', '9', '12']).default('12'),
|
|
14
|
+
description: z.string().min(1).max(100).optional(),
|
|
15
|
+
}),
|
|
16
|
+
execute: (input) => {
|
|
17
|
+
const { label, required, fieldWidth, description } = input;
|
|
18
|
+
return {
|
|
19
|
+
widget: {
|
|
20
|
+
type: 'user',
|
|
21
|
+
widgetName: buildWidgetName(),
|
|
22
|
+
widgetNameAlias: '',
|
|
23
|
+
customCls: null,
|
|
24
|
+
height: '34',
|
|
25
|
+
width: 350,
|
|
26
|
+
enable: true,
|
|
27
|
+
visible: true,
|
|
28
|
+
allowBlank: !required,
|
|
29
|
+
labelStyle: label,
|
|
30
|
+
funMode: 'module',
|
|
31
|
+
module: null,
|
|
32
|
+
libs: [],
|
|
33
|
+
extendSet: {
|
|
34
|
+
sort: ['datahelp', 'module', 'formEvent'],
|
|
35
|
+
status: true,
|
|
36
|
+
triggerField: '',
|
|
37
|
+
triggerFieldMode: 'none',
|
|
38
|
+
version: 1,
|
|
39
|
+
},
|
|
40
|
+
noRepeat: false,
|
|
41
|
+
limit: {},
|
|
42
|
+
limitWidget: null, //可选范围 由部门字段确定,如果有值 是 _widget_1762226067008 这种,另一个部门字段的id。和limit互斥,limit将为[]
|
|
43
|
+
valueOption: 0,
|
|
44
|
+
},
|
|
45
|
+
description,
|
|
46
|
+
label,
|
|
47
|
+
lineWidth: parseInt(fieldWidth),
|
|
48
|
+
tab: null,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { tool } from "ai";
|
|
3
|
-
import { buildWidgetName } from "../utils/index.js";
|
|
4
|
-
|
|
5
|
-
export const buildNumberInputField = tool({
|
|
6
|
-
name: "buildNumberInputField",
|
|
7
|
-
description: "build a number input field",
|
|
8
|
-
inputSchema: z.object({
|
|
9
|
-
label: z
|
|
10
|
-
.string()
|
|
11
|
-
.min(1)
|
|
12
|
-
.max(100)
|
|
13
|
-
.describe("The label of the number input field"),
|
|
14
|
-
min: z
|
|
15
|
-
.number()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe("The minimum value of the number input field"),
|
|
18
|
-
regex: z
|
|
19
|
-
.string()
|
|
20
|
-
.optional()
|
|
21
|
-
.default("^[-]?[\\d]{0,}[\\.]?[\\d]{0,}$")
|
|
22
|
-
.describe("The regex for validating the number input"),
|
|
23
|
-
placeholder: z.string().min(1).max(100).optional(),
|
|
24
|
-
max: z
|
|
25
|
-
.number()
|
|
26
|
-
.optional()
|
|
27
|
-
.describe("The maximum value of the number input field"),
|
|
28
|
-
required: z
|
|
29
|
-
.boolean()
|
|
30
|
-
.optional()
|
|
31
|
-
.describe("Whether the number input field is required"),
|
|
32
|
-
description: z
|
|
33
|
-
.string()
|
|
34
|
-
.max(500)
|
|
35
|
-
.optional()
|
|
36
|
-
.describe("The description of the number input field"),
|
|
37
|
-
fieldWidth: z
|
|
38
|
-
.enum(["3", "4", "6", "8", "9", "12"])
|
|
39
|
-
.optional()
|
|
40
|
-
.default("12")
|
|
41
|
-
.describe("The width of the number input field in the form layout"),
|
|
42
|
-
}),
|
|
43
|
-
execute: (input) => {
|
|
44
|
-
const {
|
|
45
|
-
label,
|
|
46
|
-
fieldWidth,
|
|
47
|
-
description,
|
|
48
|
-
required,
|
|
49
|
-
regex,
|
|
50
|
-
placeholder,
|
|
51
|
-
max,
|
|
52
|
-
min,
|
|
53
|
-
} = input;
|
|
54
|
-
return {
|
|
55
|
-
widget: {
|
|
56
|
-
type: "number",
|
|
57
|
-
widgetName: buildWidgetName(),
|
|
58
|
-
widgetNameAlias: "",
|
|
59
|
-
triggerEvent: false,
|
|
60
|
-
customCls: null,
|
|
61
|
-
height: 34,
|
|
62
|
-
width: 350,
|
|
63
|
-
enable: true,
|
|
64
|
-
visible: true,
|
|
65
|
-
allowBlank: !required,
|
|
66
|
-
labelStyle: label,
|
|
67
|
-
funMode: "module",
|
|
68
|
-
module: null,
|
|
69
|
-
libs: [],
|
|
70
|
-
extendSet: {
|
|
71
|
-
sort: ["datahelp", "module", "formEvent"],
|
|
72
|
-
status: true,
|
|
73
|
-
triggerField: "",
|
|
74
|
-
triggerFieldMode: "none",
|
|
75
|
-
version: 1,
|
|
76
|
-
},
|
|
77
|
-
regex,
|
|
78
|
-
hint: placeholder,
|
|
79
|
-
noRepeat: false,
|
|
80
|
-
alertinfo: {
|
|
81
|
-
icon: "success",
|
|
82
|
-
tip: "请设置提示内容",
|
|
83
|
-
},
|
|
84
|
-
allowDecimals: true, //允许小数,默认值 true,已废弃
|
|
85
|
-
allowNegative: true, //允许负数,默认值 true ,已废弃
|
|
86
|
-
maxNumber: max, //限定数值范围 最大值
|
|
87
|
-
minNumber: min, //限定数值范围 最小值
|
|
88
|
-
displayMode: "percent", // 新的格式, percent 百分比 number 数值
|
|
89
|
-
precision: null, //保留小数位数
|
|
90
|
-
thousandsSeparator: false, //显示千分符
|
|
91
|
-
notround: true, //不四舍五入
|
|
92
|
-
format: "", //旧的格式,新的由多个属性来控制,前端代码会用其他几个参数拼接出正确的这个值。 其中结尾有% 代表百分比 ,没有%代表数字 ,然后小数点后面的0的个数代表 保留的小数位数,如果小数点后面没有0代表(如0.%),代表没有设置 保留小数位数,保留用户输入的所有小数
|
|
93
|
-
afterSuffix: {
|
|
94
|
-
//单位
|
|
95
|
-
zh_cn: "", //中文的
|
|
96
|
-
en_us: "", //英文的
|
|
97
|
-
zh_tw: "", //繁体的
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
description,
|
|
101
|
-
label,
|
|
102
|
-
lineWidth: parseInt(fieldWidth),
|
|
103
|
-
tab: null,
|
|
104
|
-
};
|
|
105
|
-
},
|
|
106
|
-
});
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tool } from "ai";
|
|
3
|
+
import { buildWidgetName } from "../utils/index.js";
|
|
4
|
+
|
|
5
|
+
export const buildNumberInputField = tool({
|
|
6
|
+
name: "buildNumberInputField",
|
|
7
|
+
description: "build a number input field",
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
label: z
|
|
10
|
+
.string()
|
|
11
|
+
.min(1)
|
|
12
|
+
.max(100)
|
|
13
|
+
.describe("The label of the number input field"),
|
|
14
|
+
min: z
|
|
15
|
+
.number()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("The minimum value of the number input field"),
|
|
18
|
+
regex: z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
21
|
+
.default("^[-]?[\\d]{0,}[\\.]?[\\d]{0,}$")
|
|
22
|
+
.describe("The regex for validating the number input"),
|
|
23
|
+
placeholder: z.string().min(1).max(100).optional(),
|
|
24
|
+
max: z
|
|
25
|
+
.number()
|
|
26
|
+
.optional()
|
|
27
|
+
.describe("The maximum value of the number input field"),
|
|
28
|
+
required: z
|
|
29
|
+
.boolean()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("Whether the number input field is required"),
|
|
32
|
+
description: z
|
|
33
|
+
.string()
|
|
34
|
+
.max(500)
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("The description of the number input field"),
|
|
37
|
+
fieldWidth: z
|
|
38
|
+
.enum(["3", "4", "6", "8", "9", "12"])
|
|
39
|
+
.optional()
|
|
40
|
+
.default("12")
|
|
41
|
+
.describe("The width of the number input field in the form layout"),
|
|
42
|
+
}),
|
|
43
|
+
execute: (input) => {
|
|
44
|
+
const {
|
|
45
|
+
label,
|
|
46
|
+
fieldWidth,
|
|
47
|
+
description,
|
|
48
|
+
required,
|
|
49
|
+
regex,
|
|
50
|
+
placeholder,
|
|
51
|
+
max,
|
|
52
|
+
min,
|
|
53
|
+
} = input;
|
|
54
|
+
return {
|
|
55
|
+
widget: {
|
|
56
|
+
type: "number",
|
|
57
|
+
widgetName: buildWidgetName(),
|
|
58
|
+
widgetNameAlias: "",
|
|
59
|
+
triggerEvent: false,
|
|
60
|
+
customCls: null,
|
|
61
|
+
height: 34,
|
|
62
|
+
width: 350,
|
|
63
|
+
enable: true,
|
|
64
|
+
visible: true,
|
|
65
|
+
allowBlank: !required,
|
|
66
|
+
labelStyle: label,
|
|
67
|
+
funMode: "module",
|
|
68
|
+
module: null,
|
|
69
|
+
libs: [],
|
|
70
|
+
extendSet: {
|
|
71
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
72
|
+
status: true,
|
|
73
|
+
triggerField: "",
|
|
74
|
+
triggerFieldMode: "none",
|
|
75
|
+
version: 1,
|
|
76
|
+
},
|
|
77
|
+
regex,
|
|
78
|
+
hint: placeholder,
|
|
79
|
+
noRepeat: false,
|
|
80
|
+
alertinfo: {
|
|
81
|
+
icon: "success",
|
|
82
|
+
tip: "请设置提示内容",
|
|
83
|
+
},
|
|
84
|
+
allowDecimals: true, //允许小数,默认值 true,已废弃
|
|
85
|
+
allowNegative: true, //允许负数,默认值 true ,已废弃
|
|
86
|
+
maxNumber: max, //限定数值范围 最大值
|
|
87
|
+
minNumber: min, //限定数值范围 最小值
|
|
88
|
+
displayMode: "percent", // 新的格式, percent 百分比 number 数值
|
|
89
|
+
precision: null, //保留小数位数
|
|
90
|
+
thousandsSeparator: false, //显示千分符
|
|
91
|
+
notround: true, //不四舍五入
|
|
92
|
+
format: "", //旧的格式,新的由多个属性来控制,前端代码会用其他几个参数拼接出正确的这个值。 其中结尾有% 代表百分比 ,没有%代表数字 ,然后小数点后面的0的个数代表 保留的小数位数,如果小数点后面没有0代表(如0.%),代表没有设置 保留小数位数,保留用户输入的所有小数
|
|
93
|
+
afterSuffix: {
|
|
94
|
+
//单位
|
|
95
|
+
zh_cn: "", //中文的
|
|
96
|
+
en_us: "", //英文的
|
|
97
|
+
zh_tw: "", //繁体的
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
description,
|
|
101
|
+
label,
|
|
102
|
+
lineWidth: parseInt(fieldWidth),
|
|
103
|
+
tab: null,
|
|
104
|
+
};
|
|
105
|
+
},
|
|
106
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { tool } from "ai";
|
|
3
|
-
|
|
4
|
-
export const promptToCreateRelatedForm = tool({
|
|
5
|
-
name: "promptToCreateRelatedForm",
|
|
6
|
-
description:
|
|
7
|
-
"Determines whether to create a related form based on user input. Returns true if a related form should be created, otherwise false.",
|
|
8
|
-
inputSchema: z.object({
|
|
9
|
-
hasRelatedForm: z.boolean(),
|
|
10
|
-
}),
|
|
11
|
-
outputSchema: z.boolean(),
|
|
12
|
-
});
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tool } from "ai";
|
|
3
|
+
|
|
4
|
+
export const promptToCreateRelatedForm = tool({
|
|
5
|
+
name: "promptToCreateRelatedForm",
|
|
6
|
+
description:
|
|
7
|
+
"Determines whether to create a related form based on user input. Returns true if a related form should be created, otherwise false.",
|
|
8
|
+
inputSchema: z.object({
|
|
9
|
+
hasRelatedForm: z.boolean(),
|
|
10
|
+
}),
|
|
11
|
+
outputSchema: z.boolean(),
|
|
12
|
+
});
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { tool } from "ai";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
export const buildRadioField = tool({
|
|
5
|
-
name: "buildRadioField",
|
|
6
|
-
inputSchema: z.object({
|
|
7
|
-
label: z.string().min(1).max(100),
|
|
8
|
-
fieldWidth: z.enum(["3", "4", "6", "8", "9", "12"]).default("12"),
|
|
9
|
-
description: z.string().min(1).max(100).optional(),
|
|
10
|
-
required: z.boolean().default(false),
|
|
11
|
-
layout: z.enum(["horizontal", "vertical"]).default("horizontal"),
|
|
12
|
-
options: z.array(
|
|
13
|
-
z.object({
|
|
14
|
-
value: z.string().min(1).max(100),
|
|
15
|
-
text: z.string().min(1).max(100),
|
|
16
|
-
color: z.string().min(1).max(7),
|
|
17
|
-
}),
|
|
18
|
-
),
|
|
19
|
-
}),
|
|
20
|
-
execute: (input) => {
|
|
21
|
-
const { label, fieldWidth, description, options, required, layout } = input;
|
|
22
|
-
return {
|
|
23
|
-
widget: {
|
|
24
|
-
type: "radiogroup",
|
|
25
|
-
enable: true,
|
|
26
|
-
visible: true,
|
|
27
|
-
allowBlank: !required,
|
|
28
|
-
funMode: "module",
|
|
29
|
-
module: null,
|
|
30
|
-
libs: [],
|
|
31
|
-
items: options,
|
|
32
|
-
layout,
|
|
33
|
-
stopCancel: false,
|
|
34
|
-
widgetName: `_widget_${Date.now()}`,
|
|
35
|
-
widgetNameAlias: "",
|
|
36
|
-
customCls: null,
|
|
37
|
-
value: null,
|
|
38
|
-
labelStyle: label,
|
|
39
|
-
extendSet: {
|
|
40
|
-
sort: ["datahelp", "module", "formEvent"],
|
|
41
|
-
status: true,
|
|
42
|
-
triggerField: "",
|
|
43
|
-
triggerFieldMode: "none",
|
|
44
|
-
version: 1,
|
|
45
|
-
},
|
|
46
|
-
colorEnable: true, //颜色 是否开启颜色
|
|
47
|
-
},
|
|
48
|
-
description,
|
|
49
|
-
label,
|
|
50
|
-
lineWidth: parseInt(fieldWidth),
|
|
51
|
-
tab: null,
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
});
|
|
1
|
+
import { tool } from "ai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const buildRadioField = tool({
|
|
5
|
+
name: "buildRadioField",
|
|
6
|
+
inputSchema: z.object({
|
|
7
|
+
label: z.string().min(1).max(100),
|
|
8
|
+
fieldWidth: z.enum(["3", "4", "6", "8", "9", "12"]).default("12"),
|
|
9
|
+
description: z.string().min(1).max(100).optional(),
|
|
10
|
+
required: z.boolean().default(false),
|
|
11
|
+
layout: z.enum(["horizontal", "vertical"]).default("horizontal"),
|
|
12
|
+
options: z.array(
|
|
13
|
+
z.object({
|
|
14
|
+
value: z.string().min(1).max(100),
|
|
15
|
+
text: z.string().min(1).max(100),
|
|
16
|
+
color: z.string().min(1).max(7),
|
|
17
|
+
}),
|
|
18
|
+
),
|
|
19
|
+
}),
|
|
20
|
+
execute: (input) => {
|
|
21
|
+
const { label, fieldWidth, description, options, required, layout } = input;
|
|
22
|
+
return {
|
|
23
|
+
widget: {
|
|
24
|
+
type: "radiogroup",
|
|
25
|
+
enable: true,
|
|
26
|
+
visible: true,
|
|
27
|
+
allowBlank: !required,
|
|
28
|
+
funMode: "module",
|
|
29
|
+
module: null,
|
|
30
|
+
libs: [],
|
|
31
|
+
items: options,
|
|
32
|
+
layout,
|
|
33
|
+
stopCancel: false,
|
|
34
|
+
widgetName: `_widget_${Date.now()}`,
|
|
35
|
+
widgetNameAlias: "",
|
|
36
|
+
customCls: null,
|
|
37
|
+
value: null,
|
|
38
|
+
labelStyle: label,
|
|
39
|
+
extendSet: {
|
|
40
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
41
|
+
status: true,
|
|
42
|
+
triggerField: "",
|
|
43
|
+
triggerFieldMode: "none",
|
|
44
|
+
version: 1,
|
|
45
|
+
},
|
|
46
|
+
colorEnable: true, //颜色 是否开启颜色
|
|
47
|
+
},
|
|
48
|
+
description,
|
|
49
|
+
label,
|
|
50
|
+
lineWidth: parseInt(fieldWidth),
|
|
51
|
+
tab: null,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
});
|
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { tool } from "ai";
|
|
3
|
-
import { buildWidgetName } from "../utils/index.js";
|
|
4
|
-
|
|
5
|
-
const select = z.object({
|
|
6
|
-
label: z.string().min(1).max(100),
|
|
7
|
-
required: z.boolean().default(false),
|
|
8
|
-
options: z.array(
|
|
9
|
-
z.object({
|
|
10
|
-
value: z.string().min(1).max(100),
|
|
11
|
-
text: z.string().min(1).max(100),
|
|
12
|
-
}),
|
|
13
|
-
),
|
|
14
|
-
description: z.string().min(1).max(100).optional(),
|
|
15
|
-
fieldWidth: z.enum(["3", "4", "6", "8", "9", "12"]).default("12"),
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export const buildSelectCheckerField = tool({
|
|
19
|
-
name: "buildSelectCheckerField",
|
|
20
|
-
description: "Builds a select checker field",
|
|
21
|
-
inputSchema: select,
|
|
22
|
-
execute: (input) => {
|
|
23
|
-
const { label, required, options, fieldWidth, description } = input;
|
|
24
|
-
return {
|
|
25
|
-
widget: {
|
|
26
|
-
type: "combocheck",
|
|
27
|
-
widgetName: buildWidgetName(),
|
|
28
|
-
widgetNameAlias: "",
|
|
29
|
-
customCls: null,
|
|
30
|
-
height: 34,
|
|
31
|
-
width: 350,
|
|
32
|
-
enable: true,
|
|
33
|
-
visible: true,
|
|
34
|
-
allowBlank: !required,
|
|
35
|
-
labelStyle: label,
|
|
36
|
-
funMode: "module",
|
|
37
|
-
module: null,
|
|
38
|
-
libs: [],
|
|
39
|
-
extendSet: {
|
|
40
|
-
sort: ["datahelp", "module", "formEvent"],
|
|
41
|
-
status: true,
|
|
42
|
-
triggerField: "",
|
|
43
|
-
triggerFieldMode: "none",
|
|
44
|
-
version: 1,
|
|
45
|
-
},
|
|
46
|
-
colorEnable: true, //颜色 是否开启颜色
|
|
47
|
-
mode: "",
|
|
48
|
-
allowAddOptions: false, //允许成员填写时添加新选项
|
|
49
|
-
allowAddLinkData: false,
|
|
50
|
-
items: options,
|
|
51
|
-
},
|
|
52
|
-
description,
|
|
53
|
-
label,
|
|
54
|
-
lineWidth: parseInt(fieldWidth),
|
|
55
|
-
tab: null,
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
});
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { tool } from "ai";
|
|
3
|
+
import { buildWidgetName } from "../utils/index.js";
|
|
4
|
+
|
|
5
|
+
const select = z.object({
|
|
6
|
+
label: z.string().min(1).max(100),
|
|
7
|
+
required: z.boolean().default(false),
|
|
8
|
+
options: z.array(
|
|
9
|
+
z.object({
|
|
10
|
+
value: z.string().min(1).max(100),
|
|
11
|
+
text: z.string().min(1).max(100),
|
|
12
|
+
}),
|
|
13
|
+
),
|
|
14
|
+
description: z.string().min(1).max(100).optional(),
|
|
15
|
+
fieldWidth: z.enum(["3", "4", "6", "8", "9", "12"]).default("12"),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const buildSelectCheckerField = tool({
|
|
19
|
+
name: "buildSelectCheckerField",
|
|
20
|
+
description: "Builds a select checker field",
|
|
21
|
+
inputSchema: select,
|
|
22
|
+
execute: (input) => {
|
|
23
|
+
const { label, required, options, fieldWidth, description } = input;
|
|
24
|
+
return {
|
|
25
|
+
widget: {
|
|
26
|
+
type: "combocheck",
|
|
27
|
+
widgetName: buildWidgetName(),
|
|
28
|
+
widgetNameAlias: "",
|
|
29
|
+
customCls: null,
|
|
30
|
+
height: 34,
|
|
31
|
+
width: 350,
|
|
32
|
+
enable: true,
|
|
33
|
+
visible: true,
|
|
34
|
+
allowBlank: !required,
|
|
35
|
+
labelStyle: label,
|
|
36
|
+
funMode: "module",
|
|
37
|
+
module: null,
|
|
38
|
+
libs: [],
|
|
39
|
+
extendSet: {
|
|
40
|
+
sort: ["datahelp", "module", "formEvent"],
|
|
41
|
+
status: true,
|
|
42
|
+
triggerField: "",
|
|
43
|
+
triggerFieldMode: "none",
|
|
44
|
+
version: 1,
|
|
45
|
+
},
|
|
46
|
+
colorEnable: true, //颜色 是否开启颜色
|
|
47
|
+
mode: "",
|
|
48
|
+
allowAddOptions: false, //允许成员填写时添加新选项
|
|
49
|
+
allowAddLinkData: false,
|
|
50
|
+
items: options,
|
|
51
|
+
},
|
|
52
|
+
description,
|
|
53
|
+
label,
|
|
54
|
+
lineWidth: parseInt(fieldWidth),
|
|
55
|
+
tab: null,
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
});
|