fix(tools): clarify chart data format
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
import { tool } from "@opencode-ai/plugin";
|
import { tool } from "@opencode-ai/plugin";
|
||||||
|
|
||||||
export default tool({
|
export default tool({
|
||||||
description: "在前端对话界面中渲染图表。",
|
description:
|
||||||
|
"在前端对话界面中渲染图表。折线图/柱状图必须使用 x_data 作为横轴标签,series[].data 作为同长度的一维数值数组,不要把折线数据写成 ECharts 的 [x, y] 二维点数组。",
|
||||||
args: {
|
args: {
|
||||||
reason: tool.schema
|
reason: tool.schema
|
||||||
.string()
|
.string()
|
||||||
@@ -11,12 +12,16 @@ export default tool({
|
|||||||
.enum(["line", "bar", "pie"])
|
.enum(["line", "bar", "pie"])
|
||||||
.optional()
|
.optional()
|
||||||
.describe("Chart type."),
|
.describe("Chart type."),
|
||||||
x_data: tool.schema.array(tool.schema.string()).describe("X-axis labels."),
|
x_data: tool.schema
|
||||||
|
.array(tool.schema.string())
|
||||||
|
.describe("X-axis labels. For line charts, put time/category labels here."),
|
||||||
series: tool.schema
|
series: tool.schema
|
||||||
.array(
|
.array(
|
||||||
tool.schema.object({
|
tool.schema.object({
|
||||||
name: tool.schema.string(),
|
name: tool.schema.string(),
|
||||||
data: tool.schema.array(tool.schema.number()),
|
data: tool.schema
|
||||||
|
.array(tool.schema.number())
|
||||||
|
.describe("Y values only. Must align by index with x_data."),
|
||||||
type: tool.schema.enum(["line", "bar"]).optional(),
|
type: tool.schema.enum(["line", "bar"]).optional(),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user