-
-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add GPT-Vis demo for bubble (#278)
* docs: add chart demo for bubble * docs: rename to gpt-vis * test: ignore gpt-vis demo for temporary, need browser env not jsdom --------- Co-authored-by: 🏎️ Imer <[email protected]>
- Loading branch information
Showing
8 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { extendTest } from '../../../tests/shared/demoTest'; | ||
|
||
extendTest('bubble'); | ||
extendTest('bubble', { | ||
// Ignore gpt-vis demo, need browser env not jsdom | ||
skip: ['gpt-vis'], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import demoTest from '../../../tests/shared/demoTest'; | ||
|
||
demoTest('bubble'); | ||
demoTest('bubble', { | ||
// Ignore gpt-vis demo, need browser env not jsdom | ||
skip: ['gpt-vis'], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## zh-CN | ||
|
||
配合 `@antv/GPT-Vis` 实现大模型输出的图表渲染。 | ||
|
||
## en-US | ||
|
||
Cooperate with `@antv/GPT-Vis` to achieve customized rendering chart of LLM output. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Bubble } from '@ant-design/x'; | ||
import type { BubbleProps } from '@ant-design/x'; | ||
import { GPTVis } from '@antv/gpt-vis'; | ||
/* eslint-disable react/no-danger */ | ||
import React from 'react'; | ||
|
||
const text = ` | ||
**GPT-Vis**, Components for GPTs, generative AI, and LLM projects. Not only UI Components. [more...](https://github.com/antvis/GPT-Vis) \n\n | ||
Here’s a visualization of Haidilao's food delivery revenue from 2013 to 2022. You can see a steady increase over the years, with notable *growth* particularly in recent years. | ||
\`\`\`vis-chart | ||
{ | ||
"type": "line", | ||
"data": [{"time":2013,"value":59.3},{"time":2014,"value":64.4},{"time":2015,"value":68.9},{"time":2016,"value":74.4},{"time":2017,"value":82.7},{"time":2018,"value":91.9},{"time":2019,"value":99.1},{"time":2020,"value":101.6},{"time":2021,"value":114.4},{"time":2022,"value":121}], | ||
"axisXTitle": "year", | ||
"axisYTitle": "sale" | ||
} | ||
\`\`\` | ||
`; | ||
|
||
const RenderMarkdown: BubbleProps['messageRender'] = (content) => <GPTVis>{content}</GPTVis>; | ||
|
||
const App = () => { | ||
return ( | ||
<Bubble | ||
typing={{ step: 30, interval: 300 }} | ||
content={text} | ||
messageRender={RenderMarkdown} | ||
avatar={{ | ||
src: 'https://mdn.alipayobjects.com/huamei_qa8qxu/afts/img/A*2Q5LRJ3LFPUAAAAAAAAAAAAADmJ7AQ/fmt.webp', | ||
}} | ||
variant="outlined" | ||
/> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters