Skip to content

Commit 57885cc

Browse files
committed
调整部分页面内容与结构;增强章节目录生成组件报错提示
1 parent 3afda10 commit 57885cc

File tree

20 files changed

+164
-165
lines changed

20 files changed

+164
-165
lines changed

docs/.vitepress/config.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export default defineConfig({
2626
outline: [2, 4],
2727
nav: [
2828
{ text: "主页", link: "/" },
29-
// { text: "使用文档", link: Chapters.xrobot_guide_device },
29+
{ text: "开发文档", link: Chapters.xrobot_platform },
3030
{ text: "API参考", link: Chapters.xrobot_api },
31-
{ text: "最佳实践: ESP32 接入", link: Chapters.xrobot_platform_esp32 },
31+
{ text: "最佳实践", link: Chapters.xrobot_platform_esp32 },
3232
{ text: "FAQ", link: Chapters.xrobot_faq },
3333
],
3434
sidebar: sidebarItems,

docs/.vitepress/theme/components/ChapterContents.vue

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script setup lang="ts">
2+
import { useData } from "vitepress";
23
import {
34
ChapterItems,
45
Chapters,
@@ -18,25 +19,37 @@ let tocs: { link: string; text: string }[][] = [];
1819
1920
// console.log("chapter_root", chapter_root);
2021
// console.log("ChapterItems[chapter_root]", ChapterItems[chapter_root]);
21-
22-
ChapterItems[chapter_root]?.forEach((subchapter) => {
23-
const t = subchapter.items?.filter((item) => {
24-
return item.link !== chapter_root && !item.goback;
22+
const items = ChapterItems[chapter_root];
23+
if (!items) {
24+
const { page } = useData();
25+
console.warn(
26+
"Error at gen ChapterContents, chapter_root:",
27+
chapter_root,
28+
"filePath:",
29+
page.value.filePath,
30+
"title:",
31+
page.value.title
32+
);
33+
} else {
34+
items.forEach((subchapter) => {
35+
const t = subchapter.items?.filter((item) => {
36+
return item.link !== chapter_root && !item.goback;
37+
});
38+
if (t) {
39+
tocs.push(t);
40+
chapter_name.push(subchapter.text);
41+
}
2542
});
26-
if (t) {
27-
tocs.push(t);
28-
chapter_name.push(subchapter.text);
29-
}
30-
});
43+
}
3144
3245
// console.log("chapter_name:", chapter_name);
3346
// console.log("tocs:", tocs);
3447
</script>
3548

3649
<template>
37-
<h1 v-if="root">目录</h1>
50+
<h2 v-if="root">目录</h2>
3851
<div v-for="(subchapter, index) in tocs">
39-
<h2>{{ chapter_name[index] }}</h2>
52+
<h3>{{ chapter_name[index] }}</h3>
4053
<div v-if="subchapter.length === 0"><span>暂无内容</span></div>
4154
<ol v-else>
4255
<li v-for="(item, index2) in subchapter" :key="item.link">

docs/.vitepress/theme/constrants/route.ts

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ export enum Chapters {
2323
// api
2424
xrobot_api = "/xrobot/api/",
2525
xrobot_api_server = "/xrobot/api/server/",
26-
xrobot_api_client = "/xrobot/api/client/",
26+
// xrobot_api_client = "/xrobot/api/client/",
2727
xrobot_api_protocol = "/xrobot/api/protocol/",
2828
// platform
2929
xrobot_platform = "/xrobot/platform/",
3030
xrobot_platform_esp32 = "/xrobot/platform/esp32/",
3131
xrobot_platform_others = "/xrobot/platform/others/",
3232
xrobot_platform_others_mp = "/xrobot/platform/others/mini-program/",
33-
xrobot_platform_others_device = "/xrobot/platform/others/device/",
3433
xrobot_platform_others_console = "/xrobot/platform/others/console/",
35-
xrobot_platform_others_net_config = "/xrobot/platform/others/net-config/",
34+
xrobot_platform_others_device = "/xrobot/platform/others/device/",
35+
xrobot_platform_others_device_net_config = "/xrobot/platform/others/net-config/",
3636
// faq
3737
xrobot_faq = "/xrobot/faq/",
3838
}
@@ -79,7 +79,7 @@ export function apply_prefix(item: ChapterItem, prefix: Chapters) {
7979

8080
export const items_xrobot_api_server = [
8181
{
82-
text: "服务端API参考",
82+
text: "平台接入API",
8383
collapsed: true,
8484
link: Chapters.xrobot_api_server,
8585
items: [
@@ -91,18 +91,18 @@ export const items_xrobot_api_server = [
9191
},
9292
];
9393

94-
export const items_xrobot_api_client = [
95-
{
96-
text: "客户端API参考",
97-
collapsed: true,
98-
link: Chapters.xrobot_api_client,
99-
items: [].map((item) => apply_prefix(item, Chapters.xrobot_api_client)),
100-
},
101-
];
94+
// export const items_xrobot_api_client = [
95+
// {
96+
// text: "设备接入协议",
97+
// collapsed: true,
98+
// link: Chapters.xrobot_api_client,
99+
// items: [].map((item) => apply_prefix(item, Chapters.xrobot_api_client)),
100+
// },
101+
// ];
102102

103103
export const items_xrobot_api_protocol = [
104104
{
105-
text: "WebSocket API参考",
105+
text: "设备接入协议",
106106
collapsed: true,
107107
link: Chapters.xrobot_api_protocol,
108108
items: [
@@ -120,7 +120,7 @@ export const items_xrobot_api = [
120120
link: Chapters.xrobot_api,
121121
items: [
122122
...items_xrobot_api_server,
123-
...items_xrobot_api_client,
123+
// ...items_xrobot_api_client,
124124
...items_xrobot_api_protocol,
125125
],
126126
},
@@ -140,14 +140,31 @@ export const items_xrobot_platform_mp = [
140140
},
141141
];
142142

143+
const items_xrobot_platform_net_config = [
144+
{
145+
text: "配网",
146+
link: Chapters.xrobot_platform_others_device_net_config,
147+
collapsed: true,
148+
items: [
149+
{ text: "通过微信小程序", link: "mp" },
150+
{ text: "通过浏览器", link: "browser" },
151+
].map((item) =>
152+
apply_prefix(item, Chapters.xrobot_platform_others_device_net_config)
153+
),
154+
},
155+
];
156+
143157
export const items_xrobot_platform_device = [
144158
{
145159
text: "设备配置与使用",
146160
link: Chapters.xrobot_platform_others_device,
147161
collapsed: true,
148-
items: [{ text: "使用指南", link: "device-intro" }].map((item) =>
149-
apply_prefix(item, Chapters.xrobot_platform_others_device)
150-
),
162+
items: [
163+
...[{ text: "设备基本配置流程说明", link: "device-intro" }].map((item) =>
164+
apply_prefix(item, Chapters.xrobot_platform_others_device)
165+
),
166+
...items_xrobot_platform_net_config,
167+
],
151168
},
152169
];
153170

@@ -157,7 +174,7 @@ const items_xrobot_platform_console = [
157174
link: Chapters.xrobot_platform_others_console,
158175
collapsed: true,
159176
items: [
160-
{ text: "基本介绍", link: "intro" },
177+
// { text: "基本介绍", link: "intro" },
161178
{ text: "智能体连接指南", link: "device-connection" },
162179
{ text: "设备绑定", link: "device-bind" },
163180
].map((item) =>
@@ -166,17 +183,6 @@ const items_xrobot_platform_console = [
166183
},
167184
];
168185

169-
const items_xrobot_platform_net_config = [
170-
{
171-
text: "配网",
172-
link: Chapters.xrobot_platform_others_net_config,
173-
collapsed: true,
174-
items: [{ text: "通过微信小程序", link: "mp" }].map((item) =>
175-
apply_prefix(item, Chapters.xrobot_platform_others_net_config)
176-
),
177-
},
178-
];
179-
180186
export const items_xrobot_guide = [];
181187

182188
const items_xrobot_platform_esp32 = [
@@ -198,10 +204,9 @@ const items_xrobot_platform_others = [
198204
link: Chapters.xrobot_platform,
199205
collapsed: true,
200206
items: [
201-
...items_xrobot_platform_mp,
202207
...items_xrobot_platform_device,
208+
...items_xrobot_platform_mp,
203209
...items_xrobot_platform_console,
204-
...items_xrobot_platform_net_config,
205210
],
206211
},
207212
];
@@ -258,10 +263,10 @@ export const ChapterItems: Record<Chapters, ChapterItem[]> = {
258263
gobackItem(Chapters.xrobot_api),
259264
...items_xrobot_api_server,
260265
],
261-
[Chapters.xrobot_api_client]: [
262-
gobackItem(Chapters.xrobot_api),
263-
...items_xrobot_api_client,
264-
],
266+
// [Chapters.xrobot_api_client]: [
267+
// gobackItem(Chapters.xrobot_api),
268+
// ...items_xrobot_api_client,
269+
// ],
265270
[Chapters.xrobot_api_protocol]: [
266271
gobackItem(Chapters.xrobot_api),
267272
...items_xrobot_api_protocol,
@@ -295,7 +300,7 @@ export const ChapterItems: Record<Chapters, ChapterItem[]> = {
295300
gobackItem(Chapters.xrobot_platform_others),
296301
...items_xrobot_platform_console,
297302
],
298-
[Chapters.xrobot_platform_others_net_config]: [
303+
[Chapters.xrobot_platform_others_device_net_config]: [
299304
gobackItem(Chapters.xrobot_platform_others),
300305
...items_xrobot_platform_net_config,
301306
],

docs/xrobot/api/server/agent.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ title: 智能体API
1010
请求:
1111
POST https://xrobo.qiniuapi.com/xiaozhi/agent
1212
Content-Type: application/json
13-
authorization Bearer 4fxxxxxxxxxxxxxxxxxxxxxxx
13+
authorization Bearer <token>
1414
{
1515
"agentName": "吞吞吐吐" 【用户随意命名,有参数检查】
1616
}
@@ -23,8 +23,6 @@ authorization Bearer 4fxxxxxxxxxxxxxxxxxxxxxxx
2323
2424
```
2525

26-
27-
2826
## 2. 获取智能体列表
2927

3028
```
@@ -66,7 +64,7 @@ authorization Bearer 4fxxxxxxxxxxxxxxxxxxxxxxx
6664
请求:
6765
PUT https://xrobo.qiniu.com/xiaozhi/agent/3e0535877a0b46ca8555d73ec43a4211
6866
Content-Type: application/json
69-
authorization Bearer 4fxxxxxxxxxxxxxxxxxxxxxxx
67+
authorization Bearer <token>
7068
{
7169
agentCode: "AGT*1752818539532"
7270
agentName: "ggg"
@@ -102,15 +100,15 @@ vllmModelId: "VLLM_ChatGLMVLLM"
102100
请求:
103101
DELETE https://xrobo.qiniu.com/xiaozhi/agent/3e0535877a0b46ca8555d73ec43a4211
104102
Content-Type: application/json
105-
authorization Bearer 4fxxxxxxxxxxxxxxxxxxxxxxx
103+
authorization Bearer <token>
106104
{
107105
108106
}
109107
响应:
110108
{
111-
"code":0,
112-
"msg":"success",
113-
"data":null
109+
"code":0,
110+
"msg":"success",
111+
"data":null
114112
}
115113
116-
```
114+
```
42.4 KB
Loading

docs/xrobot/api/server/user.md

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,62 +4,73 @@ title: 用户API
44

55
## 1. 用户注册
66

7-
```plain
87
请求:
8+
9+
```
910
POST https://xrobo.qiniu.com/xiaozhi/user/register
1011
Content-Type: application/json
12+
```
13+
14+
```json
1115
{
1216
"username": "",
1317
"password": "",
14-
"captcha": "etnjx", 【下面的方法获取】
15-
"mobileCaptcha": "", 【否】
16-
"captchaId": "" 【uuid:cfa94872-48b6-425b-8e6a-17b912b6b6f4"】
18+
"captcha": "",
19+
"mobileCaptcha": "",
20+
"captchaId": ""
1721
}
22+
```
23+
1824
响应:
25+
26+
```json
1927
{
20-
"code": 0,
21-
"msg": "",
22-
"data": {}
28+
"code": 0,
29+
"msg": "",
30+
"data": {}
2331
}
2432

2533
```
2634

27-
```
28-
// 如何获取 captcha
29-
GET https://xrobo.qiniu.com/xiaozhi/user/captcha?uuid=cfa94872-48b6-425b-8e6a-17b912b6b6f4 [uuid 随机生成]
30-
```
35+
### 获取 captcha
36+
37+
GET <https://xrobo.qiniu.com/xiaozhi/user/captcha?uuid=cfa94872-48b6-425b-8e6a-17b912b6b6f4>
38+
39+
uuid 随机生成
3140

3241
响应:
33-
<img src="../device/imgs/device-bind/4.captcha-eg.png" class="img-center">
3442

35-
## 2. 用户登录
43+
<img src="./imgs/user/captcha-eg.png" class="img-center" alt="captcha-eg">
3644

37-
```
45+
## 2. 用户登录
3846

3947
请求:
40-
POST https://xrobo.qiniuapi.com/xiaozhi/user/login
48+
49+
```
50+
POST <https://xrobo.qiniuapi.com/xiaozhi/user/login>
4151
Content-Type: application/json
52+
```
53+
54+
```json
55+
4256
{
43-
areaCode: "+86"
44-
captcha: "xxxxx"
45-
captchaId: "d4224c42-a0a2-4e38-87a5-edc3ad03c014"
46-
mobile: ""
47-
password: "xxxx"
48-
username: "xxx"
57+
"areaCode": "+86",
58+
"captcha": "xxxxx",
59+
"captchaId": "d4224c42-a0a2-4e38-87a5-edc3ad03c014",
60+
"mobile": "",
61+
"password": "xxxx",
62+
"username": "xxx",
4963
}
5064
响应:
5165
{
52-
"code": 0,
53-
"msg": "success",
54-
"data": {
55-
"token": "4fxxxxxxxxxxxxxxxxxxxxxxx", 【后续创建 agent 等操作,需要带上 token】
56-
"expire": 43200,
57-
"clientHash": "xxxxxx"
58-
}
66+
"code": 0,
67+
"msg": "success",
68+
"data": {
69+
"token": "4fxxxxxxxxxxxxxxxxxxxxxxx",
70+
"expire": 43200,
71+
"clientHash": "xxxxxx"
72+
}
5973
}
60-
6174
```
6275

63-
## 3. 声音复刻
64-
65-
[声音复刻](./voice-clone.md)
76+
返回的`token`为后续大多数api的凭证

docs/xrobot/platform/others/console/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ import { Chapters } from "../../../../.vitepress/theme/constrants/route";
44
const chapter_root = Chapters.xrobot_platform_others_console;
55
</script>
66

7+
## 基本介绍
8+
9+
七牛云灵芯平台,是灵矽平台 web 端的智能管理后台,集智能体管理、音色复刻等功能于一体。
10+
11+
链接:<https://xrobo.qiniu.com/>
12+
713
<ChapterContents :chapter=chapter_root />

0 commit comments

Comments
 (0)