Skip to content

Commit 9bad78d

Browse files
authored
Merge pull request #8 from srsng/main
调整
2 parents 0f61539 + e1537aa commit 9bad78d

File tree

7 files changed

+52
-18
lines changed

7 files changed

+52
-18
lines changed

docs/.vitepress/config.mts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import { defineConfig } from "vitepress";
1+
// import { defineConfig } from "vitepress";
2+
import { withMermaid } from "vitepress-plugin-mermaid";
23
import { Chapters, getChapterItems } from "./theme/constrants/route";
34
import autoH1 from "./plugins/autoH1";
45

56
// 限制sidebar最多深入两层章节
67
const sidebarItems = getChapterItems(1, 2);
78

89
// https://vitepress.dev/reference/site-config
9-
export default defineConfig({
10+
export default withMermaid({
1011
lang: "zh",
1112
title: "灵矽文档中心",
1213
description: "A 灵矽 Documentation Project",
@@ -22,7 +23,7 @@ export default defineConfig({
2223
{ text: "API", link: Chapters.xrobot_api },
2324
{ text: "MCP接入", link: Chapters.xrobot_mcp },
2425
{ text: "最佳实践", link: Chapters.xrobot_guide },
25-
{ text: "FAQ", link: Chapters.xrobot_faq },
26+
{ text: "FAQ", link: Chapters.xrobot_faq + "faq/" },
2627
],
2728
sidebar: sidebarItems,
2829
socialLinks: [
@@ -32,8 +33,8 @@ export default defineConfig({
3233
},
3334
],
3435
search: {
35-
provider: 'local',
36-
}
36+
provider: "local",
37+
},
3738
},
3839
markdown: {
3940
toc: {

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ const items_xrobot_platform = [
7676
link: Chapters.xrobot_platform,
7777
collapsed: true,
7878
items: [
79-
{ text: "OTA", link: "OTA" },
80-
{ text: "websocket", link: "websocket" },
79+
{ text: "OTA 网关", link: "OTA" },
80+
{ text: "WebSocket", link: "websocket" },
8181
{ text: "MQTT", link: "MQTT" },
8282
].map((item) => apply_prefix(item, Chapters.xrobot_platform)),
8383
},
@@ -105,9 +105,7 @@ const items_xrobot_mcp = [
105105
items: [
106106
// { text: "硬件MCP", link: "hardware-mcp" },
107107
// { text: "软件MCP", link: "software-mcp" },
108-
].map((item) =>
109-
apply_prefix(item, Chapters.xrobot_mcp)
110-
),
108+
].map((item) => apply_prefix(item, Chapters.xrobot_mcp)),
111109
},
112110
];
113111

docs/.vitepress/theme/index.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
margin: auto;
2626
}
2727

28+
/* 主页 */
29+
div.home #local-search button {
30+
display: none;
31+
}
32+
2833
/* todo 移除测试背景-该背景被应用到整个页面 */
2934
/* div[class="VPContent is-home"] {
3035
background: linear-gradient(to bottom right, #dce8ff, #e4eeff, #e6cbfd);

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ features:
4141
dark: /icons/dark/faq.svg
4242
width: 100
4343
height: 100
44-
link: ./xrobot/faq
44+
link: ./xrobot/faq/faq/
4545
- linkText: 去体验
4646
icon:
4747
light: /icons/light/experience.svg

docs/xrobot/platform/OTA.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: OTA 协议
2+
title: OTA 协议(网关)
33
---
44

55
## OTA(Over-The-Air)更新介绍

docs/xrobot/platform/websocket.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,39 @@ WebSocket 协议的主要特点包括:
3737
1. 建立 WebSocket 连接
3838
2. 交换 hello 消息
3939
3. 开始语音交互:
40-
41-
- 发送开始监听
42-
- 发送音频数据
43-
- 接收识别结果
44-
- 接收 TTS 音频 4.结束会话时关闭连接
40+
- 发送开始监听
41+
- 发送音频数据
42+
- 接收识别结果
43+
- 接收 TTS 音频
44+
4. 结束会话时关闭连接
45+
46+
```mermaid
47+
sequenceDiagram
48+
participant Client
49+
participant Server
50+
51+
Client->>Server: 建立 WebSocket 连接 (wss://xrobo-io.qiniuapi.com/v1/ws/)
52+
Note right of Client: 携带 headers: Authorization, Protocol-Version, Device-Id, Client-Id
53+
Server-->>Client: 连接成功
54+
55+
Client->>Server: 发送 hello 消息
56+
Note right of Client: JSON: {type: "hello", version: 1, transport: "websocket", audio_params: {...}}
57+
Server-->>Client: 响应 hello 消息
58+
Note left of Server: JSON: {type: "hello", transport: "websocket", audio_params: {...}}
59+
60+
Client->>Server: 发送开始监听消息
61+
Note right of Client: JSON: {session_id: "<ID>", type: "listen", state: "start", mode: "<auto/manual/realtime>"}
62+
63+
Client->>Server: 发送 OPUS 音频数据 (二进制)
64+
Server-->>Client: 返回语音识别结果
65+
Server-->>Client: 发送 TTS 音频数据 (OPUS)
66+
Note left of Server: JSON: {type: "tts", state: "<start/stop/sentence_start>", text: "<文本>"}
67+
68+
Client->>Server: 发送停止监听消息
69+
Note right of Client: JSON: {session_id: "<ID>", type: "listen", state: "stop"}
70+
71+
Client->>Server: 关闭 WebSocket 连接
72+
```
4573

4674
### 连接建立
4775

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"devDependencies": {
3+
"medium-zoom": "^1.0.6",
4+
"mermaid": "^11.9.0",
35
"vitepress": "^1.6.3",
4-
"medium-zoom": "^1.0.6"
6+
"vitepress-plugin-mermaid": "^2.0.17"
57
},
68
"scripts": {
79
"docs:dev": "vitepress dev docs",

0 commit comments

Comments
 (0)