From e4d508b34dfc92d20e75751f5209f47404ada408 Mon Sep 17 00:00:00 2001 From: da730 Date: Tue, 30 Jan 2024 03:36:21 +0000 Subject: [PATCH 1/7] build: prelease version 1.2.1 --- common/config/rush/version-policies.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index e5dd1370..8c35428d 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -2,7 +2,7 @@ { "definitionName": "lockStepVersion", "policyName": "vmindMin", - "version": "1.2.1", + "version": "1.2.2", "mainProject": "@visactor/vmind", "nextBump": "patch" } From 145323639babcf2e031461a62bf1b1b813ee5225 Mon Sep 17 00:00:00 2001 From: da730 Date: Tue, 30 Jan 2024 14:17:28 +0800 Subject: [PATCH 2/7] feat: update readme --- packages/vmind/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vmind/README.md b/packages/vmind/README.md index dc5c05ab..bbe26798 100644 --- a/packages/vmind/README.md +++ b/packages/vmind/README.md @@ -213,3 +213,4 @@ Under development, stay tuned #### Pie chart ![Alt text](https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/VChart-Video-3.gif) + From e300f5941d0201e8a64bcbe28a944c72d5f84c2a Mon Sep 17 00:00:00 2001 From: da730 Date: Tue, 30 Jan 2024 14:32:05 +0800 Subject: [PATCH 3/7] feat: update version policies --- common/config/rush/version-policies.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 8c35428d..dd841c02 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -2,8 +2,8 @@ { "definitionName": "lockStepVersion", "policyName": "vmindMin", - "version": "1.2.2", + "version": "1.2.1", "mainProject": "@visactor/vmind", - "nextBump": "patch" + "nextBump": "minor" } ] From 81577a82abc441551beaf750d8222180780f2005 Mon Sep 17 00:00:00 2001 From: da730 Date: Tue, 30 Jan 2024 15:06:57 +0800 Subject: [PATCH 4/7] feat: update readme --- packages/vmind/README.md | 35 +++++++++++++++++++++++++++++--- packages/vmind/package.json | 21 +++++++++++++++++++ packages/vmind/readme-zh.md | 33 +++++++++++++++++++++++++++--- packages/vmind/src/core/VMind.ts | 1 + 4 files changed, 84 insertions(+), 6 deletions(-) diff --git a/packages/vmind/README.md b/packages/vmind/README.md index bbe26798..361459cf 100644 --- a/packages/vmind/README.md +++ b/packages/vmind/README.md @@ -138,7 +138,7 @@ We want to show "the changes in sales rankings of various car brands". Call the ```typescript const describe = 'show me the changes in sales rankings of various car brand'; //Call the chart generation interface to get spec and chart animation duration -const { spec, time } = await vmind.generateChart(userInput, fieldInfo, dataset); +const { spec, time } = await vmind.generateChart(describe, fieldInfo, dataset); ``` In this way, we get the VChart spec of the corresponding dynamic chart. We can render the chart based on this spec: @@ -164,7 +164,7 @@ Users can specify different theme styles (currently only gpt chart generation su //describe can be in both Chinese and English //Specify to generate a tech-style chart const describe = 'show me the changes in sales rankings of various car brand,tech style'; -const { spec, time } = await vmind.generateChart(userInput, fieldInfo, dataset); +const { spec, time } = await vmind.generateChart(describe, fieldInfo, dataset); ``` You can also specify the chart type, field mapping, etc. supported by VMind. For example: @@ -173,7 +173,7 @@ You can also specify the chart type, field mapping, etc. supported by VMind. For //Specify to generate a line chart, with car manufacturers as the x-axis const describe = 'show me the changes in sales rankings of various car brands,tech style.Using a line chart, Manufacturer makes the x-axis'; -const { spec, time } = await(vmind.generateChart(csvData, describe)); +const { spec, time } = await(vmind.generateChart(csvData, describe, dataset)); ``` #### Customizing LLM Request Method @@ -196,6 +196,35 @@ temperature?: number;//recommended to set to 0 Specify your LLM service url in url (default is https://api.openai.com/v1/chat/completions) In subsequent calls, VMind will use the parameters in params to request the LLM service url. + + +#### Data Aggregation +📢 Note: The data aggregation function only supports GPT series models, more models will come soon. + +When using the chart library to draw bar charts, line charts, etc., if the data is not aggregated, it will affect the visualization effect. At the same time, because no filtering and sorting of fields has been done, some visualization intentions cannot be met, for example: show me the top 10 departments with the most cost, show me the sales of various products in the north, etc. + +VMind supports intelligent data aggregation since version 1.2.2. This function uses the data input by the user as a data table, uses a LLM to generate SQL queries according to the user's command, queries data from the data table, and uses GROUP BY and SQL aggregation methods to group, aggregate, sort, and filter data. Supported SQL statements include: SELECT, GROUP BY, WHERE, HAVING, ORDER BY, LIMIT. Supported aggregation methods are: MAX(), MIN(), SUM(), COUNT(), AVG(). Complex SQL operations such as subqueries, JOIN, and conditional statements are not supported. + + +Use the `dataQuery` function of the VMind object to aggregate data. This method has three parameters: +- userInput: user input. You can use the same input as generateChart +- fieldInfo: Dataset field information. The same as generateChart, it can be obtained by parseCSVData, or built by the user. +- dataset: Dataset. The same as generateChart, it can be obtained by parseCSVData, or built by the user. + + +```typescript +const { fieldInfo, dataset } = await vmind?.dataQuery(userInput, fieldInfo, dataset); +``` + + +The fieldInfo and dataset returned by this method are the field information and dataset after data aggregation, which can be used for chart generation. +By default, the `generateChart` function will perform a data aggregation using the same user input before generating the chart. You can disable data aggregation by passing in the fourth parameter: +```typescript +const userInput = 'show me the changes in sales rankings of various car brand'; +const { spec, time } = await vmind.generateChart(userInput, fieldInfo, dataset, false); //pass false as the forth parameter to disable data aggregation before generating a chart. +``` + + #### Dialog-based editing Under development, stay tuned diff --git a/packages/vmind/package.json b/packages/vmind/package.json index 1773993b..b215cb55 100644 --- a/packages/vmind/package.json +++ b/packages/vmind/package.json @@ -11,6 +11,27 @@ "esm", "build" ], + "keywords": [ + "charts", + "visualization", + "VMind", + "LLM", + "storytelling", + "VisActor", + "graphics", + "AIGC" + ], + "homepage": "https://www.visactor.io/vmind", + "bugs": "https://github.com/VisActor/VMind/issues", + "repository": { + "type": "git", + "url": "https://github.com/VisActor/VMind.git", + "directory": "packages/vmind" + }, + "author": { + "name": "VisActor", + "url": "https://www.visactor.io/" + }, "scripts": { "start": "vite ./__tests__/browser", "build": "bundle --clean", diff --git a/packages/vmind/readme-zh.md b/packages/vmind/readme-zh.md index 7ad87ca0..c89648b5 100644 --- a/packages/vmind/readme-zh.md +++ b/packages/vmind/readme-zh.md @@ -138,7 +138,7 @@ const { fieldInfo, dataset } = await vmind.parseCSVDataWithLLM(csv, userInput); ```typescript const describe = 'show me the changes in sales rankings of various car brand'; //调用图表生成接口,获得 spec 和图表动画时长 -const { spec, time } = await vmind.generateChart(userInput, fieldInfo, dataset); +const { spec, time } = await vmind.generateChart(describe, fieldInfo, dataset); ``` 这样我们就得到了对应动态图表的 VChart spec。我们可以基于该 spec 渲染图表: @@ -164,7 +164,7 @@ vchart.renderAsync(); //describe使用中英文均可 //指定生成科技感风格的图表 const describe = 'show me the changes in sales rankings of various car brand,tech style'; -const { spec, time } = await vmind.generateChart(userInput, fieldInfo, dataset); +const { spec, time } = await vmind.generateChart(describe, fieldInfo, dataset); ``` 也可以指定 VMind 支持的图表类型,字段映射等等。比如: @@ -173,7 +173,7 @@ const { spec, time } = await vmind.generateChart(userInput, fieldInfo, dataset); //指定生成折线图,汽车厂商做 x 轴 const describe = 'show me the changes in sales rankings of various car brands,tech style.Using a line chart, Manufacturer makes the x-axis'; -const { spec, time } = await(vmind.generateChart(csvData, describe)); +const { spec, time } = await(vmind.generateChart(csvData, describe, dataset)); ``` #### 自定义大模型调用方式 @@ -196,6 +196,33 @@ const vmind = new VMind(openAIKey:string, params:{ 在 url 中指定您的大模型服务 url(默认为https://api.openai.com/v1/chat/completions) 在随后的调用中,VMind 会使用 params 中的参数请求大模型服务 url +#### 数据聚合 +📢 Note: 数据聚合功能只支持GPT系列模型,更多模型正在接入中。 + +在使用图表库绘制柱状图、折线图等图表时,若传入的数据不是聚合后的数据,会影响可视化效果。同时由于没有对字段进行筛选和排序,某些图表展示意图无法满足,例如:帮我展示使用量最多的10个部门,帮我展示北方各商品的销售额等。 + +VMind 1.2.2版本开始支持智能数据聚合功能。该功能会将用户传入的数据作为一张数据表,使用大模型根据用户的指令生成SQL查询,从数据表中查询数据,并通过GROUP BY和SQL聚合函数对数据进行分组聚合、排序、筛选。目前支持的SQL语句:SELECT, GROUP BY, WHERE, HAVING, ORDER BY, LIMIT。目前支持的聚合函数:MAX(), MIN(), SUM(), COUNT(), AVG()。不支持子查询、JOIN、条件语句等复杂的SQL操作。 + + +使用VMind对象的`dataQuery`函数对数据进行聚合。该方法有3个参数: +- userInput:用户输入。使用与generateChart相同的输入即可 +- fieldInfo:数据集字段信息。与generateChart相同,可使用parseCSVData获得,或者由用户自己构建。 +- dataset:数据集。与generateChart相同,可使用parseCSVData获得,或者由用户自己构建。 + + +```typescript +const { fieldInfo, dataset } = await vmind?.dataQuery(userInput, fieldInfo, dataset); +``` + + +该方法返回的fieldInfo和dataset是数据聚合后的字段信息和数据集,可用于后续的图表生成。 +`generateChart`函数默认会在生成图表之前,使用相同的用户输入进行一次数据聚合。可通过传入第四个参数来禁用数据聚合: +```typescript +const userInput = 'show me the changes in sales rankings of various car brand'; +const { spec, time } = await vmind.generateChart(userInput, fieldInfo, dataset, false); //pass false as the forth parameter to disable data aggregation before generating a chart. +``` + + #### 对话式编辑 开发中,敬请期待 diff --git a/packages/vmind/src/core/VMind.ts b/packages/vmind/src/core/VMind.ts index 9351a2e9..b6183aa5 100644 --- a/packages/vmind/src/core/VMind.ts +++ b/packages/vmind/src/core/VMind.ts @@ -89,6 +89,7 @@ class VMind { return queryDatasetWithGPT(userPrompt, fieldInfo, dataset, this._options); } if ([Model.SKYLARK, Model.SKYLARK2].includes(this._model)) { + console.error('Please user GPT model'); return { fieldInfo: [], dataset }; } console.error('unsupported model in data query!'); From 11cc1e12cbcae0ae03c8c0541b411fbb49bda753 Mon Sep 17 00:00:00 2001 From: da730 Date: Tue, 30 Jan 2024 07:12:24 +0000 Subject: [PATCH 5/7] build: prelease version 1.2.1 --- common/config/rush/version-policies.json | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index dd841c02..3f98b0ae 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1,9 +1 @@ -[ - { - "definitionName": "lockStepVersion", - "policyName": "vmindMin", - "version": "1.2.1", - "mainProject": "@visactor/vmind", - "nextBump": "minor" - } -] +[{"definitionName":"lockStepVersion","policyName":"vmindMin","version":"1.2.2","mainProject":"@visactor/vmind","nextBump":"patch"}] From 10aa5d065dc9e4955f1bf5e4f24d662b29d3c39d Mon Sep 17 00:00:00 2001 From: da730 Date: Tue, 30 Jan 2024 15:37:01 +0800 Subject: [PATCH 6/7] feat: add version polices --- common/config/rush/version-policies.json | 10 +++++++++- rush.json | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index 3f98b0ae..e5dd1370 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1,9 @@ -[{"definitionName":"lockStepVersion","policyName":"vmindMin","version":"1.2.2","mainProject":"@visactor/vmind","nextBump":"patch"}] +[ + { + "definitionName": "lockStepVersion", + "policyName": "vmindMin", + "version": "1.2.1", + "mainProject": "@visactor/vmind", + "nextBump": "patch" + } +] diff --git a/rush.json b/rush.json index 93434047..02a6bd7f 100644 --- a/rush.json +++ b/rush.json @@ -60,6 +60,7 @@ "packageName": "@visactor/vmind", "projectFolder": "packages/vmind", "shouldPublish": true, + "versionPolicyName": "vmindMin", "tags": [ "package" ] @@ -68,6 +69,7 @@ "packageName": "@visactor/calculator", "projectFolder": "packages/calculator", "shouldPublish": true, + "versionPolicyName": "vmindMin", "tags": [ "package" ] From 5dc16a8115aa61bba13c54b3a92db57e601a7c43 Mon Sep 17 00:00:00 2001 From: da730 Date: Tue, 30 Jan 2024 07:46:18 +0000 Subject: [PATCH 7/7] build: prelease version 1.2.2 --- common/config/rush/version-policies.json | 2 +- packages/calculator/package.json | 2 +- packages/vmind/CHANGELOG.json | 11 +++++++++++ packages/vmind/CHANGELOG.md | 9 +++++++++ packages/vmind/package.json | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 packages/vmind/CHANGELOG.json create mode 100644 packages/vmind/CHANGELOG.md diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index e5dd1370..8c35428d 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -2,7 +2,7 @@ { "definitionName": "lockStepVersion", "policyName": "vmindMin", - "version": "1.2.1", + "version": "1.2.2", "mainProject": "@visactor/vmind", "nextBump": "patch" } diff --git a/packages/calculator/package.json b/packages/calculator/package.json index e9664589..814d20e0 100644 --- a/packages/calculator/package.json +++ b/packages/calculator/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/calculator", - "version": "0.0.0", + "version": "1.2.2", "description": "SQL-like query executor with DSL", "main": "lib", "module": "es", diff --git a/packages/vmind/CHANGELOG.json b/packages/vmind/CHANGELOG.json new file mode 100644 index 00000000..19b0be36 --- /dev/null +++ b/packages/vmind/CHANGELOG.json @@ -0,0 +1,11 @@ +{ + "name": "@visactor/vmind", + "entries": [ + { + "version": "1.2.2", + "tag": "@visactor/vmind_v1.2.2", + "date": "Tue, 30 Jan 2024 07:40:01 GMT", + "comments": {} + } + ] +} diff --git a/packages/vmind/CHANGELOG.md b/packages/vmind/CHANGELOG.md new file mode 100644 index 00000000..9eb9f527 --- /dev/null +++ b/packages/vmind/CHANGELOG.md @@ -0,0 +1,9 @@ +# Change Log - @visactor/vmind + +This log was last generated on Tue, 30 Jan 2024 07:40:01 GMT and should not be manually modified. + +## 1.2.2 +Tue, 30 Jan 2024 07:40:01 GMT + +_Initial release_ + diff --git a/packages/vmind/package.json b/packages/vmind/package.json index b215cb55..3ed42b78 100644 --- a/packages/vmind/package.json +++ b/packages/vmind/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vmind", - "version": "1.2.1", + "version": "1.2.2", "main": "cjs/index.js", "module": "esm/index.js", "types": "esm/index.d.ts",