From 909bb771f420c9aa6b05a54c0fe184115662032b Mon Sep 17 00:00:00 2001 From: Huarch Date: Tue, 14 Jul 2026 11:01:07 +0800 Subject: [PATCH] fix(ui): restrict chart types --- .opencode/tools/show_chart.ts | 2 +- src/uiEnvelope/fromToolCall.ts | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.opencode/tools/show_chart.ts b/.opencode/tools/show_chart.ts index e133305..f514bd8 100644 --- a/.opencode/tools/show_chart.ts +++ b/.opencode/tools/show_chart.ts @@ -9,7 +9,7 @@ export default tool({ .describe("Why this chart should be rendered for the user request."), title: tool.schema.string().optional().describe("Chart title."), chart_type: tool.schema - .enum(["line", "bar", "pie"]) + .enum(["line", "bar"]) .optional() .describe("Chart type."), x_data: tool.schema diff --git a/src/uiEnvelope/fromToolCall.ts b/src/uiEnvelope/fromToolCall.ts index 02366d8..0448309 100644 --- a/src/uiEnvelope/fromToolCall.ts +++ b/src/uiEnvelope/fromToolCall.ts @@ -42,10 +42,7 @@ export const toUiEnvelopeFromToolCall = ({ if (xData.length === 0 || series.length === 0) { return null; } - const chartType = - params.chart_type === "bar" || params.chart_type === "pie" - ? params.chart_type - : "line"; + const chartType = params.chart_type === "bar" ? "bar" : "line"; return { kind: "chart", schemaVersion: "agent-ui@1",