Skip to content

Commit 343b78f

Browse files
Kauid323QianLin-Jiaxi
authored andcommitted
add: instruction机器人指令文档
This document provides details on API endpoints for managing robot instructions, including listing, creating, and editing instructions.
1 parent b04cb52 commit 343b78f

1 file changed

Lines changed: 159 additions & 0 deletions

File tree

src/api/v1/instruction.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
## 获取机器人指令列表(网页控制台)
2+
3+
POST /v1/instruction/web-list
4+
5+
请求头:
6+
7+
|名称|必须|备注|
8+
|-----|-----|-----|
9+
|token|||
10+
11+
请求体:
12+
13+
```JSONC
14+
{
15+
"botId": "45669202" // 机器人id
16+
}
17+
```
18+
19+
响应体:
20+
```JSONC
21+
{
22+
"code": 1, // 请求状态码,1为正常
23+
"data": {
24+
"list": [
25+
{
26+
"id": 2062, // 指令Id
27+
"botId": "45669202", // 机器人id
28+
"name": "普通指令", // 指令名称
29+
"desc": "指令描述", // 指令描述
30+
"instructionType": 1, // 指令类型,1-普通指令,2-直发指令,5-自定义输入指令,更多(如下两个指令)
31+
"hintText": "输入框提示文字", // 输入框提示文字
32+
"defaultText": "输入框默认文字", // 输入框默认文字
33+
"customJson": "", // 自定义输入指令json数组
34+
"createTime": 0, // 创建时间戳
35+
"sort": 0, // 排序
36+
"hidden": 0 // 是否隐藏(0-显示,1-隐藏)
37+
},
38+
{
39+
"id": 2063,
40+
"botId": "45669202",
41+
"name": "直发指令",
42+
"desc": "指令描述",
43+
"instructionType": 2,
44+
"hintText": "",
45+
"defaultText": "",
46+
"customJson": "",
47+
"createTime": 0,
48+
"sort": 0,
49+
"hidden": 0
50+
},
51+
{
52+
"id": 2064,
53+
"botId": "45669202",
54+
"name": "自定义输入指令",
55+
"desc": "指令描述",
56+
"instructionType": 5,
57+
"hintText": "",
58+
"defaultText": "",
59+
"customJson": "[{\"key\":0,\"type\":\"radio\",\"title\":\"Radio 单选框\",\"propsValue\":{\"label\":\"标签\",\"options\":\"用#分割,比如:北京#上海#天津\"},\"props\":[{\"type\":\"label\",\"name\":\"标签\",\"value\":\"\"},{\"type\":\"options\",\"name\":\"选项\",\"placeholder\":\"用#分割,如:北京#上海#天津\",\"value\":\"\"}],\"id\":\"ykwmdt\"}]",
60+
"createTime": 0,
61+
"sort": 0,
62+
"hidden": 0
63+
}
64+
]
65+
},
66+
"msg": "success" // 返回消息
67+
}
68+
69+
::: details 自定义输入指令部分解释
70+
71+
```jsonc
72+
[{
73+
"key": 0,
74+
"type": "radio",
75+
"title": "Radio 单选框",
76+
"propsValue": { // propsValue是成品,保存了当前组件实际生效的配置数据。用于组件在页面上显示和运行。
77+
"label": "标签",
78+
"options": "用#分割,比如:北京#上海#天津"
79+
},
80+
"props": [{ // prop是蓝图,定义了可以配置什么,以及默认值是什么。用于渲染一个配置界面。
81+
"type": "label", // 类型,一个用于设置“标签”的配置项,有radio-单选框,input-输入框,switch-开关,chexkbox-多选框,textarea-多行输入框,select-选择器
82+
"name": "标签", // 显示给用户的名字叫“标签”
83+
"value": "" // 这个type预定的值,默认空
84+
}, {
85+
"type": "options",
86+
"name": "选项", // 显示给用户的名字叫“选项”
87+
"placeholder": "用#分割,如:北京#上海#天津", // 输入框里的提示文字,通常只有Radio-单选框,Checkbox-多选框,Select-选择器会有这个key
88+
"value": ""
89+
}],
90+
"id": "ykwmdt" // 该表单的id
91+
}]
92+
```
93+
94+
:::
95+
96+
## 创建机器人指令
97+
98+
POST /v1/instruction/create
99+
100+
请求头:
101+
102+
|名称|必须|备注|
103+
|-----|-----|-----|
104+
|token|||
105+
106+
请求体:
107+
108+
```JSONC
109+
{
110+
"name": "名称", // 指令名称
111+
"desc": "描述", // 指令描述
112+
"hintText": "输入框提示文字", // 输入框提示文字
113+
"defaultText": "输入框默认文字", // 输入框默认文字
114+
"type": 1, // 指令类型,1-普通指令,2-直发指令,5-自定义输入指令
115+
"botId": "45669202" // 机器人id
116+
}
117+
```
118+
119+
响应体:
120+
121+
```JSONC
122+
{
123+
"code": 1, // 请求状态码,1为正常
124+
"msg": "success" // 返回消息
125+
}
126+
```
127+
128+
## 编辑机器人指令
129+
130+
POST v1/instruction/edit
131+
132+
请求头:
133+
134+
|名称|必须|备注|
135+
|-----|-----|-----|
136+
|token|||
137+
138+
请求体:
139+
140+
```JSONC
141+
{
142+
"id": 2064, // 已有的指令id
143+
"name": "自定义输入指令", // 指令名称
144+
"desc": "指令描述", // 指令描述
145+
"botId": "45669202", // 机器人id
146+
"customJson": "", // 自定义输入指令(表单指令),只有type为5的自定义输入指令需要,这个是json数组,需转意,具体设置可以看 **获取机器人指令列表(网页控制台)** 对一些表单指令的解释
147+
"type": 5, // 指令类型,1-普通指令,2-直发指令,5-自定义输入指令
148+
"delFlag": 0
149+
}
150+
```
151+
152+
响应体:
153+
154+
```JSONC
155+
{
156+
"code": 1, // 请求状态码,1为正常
157+
"msg": "success" // 返回消息
158+
}
159+
```

0 commit comments

Comments
 (0)