FaqStandardCreate - 新建标准问
更新时间:2025-12-26
API访问域名
| 请求方式 | POST |
|---|---|
| base url | https://keyue.cloud.baidu.com |
| 后缀接口 | /open/v1/api/v2/faq/standard/create |
| Authentication | token为API Key |
说明
无
请求参数
Header参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| Content-Type | string | 是 | 内容类型 | 固定值:application/json |
| token | string | 是 | API KEY | 机器人API KEY。 详细获取方式参考:准备工作 |
| uid | string | 是 | 用户ID | 详细获取方式参考:准备工作 |
| username | string | 是 | 用户名 | 详细获取方式参考:准备工作 |
Body参数
| 名称 | 类型 | 必填 | 中文名 | 说明 |
|---|---|---|---|---|
| question | string | 是 | 问题 | 标准问题 |
| dirId | string | 是 | 所属目录ID | 0 |
| editVersion | integer | 否 | faq版本号 | 新建时默认传0 |
| effect | string | 是 | 生效时间 | 2024-05-28 11:22:28 |
| expire | string | 是 | 过期时间 | 2099-12-31 23:59:59 |
| clarity | integer | 是 | 是否澄清 | 0-否 1-是 |
| status | integer | 是 | 是否生效 | 0-是 1-否 |
| faqType | integer | 是 | faq 类型 | 0-机器人内部知识 1-公共知识 |
| faqI18n | integer | 是 | 是否国际化 | 0-否 1是 |
| exeInstruct | bool | 是 | 是否执行指令 | false/true |
| instructions | array | 是 | 指令列表 | 0 |
| knowledgeLabelValue | Map<String, List |
否 | 知识标签值 | 支持以值的方式传入标签 { "标签名1": ["标签值1", "标签值2"], "标签名2": ["标签值1", "标签值2"] } |
| simQuestions | list[string] | 否 | 相似问题 | |
| templates | list |
否 | 问题模板 | 详见templates子数据 |
| answer | object | 是 | 答案 | 答案对象,answer和channelAnswers至少填其中一个,详见answer子数据 |
| channelAnswers | array | 否 | 渠道答案 | 渠道答案 ,channelAnswers 和 answer 至少填其中一个,详见channelAnswers子数据 |
templates子数据
| 名称 | 类型 | 必填 | 中文名 | 说明 |
|---|---|---|---|---|
| text | string | 否 | 模版文本 | |
| type | string | 否 | 类型 | 当插入词库/实体时,需提供。词库为voca,实体为entity。 |
| id | string | 否 | 名称 | 插入的词库/实体id |
| name | string | 否 | 名称 | |
| nameZH | string | 否 | 中文名 |
answer子数据
| 名称 | 类型 | 必填 | 中文名 | 说明 |
|---|---|---|---|---|
| type | integer | 是 | 类型 | 0,固定 |
| list | array | 是 | 列表 | 列表,详见list子数据 |
list子数据
| 名称 | 类型 | 必填 | 中文名 | 说明 |
|---|---|---|---|---|
| id | string | 是 | ID | UUID |
| type | integer | 是 | 类型 | 1文本、3富文本、4图片链接 |
| text | string | 否 | 文本 | 晴天 |
| url | string | 否 | URL | |
| richText | string | 否 | 富文本 |
channelAnswers子数据
说明:条件答案用法比较复杂,可在网站平台界面创建,结合浏览器的检查-网络功能,查看新建时的参数,理解传参格式和用法
| 名称 | 类型 | 必填 | 中文名 | 说明 |
|---|---|---|---|---|
| answer | object | 否 | 答案 | 答案对象,详见answer子数据 |
| condition | object | 否 | 条件参数 | ,详见condition子数据 |
| exeInstruct | bool | 是 | 是否执行指令 | false/true |
| instructions | array | 是 | 指令列表 | 0 |
answer子数据
| 名称 | 类型 | 必填 | 中文名 | 说明 |
|---|---|---|---|---|
| list | array | 否 | 答案列表 | |
| list \ id | string | 是 | ID | 需要生成一个 UUID |
| list \ type | integer | 是 | 类型 | 1文本、3富文本、4图片链接 |
| list \ text | string | 是 | 答案文本 | |
| list \ url | string | 否 | URL |
condition子数据
| 名称 | 类型 | 必填 | 中文名 | 说明 |
|---|---|---|---|---|
| dateCondition | bool | 否 | 是否时间条件 | 存在对应条件时为 true,否则为 false |
| channelCondition | bool | 否 | 是否渠道条件 | |
| paramsCondition | bool | 否 | 是否参数条件 | |
| expressionSnapshot | object | 否 | 参数表达式 | 详见expressionSnapshot子数据 |
expressionSnapshot子数据
| 名称 | 类型 | 必填 | 中文名 | 说明 |
|---|---|---|---|---|
| id | string | 是 | ||
| name | string | 否 | ||
| type | string | 是 | 正交类型 | and-并且 or-或 |
| value | array | 是 | 条件答案 | |
| value \ id | string | 是 | ||
| value \ logicInterface | string | 是 | 参数类型 | variable-变量 entity-实体 |
| value \ type | string | 是 | 比较类型 | equal-相等 |
| value \ value | array | 是 | 具体参数 | |
| value \ value \ type | string | 是 | 参数类型 | variable-变量 entity-实体 |
| value \ value \ type \ value | string | 是 | 参数名称 |
响应参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | object | 是 | 数据 | 数据对象,详见data 子数据 |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 新建问答标准问题成功 |
data 子数据
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| id | string | 是 | 标准问ID | bfbd5efa-029a-4856-b2e5-59a93e5b6900 |
请求示例
Bash
1curl --location --request POST 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/standard/create' \
2--header 'token: xxxx' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "question": "标准问题",
8 "dirId": "0",
9 "editVersion": 0,
10 "effect": "2025-06-17 18:01:21",
11 "expire": "2099-12-31 23:59:59",
12 "simQuestions": [
13 "相似问题1",
14 "相似问题2"
15 ],
16 "templates": [
17 [
18 {
19 "text": "~引用实体的模板["
20 },
21 {
22 "type": "entity",
23 "id": "H922e277",
24 "character": "手机号码",
25 "nameZh": "手机号码",
26 "name": "H922e277",
27 "children":
28 [
29 {
30 "text": ""
31 }
32 ]
33 },
34 {
35 "text": "]"
36 }
37 ]
38 ],
39 "clarity": 1,
40 "status": 0,
41 "faqType": 0,
42 "faqI18n": 0,
43 "knowledgeLabelValue":{
44 "标签1":["第一个"]
45 },
46 "answer": {
47 "list": [
48 {
49 "id": "answer1",
50 "type": 1,
51 "text": "通用答案",
52 "url": ""
53 }
54 ],
55 "needBackGuide": true,
56 "type": 0
57 },
58 "channelAnswers": [
59 {
60 "answer": [
61 {
62 "id": "channelAnswers1",
63 "type": 1,
64 "text": "进行变量判断的条件答案",
65 "url": "",
66 "audioInfo": {}
67 }
68 ],
69 "needBackGuide": true,
70 "exeInstruct": false,
71 "instructions": [],
72 "condition": {
73 "dateCondition": false,
74 "dateScope": {},
75 "channelCondition": false,
76 "channel": [],
77 "paramsCondition": true,
78 "expressionSnapshot": {
79 "id": "expressionSnapshot1",
80 "name": "",
81 "type": "and",
82 "value": [
83 {
84 "id": "expression1",
85 "logicInterface": "variable",
86 "type": "equal",
87 "value": [
88 {
89 "type": "variable",
90 "value": "str"
91 },
92 {
93 "type": "value",
94 "value": "变量条件"
95 }
96 ]
97 }
98 ]
99 }
100 }
101 }
102 ]
103}'
响应示例
1{
2 "time": 1750748890513,
3 "data": {
4 "id": "58a08fa8-b2eb-4cad-84ad-9b6ed2dee275"
5 },
6 "code": 4002801,
7 "msg": "新建问答标准问题成功"
8}
1
