Skip to content

Commit fd2a661

Browse files
authored
refactor: move texture into style (#154)
* refactor: move texture into style * chore: optimize generate_bar_chart tool prompt * chore: opt tool prompt * chore: update
1 parent c0a29e5 commit fd2a661

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+550
-218
lines changed

__tests__/charts/area.json

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,35 @@
2424
"default": false,
2525
"description": "Whether stacking is enabled. When enabled, area charts require a 'group' field in the data."
2626
},
27+
"style": {
28+
"description": "Custom style configuration for the chart.",
29+
"properties": {
30+
"backgroundColor": {
31+
"description": "Background color of the chart, such as, '#fff'.",
32+
"type": "string"
33+
},
34+
"palette": {
35+
"description": "Color palette for the chart, it is a collection of colors.",
36+
"items": {
37+
"type": "string"
38+
},
39+
"type": "array"
40+
},
41+
"texture": {
42+
"default": "default",
43+
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
44+
"enum": ["default", "rough"],
45+
"type": "string"
46+
}
47+
},
48+
"type": "object"
49+
},
2750
"theme": {
2851
"default": "default",
2952
"description": "Set the theme for the chart, optional, default is 'default'.",
3053
"enum": ["default", "academy"],
3154
"type": "string"
3255
},
33-
"texture": {
34-
"default": "default",
35-
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
36-
"enum": ["default", "rough"],
37-
"type": "string"
38-
},
3956
"width": {
4057
"type": "number",
4158
"description": "Set the width of chart, default is 600.",

__tests__/charts/bar.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "generate_bar_chart",
3-
"description": "Generate a bar chart to show data for numerical comparisons among different categories, such as, comparing categorical data and for horizontal comparisons.",
3+
"description": "Generate a horizontal bar chart to show data for numerical comparisons among different categories, such as, comparing categorical data and for horizontal comparisons.",
44
"inputSchema": {
55
"$schema": "http://json-schema.org/draft-07/schema#",
66
"type": "object",
@@ -17,7 +17,7 @@
1717
},
1818
"required": ["category", "value"]
1919
},
20-
"description": "Data for bar chart, such as, [{ category: '分类一', value: 10 }, { category: '分类二', value: 20 }]."
20+
"description": "Data for bar chart, such as, [{ category: '分类一', value: 10 }, { category: '分类二', value: 20 }], when grouping or stacking is needed for bar, the data should contain a `group` field, such as, when [{ category: '北京', value: 825, group: '油车' }, { category: '北京', value: 1000, group: '电车' }]."
2121
},
2222
"group": {
2323
"type": "boolean",
@@ -42,6 +42,12 @@
4242
"type": "string"
4343
},
4444
"type": "array"
45+
},
46+
"texture": {
47+
"default": "default",
48+
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
49+
"enum": ["default", "rough"],
50+
"type": "string"
4551
}
4652
},
4753
"type": "object"
@@ -52,12 +58,6 @@
5258
"enum": ["default", "academy"],
5359
"type": "string"
5460
},
55-
"texture": {
56-
"default": "default",
57-
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
58-
"enum": ["default", "rough"],
59-
"type": "string"
60-
},
6161
"width": {
6262
"type": "number",
6363
"description": "Set the width of chart, default is 600.",

__tests__/charts/boxplot.json

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,35 @@
2727
"minItems": 1,
2828
"description": "Data for boxplot chart, such as, [{ category: '分类一', value: 10 }] or [{ category: '分类二', value: 20, group: '组别一' }]."
2929
},
30+
"style": {
31+
"description": "Custom style configuration for the chart.",
32+
"properties": {
33+
"backgroundColor": {
34+
"description": "Background color of the chart, such as, '#fff'.",
35+
"type": "string"
36+
},
37+
"palette": {
38+
"description": "Color palette for the chart, it is a collection of colors.",
39+
"items": {
40+
"type": "string"
41+
},
42+
"type": "array"
43+
},
44+
"texture": {
45+
"default": "default",
46+
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
47+
"enum": ["default", "rough"],
48+
"type": "string"
49+
}
50+
},
51+
"type": "object"
52+
},
3053
"theme": {
3154
"type": "string",
3255
"enum": ["default", "academy"],
3356
"default": "default",
3457
"description": "Set the theme for the chart, optional, default is 'default'."
3558
},
36-
"texture": {
37-
"default": "default",
38-
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
39-
"enum": ["default", "rough"],
40-
"type": "string"
41-
},
4259
"width": {
4360
"type": "number",
4461
"default": 600,

__tests__/charts/column.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"required": ["category", "value"]
1919
},
20-
"description": "Data for column chart, such as, [{ category: '北京', value: 825, group: '油车' }, { category: '北京', value: 1000, group: '电车' }]."
20+
"description": "Data for column chart, such as, [{ category: '分类一', value: 10 }, { category: '分类二', value: 20 }], when grouping or stacking is needed for column, the data should contain a `group` field, such as, when [{ category: '北京', value: 825, group: '油车' }, { category: '北京', value: 1000, group: '电车' }]."
2121
},
2222
"group": {
2323
"type": "boolean",
@@ -42,6 +42,12 @@
4242
"type": "string"
4343
},
4444
"type": "array"
45+
},
46+
"texture": {
47+
"default": "default",
48+
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
49+
"enum": ["default", "rough"],
50+
"type": "string"
4551
}
4652
},
4753
"type": "object"
@@ -52,12 +58,6 @@
5258
"enum": ["default", "academy"],
5359
"type": "string"
5460
},
55-
"texture": {
56-
"default": "default",
57-
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
58-
"enum": ["default", "rough"],
59-
"type": "string"
60-
},
6161
"width": {
6262
"type": "number",
6363
"description": "Set the width of chart, default is 600.",

__tests__/charts/dual-axes.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
"type": "string"
2525
},
2626
"type": "array"
27+
},
28+
"texture": {
29+
"default": "default",
30+
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
31+
"enum": ["default", "rough"],
32+
"type": "string"
2733
}
2834
},
2935
"type": "object"
3036
},
31-
"texture": {
32-
"default": "default",
33-
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
34-
"enum": ["default", "rough"],
35-
"type": "string"
36-
},
3737
"width": {
3838
"type": "number",
3939
"description": "Set the width of chart, default is 600.",

__tests__/charts/fishbone-diagram.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,24 @@
2929
"required": ["name"],
3030
"description": "Data for fishbone diagram chart, such as, { name: 'main topic', children: [{ name: 'topic 1', children: [{ name: 'subtopic 1-1' }] }."
3131
},
32+
"style": {
33+
"description": "Custom style configuration for the chart.",
34+
"properties": {
35+
"texture": {
36+
"default": "default",
37+
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
38+
"enum": ["default", "rough"],
39+
"type": "string"
40+
}
41+
},
42+
"type": "object"
43+
},
3244
"theme": {
3345
"default": "default",
3446
"description": "Set the theme for the chart, optional, default is 'default'.",
3547
"enum": ["default", "academy"],
3648
"type": "string"
3749
},
38-
"texture": {
39-
"default": "default",
40-
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
41-
"enum": ["default", "rough"],
42-
"type": "string"
43-
},
4450
"width": {
4551
"type": "number",
4652
"description": "Set the width of chart, default is 600.",

__tests__/charts/flow-diagram.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,17 @@
4141
"enum": ["default", "academy"],
4242
"type": "string"
4343
},
44-
"texture": {
45-
"default": "default",
46-
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
47-
"enum": ["default", "rough"],
48-
"type": "string"
44+
"style": {
45+
"description": "Custom style configuration for the chart.",
46+
"properties": {
47+
"texture": {
48+
"default": "default",
49+
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
50+
"enum": ["default", "rough"],
51+
"type": "string"
52+
}
53+
},
54+
"type": "object"
4955
},
5056
"width": {
5157
"type": "number",

__tests__/charts/funnel.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,28 @@
3232
"enum": ["default", "academy"],
3333
"type": "string"
3434
},
35-
"texture": {
36-
"default": "default",
37-
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
38-
"enum": ["default", "rough"],
39-
"type": "string"
35+
"style": {
36+
"description": "Custom style configuration for the chart.",
37+
"properties": {
38+
"backgroundColor": {
39+
"description": "Background color of the chart, such as, '#fff'.",
40+
"type": "string"
41+
},
42+
"palette": {
43+
"description": "Color palette for the chart, it is a collection of colors.",
44+
"items": {
45+
"type": "string"
46+
},
47+
"type": "array"
48+
},
49+
"texture": {
50+
"default": "default",
51+
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
52+
"enum": ["default", "rough"],
53+
"type": "string"
54+
}
55+
},
56+
"type": "object"
4057
},
4158
"title": {
4259
"default": "",

__tests__/charts/histogram.json

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"items": {
1212
"type": "number"
1313
},
14-
"description": "Data for histogram chart, such as, [78, 88, 60, 100, 95]."
14+
"description": "Data for histogram chart, it should be an array of numbers, such as, [78, 88, 60, 100, 95]."
1515
},
1616
"binNumber": {
1717
"anyOf": [
@@ -26,19 +26,36 @@
2626
}
2727
],
2828
"default": null,
29-
"description": "Number of intervals to define the number of intervals in a histogram."
29+
"description": "Number of intervals to define the number of intervals in a histogram, when not specified, a default value will be used."
3030
},
3131
"theme": {
3232
"default": "default",
3333
"description": "Set the theme for the chart, optional, default is 'default'.",
3434
"enum": ["default", "academy"],
3535
"type": "string"
3636
},
37-
"texture": {
38-
"default": "default",
39-
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
40-
"enum": ["default", "rough"],
41-
"type": "string"
37+
"style": {
38+
"description": "Custom style configuration for the chart.",
39+
"properties": {
40+
"backgroundColor": {
41+
"description": "Background color of the chart, such as, '#fff'.",
42+
"type": "string"
43+
},
44+
"palette": {
45+
"description": "Color palette for the chart, it is a collection of colors.",
46+
"items": {
47+
"type": "string"
48+
},
49+
"type": "array"
50+
},
51+
"texture": {
52+
"default": "default",
53+
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
54+
"enum": ["default", "rough"],
55+
"type": "string"
56+
}
57+
},
58+
"type": "object"
4259
},
4360
"width": {
4461
"type": "number",

__tests__/charts/line.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,26 @@
1616
},
1717
"required": ["time", "value"]
1818
},
19-
"description": "Data for line chart, such as, [{ time: '2015', value: 23 }, { time: '2016', value: 32 }]."
19+
"description": "Data for line chart, it should be an array of objects, each object contains a `time` field and a `value` field, such as, [{ time: '2015', value: 23 }, { time: '2016', value: 32 }]."
2020
},
2121
"stack": {
2222
"type": "boolean",
2323
"default": false,
2424
"description": "Whether stacking is enabled. When enabled, line charts require a 'group' field in the data."
2525
},
26+
"theme": {
27+
"default": "default",
28+
"description": "Set the theme for the chart, optional, default is 'default'.",
29+
"enum": ["default", "academy"],
30+
"type": "string"
31+
},
2632
"style": {
2733
"description": "Custom style configuration for the chart.",
2834
"properties": {
35+
"lineWidth": {
36+
"description": "Line width for the lines of chart, such as 4.",
37+
"type": "number"
38+
},
2939
"backgroundColor": {
3040
"description": "Background color of the chart, such as, '#fff'.",
3141
"type": "string"
@@ -37,25 +47,15 @@
3747
},
3848
"type": "array"
3949
},
40-
"lineWidth": {
41-
"description": "Line width for the lines of chart, such as 4.",
42-
"type": "number"
50+
"texture": {
51+
"default": "default",
52+
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
53+
"enum": ["default", "rough"],
54+
"type": "string"
4355
}
4456
},
4557
"type": "object"
4658
},
47-
"theme": {
48-
"default": "default",
49-
"description": "Set the theme for the chart, optional, default is 'default'.",
50-
"enum": ["default", "academy"],
51-
"type": "string"
52-
},
53-
"texture": {
54-
"default": "default",
55-
"description": "Set the texture for the chart, optional, default is 'default'. 'rough' refers to hand-drawn style.",
56-
"enum": ["default", "rough"],
57-
"type": "string"
58-
},
5959
"width": {
6060
"type": "number",
6161
"description": "Set the width of chart, default is 600.",

0 commit comments

Comments
 (0)