README.md 821 B

chart-gpt

提取词:

The following are the possible chart types supported by the code provided: area, bar, line, composed, scatter, pie, radar, radialBar, treemap, and funnel. Given the user input: ${inputData}, identify the chart type the user wants to display. Return just one word

原理解析

如用户输入: show me the data as a bar chart, Monday - 15 people, Tuesday -3,Wednesday -45, Thursday -124,Friday -2

1、调用 openai 接口提取用户需要做的图表类型: bar 条形图

2、调用 openai 接口生成json格式数组数据

3、使用 react-chart 对生成的json作图

总结,openai做了一个提取信息的任务,根据描述生成json数据两个任务。

优化

1、可以做成一个下拉框,免去第一步接口调用。

2、中文支持