Ride status(行程状态)
行程卡片突出预计抵达时间,并显示车辆、上车地点与司机信息。
loading
安装
bash
npm install @assistant-ui/generative-ui zod1
用法
将下方规格传给渲染器。此规格包含完整的展示数据,渲染时使用已完成状态。
tsx
import { defaultGenerativeUILibrary, renderGenerativeUI } from "@assistant-ui/generative-ui/react";
renderGenerativeUI(spec, defaultGenerativeUILibrary, { status: "done" });1
2
3
2
3
规格
tsx
const spec = {
"$type": "Card",
"children": [
{
"$type": "Header",
"$key": "eta",
"text": "4 分钟后抵达",
"size": "3xl"
},
{
"$type": "Text",
"$key": "car",
"value": "丰田凯美瑞 · ABC 1234",
"color": "secondary"
},
{
"$type": "Divider",
"$key": "divider"
},
{
"$type": "Row",
"$key": "facts",
"gap": 6,
"children": [
{
"$type": "Row",
"$key": "pickup",
"align": "start",
"children": [
{
"$type": "Icon",
"$key": "icon",
"name": "map-pin",
"size": "sm"
},
{
"$type": "Fact",
"$key": "fact",
"label": "上车地点",
"value": "市场街 123 号"
}
]
},
{
"$type": "Fact",
"$key": "driver",
"label": "司机",
"value": "林师傅 · 4.98 ★"
}
]
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53