@@ -22,8 +22,8 @@ export enum Chapters {
2222 xrobot_guide_device = "/xrobot/device/" ,
2323 // api
2424 xrobot_api = "/xrobot/api/" ,
25- xrobot_api_server = "/xrobot/api/server" ,
26- xrobot_api_client = "/xrobot/api/client" ,
25+ xrobot_api_server = "/xrobot/api/server/ " ,
26+ xrobot_api_client = "/xrobot/api/client/ " ,
2727 // faq
2828 xrobot_faq = "/xrobot/faq/" ,
2929}
@@ -42,6 +42,12 @@ export enum Chapters {
4242
4343// 给 ChapterItem 的 link 字段追加当前章节的 link 前缀
4444export function apply_prefix ( item : ChapterItem , prefix : Chapters ) {
45+ // // 包含子章节
46+ // if (item.items && isChapter(item.link))
47+ // return item.items.map((item2) =>
48+ // apply_prefix(item2, item.link as Chapters)
49+ // );
50+
4551 if ( item ?. link . startsWith ( "/" ) && prefix . endsWith ( "/" ) ) {
4652 return { ...item , link : prefix . slice ( 0 , - 1 ) + item . link } ;
4753 } else if ( ! item . link . startsWith ( "/" ) && ! prefix . endsWith ( "/" ) ) {
@@ -50,28 +56,37 @@ export function apply_prefix(item: ChapterItem, prefix: Chapters) {
5056 return { ...item , link : prefix + item . link } ;
5157}
5258
53- export const items_xrobot_api = [
59+ export const items_xrobot_api_server = [
5460 {
55- text : "API参考 " ,
61+ text : "服务端API参考 " ,
5662 collapsed : false ,
57- link : Chapters . xrobot_api ,
63+ link : Chapters . xrobot_api_server ,
5864 items : [
5965 { text : "用户API" , link : "user" } ,
6066 { text : "智能体API" , link : "agent" } ,
6167 { text : "设备API" , link : "device" } ,
6268 { text : "音色克隆API" , link : "voice-clone" } ,
63- ] . map ( ( item ) => apply_prefix ( item , Chapters . xrobot_api ) ) ,
69+ ] . map ( ( item ) => apply_prefix ( item , Chapters . xrobot_api_server ) ) ,
6470 } ,
6571] ;
6672
67- export const items_xrobot_api_server = [ ] ;
68- export const items_xrobot_api_client = [ ] ;
73+ export const items_xrobot_api_client = [
74+ {
75+ text : "客户端API参考" ,
76+ collapsed : false ,
77+ link : Chapters . xrobot_api_client ,
78+ items : [ ] . map ( ( item ) => apply_prefix ( item , Chapters . xrobot_api_client ) ) ,
79+ } ,
80+ ] ;
6981
70- export default {
71- items_xrobot_api,
72- items_xrobot_api_client,
73- items_xrobot_api_server,
74- } ;
82+ export const items_xrobot_api = [
83+ {
84+ text : "API参考" ,
85+ collapsed : false ,
86+ link : Chapters . xrobot_api ,
87+ items : [ ...items_xrobot_api_server , ...items_xrobot_api_client ] ,
88+ } ,
89+ ] ;
7590
7691export const items_xrobot_guide_mp = [
7792 {
@@ -140,7 +155,7 @@ const items_xrobot = [
140155
141156function gobackItem ( chapter : Chapters ) {
142157 return {
143- text : "返回上级" ,
158+ text : "< 返回上级" ,
144159 link : chapter ,
145160 goback : true ,
146161 } ;
0 commit comments