-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
113 additions
and
60 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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
title: 定制模型输出 UI | ||
nav: { title: '指南', order: 0 } | ||
toc: content | ||
order: 1 | ||
--- | ||
|
||
## 定制模型输出 UI | ||
|
||
为模型输出的结构化数据,通过代码块的方式定制 UI。 | ||
|
||
```tsx | pure | ||
import { GPTVisLite, withChartCode } from '@antv/gpt-vis'; | ||
|
||
const markdownContent = ` | ||
\`\`\`weather | ||
{ | ||
"locationName": "Hangzhou", | ||
"temperature": 11.4, | ||
"humidity": 82, | ||
"wind": 6.8, | ||
"cloudiness": 75, | ||
"uv": "0.2 of 11" | ||
} | ||
\`\`\` | ||
In Hangzhou, the current weather is as follows: | ||
- The temperature is 11.4°C, humidity is 82%, and wind speed is 6.8 kph. | ||
- There's 75% cloud cover, and the UV index is very low at 0.2 out of 11. | ||
- This indicates cool, humid conditions with overcast skies and minimal UV exposure. | ||
`; | ||
|
||
const customRenderers = { | ||
weather: (props) => 'WeatherCard', | ||
}; | ||
const components = { | ||
code: withChartCode({ | ||
// register custom block renderer | ||
languageRenderers: customRenderers, | ||
}), | ||
}; | ||
|
||
export default () => { | ||
return <GPTVisLite components={components}>{markdownContent}</GPTVisLite>; | ||
}; | ||
``` | ||
|
||
<code src="./demos/custom-ui.tsx"></code> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ group: | |
order: 1 | ||
title: 统计图 | ||
demo: { cols: 2 } | ||
toc: content | ||
nav: { title: '组件', order: 1 } | ||
--- | ||
|
||
|
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ order: 4 | |
group: | ||
order: 1 | ||
title: 统计图 | ||
toc: content | ||
demo: { cols: 2 } | ||
--- | ||
|
||
|
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,5 +1,6 @@ | ||
--- | ||
order: 2 | ||
toc: content | ||
group: | ||
order: 10 | ||
title: 其他 | ||
|
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,5 +1,6 @@ | ||
--- | ||
order: 2 | ||
toc: content | ||
group: | ||
order: 1 | ||
title: 统计图 | ||
|
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,5 +1,6 @@ | ||
--- | ||
order: 3 | ||
toc: content | ||
group: | ||
order: 10 | ||
title: 其他 | ||
|
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ group: | |
order: 1 | ||
title: 统计图 | ||
demo: { cols: 2 } | ||
toc: content | ||
--- | ||
|
||
# DualAxes 双轴图 | ||
|
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ order: 6 | |
group: | ||
order: 4 | ||
title: 关系图 | ||
toc: content | ||
--- | ||
|
||
# FishboneDiagram 鱼骨图 | ||
|
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ order: 2 | |
group: | ||
order: 3 | ||
title: 关系图 | ||
toc: content | ||
--- | ||
|
||
# FlowDiagram 流程图 | ||
|
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ order: 1 | |
group: | ||
order: 10 | ||
title: 其他 | ||
toc: content | ||
--- | ||
|
||
# GPTVis 协议渲染器 | ||
|
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ order: 3 | |
group: | ||
order: 2 | ||
title: 地图 | ||
toc: content | ||
--- | ||
|
||
# HeatMap 热力地图 | ||
|
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ group: | |
order: 1 | ||
title: 统计图 | ||
demo: { cols: 2 } | ||
toc: content | ||
--- | ||
|
||
# Histogram 直方图 | ||
|
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ group: | |
order: 3 | ||
title: 关系图 | ||
demo: { cols: 2 } | ||
toc: content | ||
--- | ||
|
||
# IndentedTree 缩进树 | ||
|
Oops, something went wrong.