Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
687 changes: 0 additions & 687 deletions .github/skills/gpt-vis-ai-graph-refactor/SKILL.md

This file was deleted.

534 changes: 0 additions & 534 deletions .github/skills/gpt-vis-ai-refactor/SKILL.md

This file was deleted.

380 changes: 252 additions & 128 deletions IMPLEMENTATION_SUMMARY.md

Large diffs are not rendered by default.

40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ data
value 150
`;

gptVis.render('line', visSyntax);
gptVis.render(visSyntax);
```

### Streaming Support
Expand All @@ -87,8 +87,7 @@ let buffer = '';
function onToken(token) {
buffer += token;
if (isVisSyntax(buffer)) {
const type = buffer.match(/vis\s+(\S+)/)?.[1];
if (type) gptVis.render(type, buffer);
gptVis.render(buffer);
}
}
```
Expand All @@ -107,6 +106,7 @@ data
### Examples

**Simple chart:**

```
vis pie
data
Expand All @@ -118,6 +118,7 @@ innerRadius 0.6
```

**With style:**

```
vis line
data
Expand All @@ -131,6 +132,7 @@ style
```

**Hierarchical data:**

```
vis mind-map
data
Expand All @@ -149,8 +151,9 @@ data
import { GPTVis } from '@antv/gpt-vis';

const gptVis = new GPTVis({ container: '#chart', width: 600, height: 400 });
gptVis.render('pie', visSyntaxString);
gptVis.render(visSyntaxString);
```

</details>

<details>
Expand All @@ -163,22 +166,22 @@ import { useEffect, useRef } from 'react';
function ChartComponent({ visSyntax }) {
const containerRef = useRef();
const gptVisRef = useRef();

useEffect(() => {
gptVisRef.current = new GPTVis({ container: containerRef.current, width: 600, height: 400 });
return () => gptVisRef.current?.destroy();
}, []);

useEffect(() => {
if (gptVisRef.current && visSyntax) {
const type = visSyntax.match(/vis\s+(\S+)/)?.[1] || 'pie';
gptVisRef.current.render(type, visSyntax);
gptVisRef.current.render(visSyntax);
}
}, [visSyntax]);

return <div ref={containerRef} />;
}
```

</details>

<details>
Expand All @@ -199,20 +202,22 @@ let gptVis = null;

onMounted(() => {
gptVis = new GPTVis({ container: chartRef.value, width: 600, height: 400 });
const type = props.visSyntax.match(/vis\s+(\S+)/)?.[1] || 'pie';
gptVis.render(type, props.visSyntax);
gptVis.render(props.visSyntax);
});

watch(() => props.visSyntax, (newSyntax) => {
if (gptVis) {
const type = newSyntax.match(/vis\s+(\S+)/)?.[1] || 'pie';
gptVis.render(type, newSyntax);
}
});
watch(
() => props.visSyntax,
(newSyntax) => {
if (gptVis) {
gptVis.render(newSyntax);
}
},
);

onUnmounted(() => gptVis?.destroy());
</script>
```

</details>

## 🧠 Knowledge Base
Expand All @@ -224,6 +229,7 @@ GPT-Vis includes a comprehensive [knowledge base](https://github.com/antvis/GPT-
> **⚠️ AI-Generated Code Policy**: This project only merges AI-generated code.

To contribute:

1. Submit an Issue describing the problem or feature
2. Tag @copilot to generate the implementation
3. Submit PR with AI-generated code
Expand Down
40 changes: 23 additions & 17 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ data
value 150
`;

gptVis.render('line', visSyntax);
gptVis.render(visSyntax);
```

### 流式支持
Expand All @@ -87,8 +87,7 @@ let buffer = '';
function onToken(token) {
buffer += token;
if (isVisSyntax(buffer)) {
const type = buffer.match(/vis\s+(\S+)/)?.[1];
if (type) gptVis.render(type, buffer);
gptVis.render(buffer);
}
}
```
Expand All @@ -107,6 +106,7 @@ data
### 示例

**简单图表:**

```
vis pie
data
Expand All @@ -118,6 +118,7 @@ innerRadius 0.6
```

**带样式:**

```
vis line
data
Expand All @@ -131,6 +132,7 @@ style
```

**层次数据:**

```
vis mind-map
data
Expand All @@ -149,8 +151,9 @@ data
import { GPTVis } from '@antv/gpt-vis';

const gptVis = new GPTVis({ container: '#chart', width: 600, height: 400 });
gptVis.render('pie', visSyntaxString);
gptVis.render(visSyntaxString);
```

</details>

<details>
Expand All @@ -163,22 +166,22 @@ import { useEffect, useRef } from 'react';
function ChartComponent({ visSyntax }) {
const containerRef = useRef();
const gptVisRef = useRef();

useEffect(() => {
gptVisRef.current = new GPTVis({ container: containerRef.current, width: 600, height: 400 });
return () => gptVisRef.current?.destroy();
}, []);

useEffect(() => {
if (gptVisRef.current && visSyntax) {
const type = visSyntax.match(/vis\s+(\S+)/)?.[1] || 'pie';
gptVisRef.current.render(type, visSyntax);
gptVisRef.current.render(visSyntax);
}
}, [visSyntax]);

return <div ref={containerRef} />;
}
```

</details>

<details>
Expand All @@ -199,20 +202,22 @@ let gptVis = null;

onMounted(() => {
gptVis = new GPTVis({ container: chartRef.value, width: 600, height: 400 });
const type = props.visSyntax.match(/vis\s+(\S+)/)?.[1] || 'pie';
gptVis.render(type, props.visSyntax);
gptVis.render(props.visSyntax);
});

watch(() => props.visSyntax, (newSyntax) => {
if (gptVis) {
const type = newSyntax.match(/vis\s+(\S+)/)?.[1] || 'pie';
gptVis.render(type, newSyntax);
}
});
watch(
() => props.visSyntax,
(newSyntax) => {
if (gptVis) {
gptVis.render(newSyntax);
}
},
);

onUnmounted(() => gptVis?.destroy());
</script>
```

</details>

## 🧠 知识库
Expand All @@ -224,6 +229,7 @@ GPT-Vis 包含全面的[知识库](https://github.com/antvis/GPT-Vis/tree/main/k
> **⚠️ AI 生成代码策略**: 本项目仅合并 AI 生成的代码。

贡献方式:

1. 提交 Issue 描述问题或功能
2. 标记 @copilot 生成实现
3. 提交包含 AI 生成代码的 PR
Expand Down
2 changes: 1 addition & 1 deletion __tests__/area.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - area chart', () => {
it('should parse basic area chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/bar.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - bar chart', () => {
it('should parse basic bar chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/boxplot.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - boxplot chart', () => {
it('should parse basic boxplot chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/column.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - column chart', () => {
it('should parse basic column chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/dual-axes.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - dual-axes chart', () => {
it('should parse basic dual-axes chart with categories and series', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fishbone-diagram.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - fishbone-diagram chart', () => {
it('should parse basic fishbone-diagram', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/flow-diagram.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - flow-diagram chart', () => {
it('should parse basic flow-diagram with nodes', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/funnel.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - funnel chart', () => {
it('should parse basic funnel chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/heat-map.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - heat-map chart', () => {
it('should parse basic heat-map chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/histogram.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - histogram chart', () => {
it('should parse basic histogram chart with flat number array', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/line.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - line chart', () => {
it('should parse basic line chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/liquid.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - liquid chart', () => {
it('should parse basic liquid chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/mind-map.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - mind-map chart', () => {
it('should parse basic mind-map chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/network-graph.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - network-graph chart', () => {
it('should parse basic network-graph with nodes', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/organization-chart.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - organization-chart', () => {
it('should parse basic organization-chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/parser.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { isVisSyntax, parse } from '../src/ai/parser';
import { isVisSyntax, parse } from '../src/syntax/parser';

describe('isVisSyntax', () => {
it('should return true for valid vis syntax', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/pie.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - pie chart', () => {
it('should parse basic pie chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/pin-map.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - pin-map chart', () => {
it('should parse basic pin-map chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/radar.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - radar chart', () => {
it('should parse basic radar chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/sankey.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - sankey chart', () => {
it('should parse basic sankey chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/scatter.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - scatter chart', () => {
it('should parse basic scatter chart', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/treemap.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { parse } from '../src/ai/parser';
import { parse } from '../src/syntax/parser';

describe('parse - treemap chart', () => {
it('should parse basic treemap chart', () => {
Expand Down
Loading
Loading