接口文档
接口文档
版本:v1.0.0
流式对话接口
Base URL: https://keyue.cloud.baidu.com/online
接口后缀:/core/v5/stream/query
请求方式:POST
Authentication:token为API Key
1、Curl 请求示例
1curl --location 'https://keyue.cloud.baidu.com/online/core/v5/stream/query'
2--header 'token: xxxx'
3--header 'Content-Type: application/json'
4--data '{
5 "queryText": "你好",
6 "sessionId": "ecb95fcc-0e49-4ab0-b026-c20a8aac1585",
7 "multimodal": {"fileKey":"xxxx", "type":"1"},
8 "variables": {
9 "homeAddress": "chengdu"
10 }
11}'
2、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | none | agent token,可以在页面集成-API-API Key获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| queryText | string | 否 | 用户问题 | 请求的问题,比如示例中的:你好 |
| sessionId | string | 否 | 会话id | 首轮可以为空(如果首轮传了,后续需要使用首轮传的。),首轮会返回sessionId,后续对话需要使用返回的sessionId。 |
| variables | object | 否 | 变量 | Map格式,key 是变量名称,value是变量值。对话中使用的变量,如果传了会覆盖当前中对话中已有的变量值 |
| topicId | string | 否 | 主题id | 对话测试时使用,执行指定的topic,和nodeId配合使用 |
| engines | array | 否 | 使用的对话引擎 | String类型,FAQ("faq", "知识库-FAQ"),DOC_QA("docQa", "知识库-文档问答"),TASK_FLOW("taskflow", "流程画布"),TASK_BASED("task_based", "意图识别"),为null 或taskflow是支持所有引擎 |
| multimodal | array | 否 | 多模态输入 | 当前支持图片,不能单独使用,需要和queryText 一起传递,目前仅标准版支持 |
| → fileKey | string | 是 | 文件唯一标识 | 使用/open/api/v2/file/upload接口上传后返回的key |
| → type | string | 是 | 文件类型 | 1 :图片,目前只支持图片,上传一张图片 |
| startId | string | 否 | 节点id | 对话测试时使用,执行指定的节点id。和topicId配合使用 |
| channel | string | 否 | 渠道 | 渠道管理中的渠道标识,传递该参数,可以命中FAQ中配置的条件答案 |
| button | object | 否 | 按钮 | 按钮步骤会回复所有按钮的id,名称集合,点击按钮时需传递该字段 |
| → id | string | 是 | 按钮id | |
| → name | string | 是 | 按钮名称 |
3、返回响应
数据结构
名称 |
类型 |
必选 |
中文名 |
说明 |
|---|---|---|---|---|
| sessionId | string | 是 | 会话ID | 用于标识本轮会话的唯一ID |
| queryId | string | 是 | 查询ID | 用于标识本次会话的唯一ID |
| replyStatus | integer | 是 | 回复状态 | 回复状态,默认成功SUCCESS(200, "成功");FAIL(4008001, "失败"); |
| answer | array | 是 | 回答列表 | 包含各个回答块的数组 |
| → chunkId | integer | 是 | 流式chunkId | 流式chunkId |
| → status | string | 是 | 流式返回数据状态 | RUNNING("running");DONE("done"); |
| → topicId | string | 否 | 主题ID | 对应的主题ID |
| → blockId | string | 否 | 区块ID | 对应的区块ID |
| → nodeId | string | 否 | 节点ID | 对应的节点ID |
| → reply | object | 否 | 回复 | 包含回复相关详细信息的对象 |
| → → type | integer | 是 | 回复类型 | 1 (文本)3(富文本)8(列表) |
| → → text | string | 是 | 文本 | 文本/富文本答案 |
| → → textList | array | 否 | 文本列表 | 回复的文本列表 |
| → → buttons | array | 否 | 按钮列表 | replySource是BUTTONS 时该字段有值 |
| → → → id | string | 否 | 按钮id | |
| → → → name | string | 否 | 按钮名称 | |
| → → clarifyGuide | string | 否 | 澄清指南 | 提供澄清相关的指南和信息 |
| → → replySource | string | 是 | 回复来源 | FAQ("faq", "知识库-FAQ"),DOC_QA("docQa", "知识库-文档"),TEXT_REPLY("text", "文本回复"),INTENT_CLARIFY("intentClarify", "意图澄清"),LARGE_MODEL_REPLY("largeModelReply", "大模型回复"),COLLECT_SLOT_ENTITY("collectSlotEntity", "收集槽位实体"),CHITCHAT("chitchat", "闲聊"),UNMATCHED("unmatch", "未匹配固定话术"),SENSITIVE("sensitive", "敏感拒答话术"),SYSTEM("system", "系统异常"),INSTRUCTION("instruction", "指令"); |
| → → showDocumentSource | boolean | 否 | 显示文档源 | 是否显示文档来源 |
| → → documents | array | 是 | 文档 | 知识问答信息,replySource是DOC_QA 该字段有值 |
| → → → document_id | string | 是 | 文档ID | 文档的唯一标识符 |
| → → → document_name | string | 是 | 文档名 | 文档的名称 |
| → → → knowledge_type | string | 是 | 文档类型 | 文档类型:doc 普通文档, web 网页知识 |
| → → → web_url | string | 是 | 文档链接 | 文档链接,当knowledgeType 是 web 时有值 |
| → → → data | array | 是 | 数据 | 文档的数据内容 |
| → → → → segment_id | string | 是 | 段落ID | 段落的唯一标识符 |
| → → → → segment_content | string | 是 | 段落内容 | 段落的文本内容 |
| → → → → score | string | 是 | 得分 | 段落相关性得分 |
| → → → → segment_coord | string | 是 | 段落坐标 | 段落在文档中的位置坐标 |
| → → → → data | array | 是 | 数据 | 段落中的句子数据 |
| → → → → → sentence_id | string | 是 | 句子ID | 句子的唯一标识符 |
| → → → → → sentence_content | string | 是 | 句子内容 | 句子的文本内容 |
| → → → → → score | string | 是 | 得分 | 句子相关性得分 |
| → → docDebug | object | 否 | 文档调试 | 提供文档调试相关信息,replySource是DOC_QA 该字段有值 |
| → → faqSearch | array | 否 | FAQ搜索 | faq 检索信息,replySource是FAQ 该字段有值 |
| → → slotCollectInfo | object | 否 | 槽收集信息 | 收集槽信息 |
| → → → waitCollectResultList | array | 是 | 待收集结果列表 | 列出待收集的结果 |
| → → → → name | string | 是 | 名称 | 待收集的槽名称 |
| → → → → result | string | 是 | 结果 | 已收集的结果 |
| → → → → option | array | 否 | 可选值 | 可选的答案 |
| → → → → optionSize | integer | 否 | 选项数量 | 选项数量 |
| → → → → clarity | string | 否 | 清晰度 | 澄清话术 |
| → → → → inputExample | string | 是 | 输入示例 | 输入的示例 |
| → → → → outputExample | string | 是 | 输出示例 | 输出的示例 |
| → → → hasCollectResultList | array | 是 | 已收集结果列表 | 列出已收集的结果 |
| instruction | object | 否 | 指令 | 发出指令后有值,指令详细信息 Map<String, Map<String, String>>, 外层key为指令标识,value为指令参数map |
| variables | object | 是 | 变量 | Map<String, Object>存储会话期间的各种变量信息 |
| endTime | string | 否 | 结束时间 | 会话结束时间 |
| recommendList | array | 是 | 推荐列表 | 提供可能的操作或信息的推荐列表 |
| rewriteQuery | string | 是 | 重写查询 | 用户输入的重写版本 |
| intent | array | 是 | 意图 | 列出此次会话涉及的意图 |
| → _effect | integer | 是 | 影响 | 表示此意图的效果 |
| → id | string | 是 | ID | 意图的唯一标识符 |
| → name | string | 是 | 名称 | 意图的名称 |
| → description | string | 否 | 描述 | 意图的描述 |
| → agentId | string | 否 | 代理ID | 代理的ID |
| → created | string | 否 | 创建时间 | 意图创建时间 |
| → updated | string | 否 | 更新时间 | 意图最后更新时间 |
| → confidence | float | 是 | 置信度 | 意图识别的置信度 |
| → source | string | 是 | 来源 | 意图识别的来源 |
| → threshold | float | 是 | 阈值 | 意图识别的阈值 |
| → system | boolean | 是 | 系统意图 | 是否为系统预定义的意图 |
| → needClarify | boolean | 是 | 需要澄清 | 是否需要澄清此意图 |
| → alias | string | 否 | 别名 | 意图的别名 |
| → nameZh | string | 是 | 中文名称 | 意图的中文名称 |
| → examples | array | 否 | 示例 | 意图的示例 |
| → hasActiveCopy | boolean | 是 | 活跃副本 | 意图是否有活跃的副本 |
| → templateStr | string | 否 | 模板字符串 | 意图的模板字符串 |
| → createdUserName | string | 否 | 创建者用户名 | 创建此意图的用户的用户名 |
| → createdUserId | string | 否 | 创建者用户ID | 创建此意图的用户的用户ID |
| → lastEditUserName | string | 否 | 最后编辑用户名 | 最后编辑此意图的用户的用户名 |
| → lastEditUserId | string | 否 | 最后编辑用户ID | 最后编辑此意图的用户的用户ID |
| → version | integer | 是 | 版本 | 意图的版本 |
| → industryIntent | boolean | 是 | 行业意图 | 是否为特定行业的意图 |
| → knnExampleStr | string | 是 | KNN示例字符串 | 用于KNN匹配的示例字符串 |
| → extra | object | 否 | 额外信息 | 包含额外信息的对象 |
| → recSource | string | 否 | 推荐来源 | 意图推荐的来源 |
| → noResponse | boolean | 是 | 无响应 | 是否未响应 |
4、返回示例
阻塞式对话接口
Base URL: https://keyue.cloud.baidu.com/online
接口后缀: /core/v5/block/query
请求方式:POST
Authentication:token为API Key
1、Curl 请求示例
1curl --location 'https://keyue.cloud.baidu.com/online/core/v5/block/query'
2--header 'token: xxxx'
3--header 'Content-Type: application/json'
4--data '{
5 "queryText": "你好",
6 "sessionId": "ecb95fcc-0e49-4ab0-b026-c20a8aac1585",
7 "variables": {
8 "homeAddress": "chengdu"
9 }
10}'
2、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | none | agent token,可以在页面集成-API-API Key获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| queryText | string | 否 | 用户问题 | 请求的问题,比如示例中的:你好 |
| sessionId | string | 否 | 会话id | 首轮可以为空(如果首轮传了,后续需要使用首轮传的。),首轮会返回sessionId,后续对话需使用返回的sessionId。 |
| variables | object | 否 | 变量 | Map格式,key 是变量名称,value是变量值。对话中使用的变量,如果传了会覆盖当前中对话中已有的变量值 |
| topicId | string | 否 | 主题id | 对话测试时使用,执行指定的topic,和nodeId配合使用 |
| engines | array | 否 | 使用的对话引擎 | String类型,FAQ("faq", "知识库-FAQ"),DOC_QA("docQa", "知识库-文档问答"),TASK_FLOW("taskflow", "流程画布"),TASK_BASED("task_based", "意图识别"),为null 或taskflow是支持所有引擎 |
| multimodal | array | 否 | 多模态输入 | 当前支持图片,不能单独使用,需要和queryText 一起传递,目前仅标准版支持 |
| → fileKey | string | 是 | 文件唯一标识 | 使用/open/api/v2/file/upload接口上传后返回的key |
| → type | string | 是 | 文件类型 | 1 :图片,目前只支持图片,上传一张图片 |
| startId | string | 否 | 节点id | 对话测试时使用,执行指定的节点id。和topicId配合使用 |
| channel | string | 否 | 渠道 | 渠道管理中的渠道标识,传递该参数,可以命中FAQ中配置的条件答案 |
| button | object | 否 | 按钮 | 按钮步骤会回复所有按钮的id,名称集合,点击按钮时需传递该字段 |
| → id | string | 是 | 按钮id | |
| → name | string | 是 | 按钮名称 |
3、返回响应
返回结果不是上述流式中多次返回的组合,而是一起返回,如下列示例。
数据结构
名称 |
类型 |
必选 |
中文名 |
说明 |
|---|---|---|---|---|
| sessionId | string | 是 | 会话ID | 用于标识本轮会话的唯一ID |
| queryId | string | 是 | 查询ID | 用于标识本次会话的唯一ID |
| replyStatus | integer | 是 | 回复状态 | 回复状态,默认成功SUCCESS(200, "成功");FAIL(4008001, "失败"); |
| answer | array | 是 | 回答列表 | 包含各个回答块的数组 |
| → chunkId | integer | 是 | 流式chunkId | 流式chunkId |
| → status | string | 是 | 流式返回数据状态 | RUNNING("running");DONE("done"); |
| → topicId | string | 否 | 主题ID | 对应的主题ID |
| → blockId | string | 否 | 区块ID | 对应的区块ID |
| → nodeId | string | 否 | 节点ID | 对应的节点ID |
| → reply | object | 否 | 回复 | 包含回复相关详细信息的对象 |
| → → type | integer | 是 | 回复类型 | 1 (文本)3(富文本)8(列表) |
| → → text | string | 是 | 文本 | 文本/富文本答案 |
| → → textList | array | 否 | 文本列表 | 回复的文本列表 |
| → → buttons | array | 否 | 按钮列表 | replySource是BUTTONS 时该字段有值 |
| → → → id | string | 否 | 按钮id | |
| → → → name | string | 否 | 按钮名称 | |
| → → clarifyGuide | string | 否 | 澄清指南 | 提供澄清相关的指南和信息 |
| → → replySource | string | 是 | 回复来源 | FAQ("faq", "知识库-FAQ"),DOC_QA("docQa", "知识库-文档"),TEXT_REPLY("text", "文本回复"),INTENT_CLARIFY("intentClarify", "意图澄清"),LARGE_MODEL_REPLY("largeModelReply", "大模型回复"),COLLECT_SLOT_ENTITY("collectSlotEntity", "收集槽位实体"),CHITCHAT("chitchat", "闲聊"),UNMATCHED("unmatch", "未匹配固定话术"),SENSITIVE("sensitive", "敏感拒答话术"),SYSTEM("system", "系统异常"),INSTRUCTION("instruction", "指令"); |
| → → showDocumentSource | boolean | 否 | 显示文档源 | 是否显示文档来源 |
| → → documents | array | 是 | 文档 | 知识问答信息,replySource是DOC_QA 该字段有值 |
| → → → document_id | string | 是 | 文档ID | 文档的唯一标识符 |
| → → → document_name | string | 是 | 文档名 | 文档的名称 |
| → → → knowledge_type | string | 是 | 文档类型 | 文档类型:doc 普通文档, web 网页知识 |
| → → → web_url | string | 是 | 文档链接 | 文档链接,当knowledgeType 是 web 时有值 |
| → → → data | array | 是 | 数据 | 文档的数据内容 |
| → → → → segment_id | string | 是 | 段落ID | 段落的唯一标识符 |
| → → → → segment_content | string | 是 | 段落内容 | 段落的文本内容 |
| → → → → score | string | 是 | 得分 | 段落相关性得分 |
| → → → → segment_coord | string | 是 | 段落坐标 | 段落在文档中的位置坐标 |
| → → → → data | array | 是 | 数据 | 段落中的句子数据 |
| → → → → → sentence_id | string | 是 | 句子ID | 句子的唯一标识符 |
| → → → → → sentence_content | string | 是 | 句子内容 | 句子的文本内容 |
| → → → → → score | string | 是 | 得分 | 句子相关性得分 |
| → → docDebug | object | 否 | 文档调试 | 提供文档调试相关信息,replySource是DOC_QA 该字段有值 |
| → → faqSearch | array | 否 | FAQ搜索 | faq 检索信息,replySource是FAQ 该字段有值 |
| → → slotCollectInfo | object | 否 | 槽收集信息 | 收集槽信息 |
| → → → waitCollectResultList | array | 是 | 待收集结果列表 | 列出待收集的结果 |
| → → → → name | string | 是 | 名称 | 待收集的槽名称 |
| → → → → result | string | 是 | 结果 | 已收集的结果 |
| → → → → option | array | 否 | 可选值 | 可选的答案 |
| → → → → optionSize | integer | 否 | 选项数量 | 选项数量 |
| → → → → clarity | string | 否 | 清晰度 | 澄清话术 |
| → → → → inputExample | string | 是 | 输入示例 | 输入的示例 |
| → → → → outputExample | string | 是 | 输出示例 | 输出的示例 |
| → → → hasCollectResultList | array | 是 | 已收集结果列表 | 列出已收集的结果 |
| instruction | object | 否 | 指令 | 发出指令后有值,指令详细信息 Map<String, Map<String, String>>, 外层key为指令标识,value为指令参数map |
| variables | object | 是 | 变量 | Map<String, Object>存储会话期间的各种变量信息 |
| endTime | string | 否 | 结束时间 | 会话结束时间 |
| recommendList | array | 是 | 推荐列表 | 提供可能的操作或信息的推荐列表 |
| rewriteQuery | string | 是 | 重写查询 | 用户输入的重写版本 |
| intent | array | 是 | 意图 | 列出此次会话涉及的意图 |
| → _effect | integer | 是 | 影响 | 表示此意图的效果 |
| → id | string | 是 | ID | 意图的唯一标识符 |
| → name | string | 是 | 名称 | 意图的名称 |
| → description | string | 否 | 描述 | 意图的描述 |
| → agentId | string | 否 | 代理ID | 代理的ID |
| → created | string | 否 | 创建时间 | 意图创建时间 |
| → updated | string | 否 | 更新时间 | 意图最后更新时间 |
| → confidence | float | 是 | 置信度 | 意图识别的置信度 |
| → source | string | 是 | 来源 | 意图识别的来源 |
| → threshold | float | 是 | 阈值 | 意图识别的阈值 |
| → system | boolean | 是 | 系统意图 | 是否为系统预定义的意图 |
| → needClarify | boolean | 是 | 需要澄清 | 是否需要澄清此意图 |
| → alias | string | 否 | 别名 | 意图的别名 |
| → nameZh | string | 是 | 中文名称 | 意图的中文名称 |
| → examples | array | 否 | 示例 | 意图的示例 |
| → hasActiveCopy | boolean | 是 | 活跃副本 | 意图是否有活跃的副本 |
| → templateStr | string | 否 | 模板字符串 | 意图的模板字符串 |
| → createdUserName | string | 否 | 创建者用户名 | 创建此意图的用户的用户名 |
| → createdUserId | string | 否 | 创建者用户ID | 创建此意图的用户的用户ID |
| → lastEditUserName | string | 否 | 最后编辑用户名 | 最后编辑此意图的用户的用户名 |
| → lastEditUserId | string | 否 | 最后编辑用户ID | 最后编辑此意图的用户的用户ID |
| → version | integer | 是 | 版本 | 意图的版本 |
| → industryIntent | boolean | 是 | 行业意图 | 是否为特定行业的意图 |
| → knnExampleStr | string | 是 | KNN示例字符串 | 用于KNN匹配的示例字符串 |
| → extra | object | 否 | 额外信息 | 包含额外信息的对象 |
| → recSource | string | 否 | 推荐来源 | 意图推荐的来源 |
| → noResponse | boolean | 是 | 无响应 | 是否未响应 |
4、返回示例
对话结束接口
对话的上下文状态默认保留30分钟,调用该接口可结束对话状态
Base URL: https://keyue.cloud.baidu.com/online
接口后缀: /core/v5/end
请求方式:POST
Authentication:token为API Key
1、Curl 请求示例
1curl --location 'https://keyue.cloud.baidu.com/online/core/v5/end'
2--header 'token: xxxx'
3--header 'Content-Type: application/json'
4--data '{
5 "sessionId": "ecb95fcc-0e49-4ab0-b026-c20a8aac1585"
6}'
2、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | none | agent token,可以在页面集成-API-API Key获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| sessionId | string | 是 | 会话ID | 用于标识本轮会话的唯一ID,传入需要结束对话的sessionId |
3、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 时间戳 |
| data | object | 是 | 数据 | 数据 |
| →end | boolean | 是 | 对话是否结束 | true代表结束对话成功, false代表结束对话失败 |
| code | integer | 是 | 状态码 | 200为成功 |
| msg | string | 是 | 状态信息 | OK为正常 |
4、返回示例
1{
2 "time": 1713927667141,
3 "data": {
4 "end": true
5 },
6 "code": 200,
7 "msg": "OK"
8}
文件上传接口
Base URL: https://keyue.cloud.baidu.com/
接口后缀: /open/api/v2/file/upload
请求方式:POST
Authentication:token为API Key
1、Curl 请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/api/v2/file/upload'
2--header 'token: xxxx'
3--header 'Content-Type: application/json'
4--form 'file=@"/xxx.png"'
2、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | none | agent token,可以在页面集成-API-API Key获取 |
form-data 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| file | File | 是 | 图片文件 |
3、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 时间戳 |
| data | object | 是 | 数据 | 数据 |
| →key | string | 是 | 文件id | |
| →fileName | string | 是 | 文件名称 | |
| code | integer | 是 | 状态码 | 200为成功 |
| msg | string | 是 | 状态信息 | OK为正常 |
4、返回示例
1{
2 "time": 1719386806979,
3 "data": {
4 "key": "xxxxx",
5 "fileName": "对话-0.png"
6 },
7 "code": 200,
8 "msg": "OK"
9}
知识库相关接口
header中添加token、uid、username等信息作为调用者信息
token:agent token,可以在页面集成-API-API Key获取
uid:用户id,记录的操作者id,页面右上角用户信息获取
username:用户名,记录的操作者名称,页面右上角用户信息获取,如果包含中文,需要整个名称使用URLEncoder.encode(originalString, "UTF-8")加码,否则放入不了header中
adminId:租户管理员id,在登录后任意页面刷新,查看 login_checker,可查看到租户对应的 adminId(固定值,不会改变)。
目录
新增目录
1、URL
POST /open/v1/api/v2/directory/create
2、描述
新增知识目录,默认存在默认目录,id = 0
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| name | string | 是 | 名称 | 目录4 |
| parentId | string | 是 | 父级ID | 0,默认目录为0 |
| version | integer | 是 | 版本 | 5,可以根据查询列表获取最新版本号 |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/directory/create' \
2--header 'token: ced7f43f-2e2c-49d4-a265-af0ab3961794' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "name": "目录4",
8 "parentId": "0",
9 "version": 5
10}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716863109583 |
| data | object | 是 | 数据 | 数据 |
| →hasPerm | 否 | |||
| →id | string | 是 | 目录ID | 7e701600-0b67-4752-9eec-11534f0c3e76 |
| →name | string | 是 | 名称 | 目录4 |
| →parentId | string | 是 | 父级ID | 0 |
| →sort | integer | 否 | 排序 | 4 |
| →version | integer | 是 | 版本 | 6 |
| code | integer | 是 | 状态码 | 200为成功 |
| msg | string | 是 | 状态信息 | OK为正常 |
6、返回示例
修改目录
1、URL
POST /open/v1/api/v2/directory/update
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| name | string | 是 | 名称 | 目录6 |
| id | string | 是 | 目录id | |
| parentId | string | 是 | 父级ID | 0 |
| version | integer | 是 | 版本 | 7 |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/directory/update' \
2--header 'token: ced7f43f-2e2c-49d4-a265-af0ab3961794' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "name": "目录6",
8 "id": "714ff909-13ce-4ce9-9bbe-61796f7fbeab",
9 "parentId": "0",
10 "version": 7
11}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716864272456 |
| data | object | 是 | 数据 | |
| →version | integer | 是 | 版本 | 8 |
| code | integer | 是 | 状态码 | 200为成功 |
| msg | string | 是 | 状态信息 |
6、返回示例
删除目录
1、URL
POST /open/v1/api/v2/directory/delete
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| id | string | 是 | 目录id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/directory/delete' \
2--header 'token: ced7f43f-2e2c-49d4-a265-af0ab3961794' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{"id":"7e701600-0b67-4752-9eec-11534f0c3e76"}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716864508851 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200为成功 |
| msg | string | 是 | 状态信息 | OK为正常 |
6、返回示例
查询目录列表
1、URL
GET /open/v1/api/v2/directory
2、描述
查询目录列表,Parameter参数 ps 可直接设置成 999 等较大数,返回所有
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Parameter 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| ps | string | 否 | 数量 | 一页多少数量 |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/directory?ps=999' \
2--header 'token: ced7f43f-2e2c-49d4-a265-af0ab3961794' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716864854538 |
| data | array | 是 | 数据 | 数据 |
| →hasPerm | null | 否 | ||
| →id | string | 是 | ID | 714ff909-13ce-4ce9-9bbe-61796f7fbeab |
| →name | string | 是 | 名称 | 目录6 |
| →parentId | string | 是 | 父级ID | 0 |
| →sort | integer | 否 | 排序 | 2 |
| →version | integer | 是 | 版本 | 8 |
| code | integer | 是 | 状态码 | 200为成功 |
| msg | string | 是 | 状态信息 | OK为正常 |
6、返回示例
FAQ知识
FAQ创建
1、URL
POST /open/v1/api/v2/faq/standard/create
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| answer | object | 是 | 答案 | 答案对象 |
| →list | array | 是 | 列表 | 列表 |
| →→id | string | 是 | ID | UUID |
| →→type | integer | 是 | 类型 | 1文本、3富文本、4图片链接 |
| →→text | string | 否 | 文本 | 晴天 |
| →→url | string | 否 | URL | |
| →→richText | string | 否 | 富文本 | |
| →type | integer | 是 | 类型 | 0,固定 |
| question | string | 是 | 问题 | 今天天气怎么样呢 |
| dirId | string | 是 | 目录ID | 0 |
| expire | string | 是 | 过期时间 | 2099-12-31 23:59:59 |
| effect | string | 是 | 生效时间 | 2024-05-28 11:22:28 |
| channelAnswers | array | 否 | 渠道答案 | [],固定值 |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/standard/create' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "answer": {
8 "list": [
9 {
10 "id": "GW_h99V4uKrtAmY_r2J2NnPnjj-OasCgRtoA",
11 "type": 1,
12 "text": "没有",
13 "url": "",
14 "richText": ""
15 }
16 ],
17 "type": 0
18 },
19 "question": "你吃饭了没2",
20 "dirId": "0",
21 "channelAnswers": [],
22 "expire": "2099-12-31 23:59:59",
23 "effect": "2024-06-04 17:05:05"
24}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 新建问答标准问题成功 |
6、返回示例
FAQ修改
1、URL
POST /open/v1/api/v2/faq/standard/update
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| answer | object | 是 | 答案 | 答案对象 |
| →list | array | 是 | 列表 | 列表 |
| →→id | string | 是 | ID | UUID |
| →→type | integer | 是 | 类型 | 1文本、3富文本、4图片链接 |
| →→text | string | 否 | 文本 | 晴天 |
| →→url | string | 否 | URL | |
| →→richText | string | 否 | 富文本 | |
| →type | integer | 是 | 类型 | 0,固定 |
| id | string | 是 | faq id | |
| question | string | 是 | 问题 | 今天天气怎么样呢 |
| dirId | string | 是 | 目录ID | 0 |
| expire | string | 是 | 过期时间 | 2099-12-31 23:59:59 |
| effect | string | 是 | 生效时间 | 2024-05-28 11:22:28 |
| channelAnswers | array | 否 | 渠道答案 | [],固定值 |
| editVersion | int | 是 | faq版本号 | list或者detail接口获取 |
4、请求示例
1curl --location 'https://keyue-test.cloud.baidu.com/open/v1/api/v2/faq/standard/update' \
2--header 'token: c7a8c98c-c16d-47ee-a24e-7cbd6177932f' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "answer": {
8 "list": [
9 {
10 "id": "GW_h99V4uKrtAmY_r2J2NnPnjj-OasCgRtoA",
11 "type": 1,
12 "text": "hahahahaha",
13 "url": "",
14 "richText": ""
15 }
16 ],
17 "type": 0
18 },
19 "id": "7999df17-f501-49ba-b75d-bda3d0640d43",
20 "question": "你吃饭了没4",
21 "dirId": "0",
22 "expire": "2099-12-31 23:59:59",
23 "effect": "2024-06-04 17:05:05",
24 "channelAnswers": [],
25 "editVersion": 5
26}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 编辑问答标准问题成功 |
6、返回示例
FAQ删除
1、URL
POST /open/v1/api/v2/faq/standard/delete
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| id | string | 是 | faq Id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/standard/delete' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "id": "edb92440-2bbb-4ba4-9019-8008c003707f"
8}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 删除问答标准问题成功 |
6、返回示例
FAQ列表
1、URL
GET /open/v1/api/v2/faq/standard
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Parameter 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| orderBy | string | 是 | 排序依据 | lastEditTime |
| order | string | 是 | 排序方式 | desc |
| dirId | string | 是 | 目录ID | 0 |
| pn | integer | 是 | 页码 | 1 |
| ps | integer | 是 | 每页数量 | 20 |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/standard?orderBy=lastEditTime&order=desc&dirId=0&pn=1&ps=20' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1717036810964 |
| data | object | 是 | 数据 | 数据对象 |
| →total | integer | 是 | 总数 | 1 |
| →pn | integer | 是 | 页码 | 1 |
| →ps | integer | 是 | 每页数量 | 20 |
| →list | array | 是 | 列表 | 列表 |
| →→id | string | 是 | ID | 6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6 |
| →→question | string | 是 | 问题 | hahahah |
| →→answer | object | 是 | 答案 | 答案对象 |
| →→→list | array | 是 | 列表 | 列表 |
| →→→→id | string | 是 | ID | niIUTdLzPJhedJde_rPOiZsuhxMc68n6Czvz |
| →→→→type | integer | 是 | 类型 | 1 |
| →→→→text | string | 是 | 文本 | hehehe |
| →→→→url | string | 否 | URL | "" |
| →→→→richText | string | 否 | 富文本 | "" |
| →→→type | integer | 是 | 类型 | 0 |
| →→status | integer | 是 | 状态 | 0 |
| →→dirId | string | 是 | 目录ID | 0 |
| →→tags | array | 否 | 标签 | [] |
| →→createdUsername | string | 否 | 创建用户名 | pnstest5 |
| →→createdUserId | string | 否 | 创建用户ID | cf7d9692703d45d1b5517a30ab3efa53 |
| →→lastEditUsername | string | 否 | 最后编辑用户名 | pnstest5 |
| →→lastEditUserId | string | 否 | 最后编辑用户ID | cf7d9692703d45d1b5517a30ab3efa53 |
| →→lastEditTime | string | 否 | 最后编辑时间 | 2024-05-30 10:37:08 |
| →→updated | string | 否 | 更新时间 | 2024-05-30 10:37:08 |
| →→created | string | 否 | 创建时间 | 2024-05-30 10:37:08 |
| →→editVersion | integer | 是 | 编辑版本 | 0 |
| →→expire | string | 是 | 过期时间 | 2099-12-31 23:59:59 |
| →→effect | string | 是 | 生效时间 | 2024-05-30 10:37:01 |
| →→channelAnswers | array | 否 | 渠道答案 | [] |
| →→channel | string | 否 | 渠道 | "" |
| →→hasActiveCopy | boolean | 否 | 有活动副本 | false |
| →→isActiveHook | integer | 否 | 是否活跃挂钩 | 0 |
| →→instruction | null | 否 | 指令 | null |
| →→interrupted | boolean | 是 | 中断 | true |
| →→exeInstruct | boolean | 是 | 执行指令 | false |
| →→instructions | null | 否 | 指令 | null |
| →→suggestList | array | 否 | 建议列表 | [] |
| →totalPn | integer | 是 | 总页数 | 1 |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
FAQ详情
1、URL
GET /open/v1/api/v2/faq/standard/detail
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Parameter 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| id | string | 是 | faq Id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/standard/detail?id=6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1717037136976 |
| data | object | 是 | 数据 | 数据对象 |
| →id | string | 是 | ID | 6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6 |
| →question | string | 是 | 问题 | hahahah |
| →answer | object | 是 | 答案 | 答案对象 |
| →→list | array | 是 | 列表 | 列表 |
| →→→id | string | 是 | ID | niIUTdLzPJhedJde_rPOiZsuhxMc68n6Czvz |
| →→→type | integer | 是 | 类型 | 1 |
| →→→text | string | 是 | 文本 | hehehe |
| →→→url | string | 否 | URL | "" |
| →→→richText | string | 否 | 富文本 | "" |
| →→type | integer | 是 | 类型 | 0 |
| →status | integer | 是 | 状态 | 0 |
| →dirId | string | 是 | 目录ID | 0 |
| →tags | array | 否 | 标签 | [] |
| →createdUsername | string | 否 | 创建用户名 | pnstest5 |
| →createdUserId | string | 否 | 创建用户ID | cf7d9692703d45d1b5517a30ab3efa53 |
| →lastEditUsername | string | 否 | 最后编辑用户名 | pnstest5 |
| →lastEditUserId | string | 否 | 最后编辑用户ID | cf7d9692703d45d1b5517a30ab3efa53 |
| →lastEditTime | string | 否 | 最后编辑时间 | 2024-05-30 10:37:08 |
| →updated | string | 否 | 更新时间 | 2024-05-30 10:37:08 |
| →created | string | 否 | 创建时间 | 2024-05-30 10:37:08 |
| →editVersion | integer | 是 | 编辑版本 | 0 |
| →expire | string | 是 | 过期时间 | 2099-12-31 23:59:59 |
| →effect | string | 是 | 生效时间 | 2024-05-30 10:37:01 |
| →channelAnswers | array | 否 | 渠道答案 | [] |
| →channel | string | 否 | 渠道 | "" |
| →hasActiveCopy | boolean | 否 | 有活动副本 | false |
| →isActiveHook | integer | 否 | 是否活跃挂钩 | 0 |
| →instruction | null | 否 | 指令 | null |
| →interrupted | boolean | 是 | 中断 | true |
| →exeInstruct | boolean | 是 | 执行指令 | false |
| →instructions | array | 否 | 指令 | [] |
| →suggestList | array | 否 | 建议列表 | [] |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
FAQ失效
1、URL
POST /open/v1/api/v2/faq/expire
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| status | integer | 是 | 状态 | 0生效;1失效 |
| id | string | 是 | faq Id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/expire' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "status": 0,
8 "id": "6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6"
9}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 生效问答标准问题成功 |
6、返回示例
FAQ相似问创建
1、URL
POST /open/v1/api/v2/faq/extend/create
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| questions | array | 是 | 相似问题 | ["相似问1"] 相似问列表 |
| faqId | string | 是 | faq Id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/extend/create' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "questions": [
8 "相似问1"
9 ],
10 "faqId": "6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6"
11}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 新建问答扩展问成功 |
6、返回示例
FAQ相似问修改
1、URL
POST open/v1/api/v2/faq/extend/update
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| faqId | string | 是 | faq Id | |
| question | string | 是 | 问题 | 哈哈哈哈yes |
| id | string | 是 | 相似问id | |
| editVersion | integer | 是 | 编辑版本 | 0 |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/extend/update' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "faqId": "6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6",
8 "question": "哈哈哈哈yes",
9 "id": "2c93b68a-22d3-45db-85dc-49eb4713d47c",
10 "editVersion": 0
11}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 编辑问答扩展问成功 |
6、返回示例
FAQ相似问列表
1、URL
GET /open/v1/api/v2/faq/extend
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Parameter 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| pn | integer | 是 | 页码 | 1 |
| ps | integer | 是 | 每页数量 | 5 |
| keyword | string | 否 | 关键字 | "" |
| faqId | string | 是 | faq Id |
4、请求示例
1curl --location --request GET 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/extend?pn=1&ps=5&keyword=&faqId=6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "faqId": "6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6",
8 "question": "哈哈哈哈yes",
9 "id": "2c93b68a-22d3-45db-85dc-49eb4713d47c",
10 "editVersion": 0
11}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1717038228597 |
| data | object | 是 | 数据 | 数据对象 |
| →all | integer | 是 | 全部 | 2 |
| →total | integer | 是 | 总数 | 2 |
| →pn | integer | 是 | 页码 | 1 |
| →ps | integer | 是 | 每页数量 | 5 |
| →list | array | 是 | 列表 | 列表 |
| →→id | string | 是 | ID | 2c93b68a-22d3-45db-85dc-49eb4713d47c |
| →→question | string | 是 | 问题 | 哈哈哈哈yes |
| →→faqId | string | 是 | FAQ ID | 6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6 |
| →→created | string | 是 | 创建时间 | 2024-05-30 10:56:28 |
| →→updated | string | 是 | 更新时间 | 2024-05-30 10:56:52 |
| →→editVersion | integer | 是 | 编辑版本 | 1 |
| →→hasActiveCopy | boolean | 否 | 有活动副本 | false |
| →→id | string | 是 | ID | fd14e1ef-b4a8-47b4-905e-ac0a2eb7b8dc |
| →→question | string | 是 | 问题 | 相似问1 |
| →→faqId | string | 是 | FAQ ID | 6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6 |
| →→created | string | 是 | 创建时间 | 2024-05-30 10:53:53 |
| →→updated | string | 是 | 更新时间 | 2024-05-30 10:53:53 |
| →→editVersion | integer | 是 | 编辑版本 | 0 |
| →→hasActiveCopy | boolean | 否 | 有活动副本 | false |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
FAQ相似问删除
1、URL
POST /open/v1/api/v2/faq/extend/delete
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| faqId | string | 是 | faq id | |
| id | string | 是 | 相似问id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/extend/delete' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "faqId": "6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6",
8 "id": "3171daa7-288c-4734-ae28-c7ae3251ffb7"
9}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 删除问答扩展问成功 |
6、返回示例
FAQ大模型生成相似问
1、URL
POST /open/v1/api/v2/faq/llm/similarQuestion/generate
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| standardQuestion | string | 是 | 标准问题 | 今天啥天气啊 |
| generateSimilarQuestionSize | string | 是 | 生成相似问题数量 | 5 |
| customSimilarQuestionsList | array | 是 | 用户已有相似问列表 | ["请问今天天气如何?", "今天是什么天气情况?"] |
| dirId | string | 是 | 目录ID | 0 |
| faqId | string | 是 | faq Id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/llm/similarQuestion/generate' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "standardQuestion": "今天啥天气啊",
8 "generateSimilarQuestionSize": "5",
9 "customSimilarQuestionsList": [
10 "请问今天天气如何?",
11 "今天是什么天气情况?"
12 ],
13 "dirId": "0",
14 "faqId": "6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6"
15}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1717039917588 |
| data | array | 是 | 数据 | 数据列表 |
| →repeatFlag | boolean | 是 | 重复标志 | false |
| →queryStr | string | 是 | 查询字符串 | 今天天气怎么样啊? |
| →repeatList | null | 否 | 重复列表 | null |
| →similarFlag | boolean | 是 | 相似标志 | false |
| →similarList | array | 否 | 相似列表 | [] |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
FAQ模板创建
1、URL
POST /open/v1/api/v2/faq/template/create
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| faqId | string | 是 | faqId | |
| template | array | 是 | 模板 | 模板列表 |
| →text | string | 是 | 文本 | [W:0-10] |
| →name | string | 是 | 名称 | 元素英文名 |
| →type | string | 是 | 类型 | entity实体、voca词库 |
| →nameZh | string | 是 | 中文名 | 元素中文名 |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/template/create' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "faqId": "6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6",
8 "template": [
9 {
10 "text": "[W:0-10]["
11 },
12 {
13 "name": "y05d03cc",
14 "type": "entity",
15 "nameZh": "人名"
16 },
17 {
18 "text": "]"
19 }
20 ]
21}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 新建问答模板成功 |
6、返回示例
FAQ模板编辑
1、URL
POST /open/v1/api/v2/faq/template/update
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| faqId | string | 是 | faq Id | |
| template | array | 是 | 模板 | 模板列表 |
| →text | string | 是 | 文本 | [W:0-10] |
| →name | string | 是 | 名称 | 元素英文名 |
| →type | string | 是 | 类型 | entity实体、voca词库 |
| →nameZh | string | 是 | 中文名 | 元素中文名 |
| id | string | 是 | 模板id | |
| version | string | 是 | 版本号 | 当前版本值,可通过list接口查看 |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/template/update' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "faqId": "6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6",
8 "template": [
9 {
10 "text": "[W:0-5]["
11 },
12 {
13 "name": "y05d03cc",
14 "type": "entity",
15 "nameZh": "人名",
16 "character": "人名"
17 },
18 {
19 "text": "]"
20 }
21 ],
22 "id": "b213f7f0-3a35-4110-9e59-8def695c8d46",
23 "version": 3
24}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 编辑问答模板成功 |
6、返回示例
FAQ模板列表
1、URL
GET /open/v1/api/v2/faq/template
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| pn | integer | 是 | 页码 | 1 |
| ps | integer | 是 | 每页数量 | 5 |
| keyword | string | 否 | 关键字 | "" |
| faqId | string | 是 | faqId |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/faq/template?pn=1&ps=5&keyword=&faqId=6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6' \
2--header 'token: a9dcb88a-4fc0-4ae0-a103-3578bdb90e62' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1717053723895 |
| data | object | 是 | 数据 | 数据对象 |
| →all | integer | 是 | 全部 | 2 |
| →total | integer | 是 | 总数 | 2 |
| →pn | integer | 是 | 页码 | 1 |
| →ps | integer | 是 | 每页数量 | 5 |
| →list | array | 是 | 列表 | 列表 |
| →→id | string | 是 | ID | 14fefaeb-ab24-43ac-8741-daa019446169 |
| →→faqId | string | 是 | FAQ ID | 6f4b1206-bdf6-42e0-94a8-bb57d2a5a4e6 |
| →→template | string | 是 | 模板 | [W:0-5] |
| →→created | string | 是 | 创建时间 | 2024-05-30 15:09:16 |
| →→update | string | 是 | 更新时间 | 2024-05-30 15:09:16 |
| →→version | integer | 是 | 版本 | 0 |
| →→hasActiveCopy | boolean | 否 | 有活动副本 | false |
| →→templateList | array | 是 | 模板列表 | 模板列表 |
| →→→text | string | 是 | 文本 | [W:0-5] |
| →→→id | null | 否 | ID | null |
| →→→name | null | 否 | 名称 | null |
| →→→nameZh | null | 否 | 中文名 | null |
| →→→type | null | 否 | 类型 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
文档知识
文档上传
1、URL
POST /open/v1/api/v2/task/create/llm_document_import
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Parameter 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| dirId | string | 是 | 目录Id | 上传文档到对应目录下 |
Body 参数(form-data)
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| file | file | 是 | 文档 | |
| taskExtend | string | 否 | 文档训练参数 | 为空代表"{}":自动分段与数据清洗。 有值代表: 1、分段标识符split_by:换行切分punc、标点切分wrap 2、分段最大长度chunk_size(200-800) 3、分段重叠比overlap_proportion(0-20) 4、文本预处理(删除连续空格、换行、制表符):pre_handle_text 5、文本预处理(删除目录、页眉、页脚):pre_handle_directory |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/task/create/llm_document_import?dirId=0' \
2--header 'token: e9ed5f3c-b144-4186-ad70-5fcff1f4d94a' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--form 'file=@"/Users/jiangkang/Desktop/jiangkang/照片&证件材料/话费发票/2024年3月话费.pdf"' \
7--form 'taskExtend="{\"split_by\":\"wrap\",\"chunk_size\":700,\"overlap_proportion\":10,\"pre_handle_text\":true,\"pre_handle_directory\":false}"'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1717469424958 |
| data | object | 是 | 数据 | 数据对象 |
| →id | string | 是 | 文档id | |
| →agentId | string | 是 | ||
| →agentName | string | 是 | ||
| →agentType | integer | 是 | ||
| →userId | string | 是 | uid | |
| →userName | string | 是 | username | |
| →created | string | 是 | ||
| →updated | string | 是 | ||
| →module | string | 是 | ||
| →taskType | string | 是 | ||
| →taskStatus | integer | 是 | ||
| →taskResult | null | 否 | ||
| →errorMsg | null | 否 | ||
| →filePath | string | 是 | 文件路径 | Ym9zXzVhMzRlZDdhLTk0MjEtNGEzNy05MzQ1LWMzNWZmODhiZjBjNg== |
| →fileUrl | null | 否 | 文件URL | null |
| →taskUrl | string | 是 | 任务URL | /api/v2/llm/document/import |
| →deleted | integer | 是 | 是否删除 | 0 |
| →reportFilePath | null | 否 | 报告文件路径 | null |
| →reportFileUrl | null | 否 | 报告文件URL | null |
| →taskExtend | string | 是 | 任务扩展 | {"split_by":"wrap","chunk_size":700,"overlap_proportion":10,"pre_handle_text":true,"pre_handle_directory":false} |
| →commonExtend | null | 否 | 通用扩展 | null |
| →tenantId | string | 是 | 租户ID | 3156952326602753 |
| →appName | null | 否 | 应用名称 | null |
| →platform | string | 是 | 平台 | NGD |
| →requestSource | string | 是 | 请求来源 | UNIT |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
文档删除
1、URL
POST /open/v1/api/v2/llm/document/batchDelete
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| documentIds | array | 是 | 文档ID列表 | ["6c0cb880-f7cc-43f5-9805-a0395f48eb36"] |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/document/batchDelete' \
2--header 'token: e9ed5f3c-b144-4186-ad70-5fcff1f4d94a' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "documentIds": [
8 "6c0cb880-f7cc-43f5-9805-a0395f48eb36"
9 ]
10}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | ok |
6、返回示例
文档编辑
1、URL
POST /open/v1/api/v2/llm/document/batchUpdate
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| dataList | array | 是 | 数据列表 | 数据列表 |
| →id | string | 是 | 文档id | |
| →publishTime | string | 否 | 发布时间 | 2024-06-04 04:04:04 |
| →effectStartTime | string | 否 | 生效开始时间 | 与结束时间同时存在2000-01-01 00:00:00 |
| →effectEndTime | string | 否 | 生效结束时间 | 与开始时间同时存在2099-12-31 23:59:59 |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/document/batchUpdate' \
2--header 'token: e9ed5f3c-b144-4186-ad70-5fcff1f4d94a' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "dataList": [
8 {
9 "id": "365bc961-de26-4c8b-95e9-380ce819887d",
10 "publishTime": "2024-06-04 04:04:04",
11 "effectStartTime": "2000-01-01 00:00:00",
12 "effectEndTime": "2099-12-31 23:59:59"
13 }
14 ]
15}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | ok |
6、返回示例
文档重新学习
1、URL
POST /open/v1/api/v2/llm/document/batchRetrain
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| documentIds | array | 是 | 文档ID列表 | ["6c0cb880-f7cc-43f5-9805-a0395f48eb36"] |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/document/batchRetrain' \
2--header 'token: e9ed5f3c-b144-4186-ad70-5fcff1f4d94a' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "documentIds": [
8 "6c0cb880-f7cc-43f5-9805-a0395f48eb36"
9 ]
10}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | ok |
6、返回示例
文档下载
1、URL
POST /open/v1/api/v2/llm/document/download
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| fileKey | string | 是 | 文件key | detail或则list接口获取 |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/document/download?fileKey=Ym9zXzc5MDVlNmVkLWQzOGEtNGI5YS1iNTZkLWNmNTVlMDQwMzg0Zg%3D%3D' \
2--header 'token: e9ed5f3c-b144-4186-ad70-5fcff1f4d94a' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5'
5、返回响应
6、返回示例
知识增强
1、URL
POST /open/v1/api/v2/llm/document/enhancement
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Parameter 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| type | string | 是 | 类型 | 固定值:document |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| enhanceIds | array | 是 | 文档ID列表 | ["6c0cb880-f7cc-43f5-9805-a0395f48eb36"] |
| knowledgeType | string | 是 | 类型 | document |
| enhancement | int | 是 | 学习类型 | 0取消增强,1开启增强,2失败重新开启增强 |
| adminId | string | 是 | 租户管理者id | 48c93c8a53fd47c1bb7a130417531fd9 |
| target | string | 是 | 操作类型 | submit |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/document/enhancement?type=document' \
2--header 'token: cdeaa589-2934-478b-9fdd-9a2b00a74124' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "enhanceIds": [
8 "58420e51-0d1f-4e73-9346-f05c3c401604"
9 ],
10 "knowledgeType": "document",
11 "enhancement": 1,
12 "adminId": "48c93c8a53fd47c1bb7a130417531fd9",
13 "target": "submit"
14}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | ok |
6、返回示例
分段设置
1、URL
POST /open/v1/api/v2/llm/document/splitter
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| documentIds | array | 是 | 文档ID列表 | ["58420e51-0d1f-4e73-9346-f05c3c401604"] |
| taskExtend | string | 否 | 文档训练参数 | 为空代表"{}":自动分段与数据清洗。 有值代表: 1、分段标识符split_by:换行切分punc、标点切分wrap 2、分段最大长度chunk_size(200-800) 3、分段重叠比overlap_proportion(0-20) 4、文本预处理(删除连续空格、换行、制表符):pre_handle_text 5、文本预处理(删除目录、页眉、页脚):pre_handle_directory |
| adminId | string | 是 | 租户管理者id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/document/splitter' \
2--header 'token: cdeaa589-2934-478b-9fdd-9a2b00a74124' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "documentIds": [
8 "58420e51-0d1f-4e73-9346-f05c3c401604"
9 ],
10 "taskExtend": "{\"split_by\":\"punc\",\"chunk_size\":700,\"overlap_proportion\":10,\"pre_handle_text\":true,\"pre_handle_directory\":true}",
11 "adminId": "48c93c8a53fd47c1bb7a130417531fd9"
12}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | ok |
6、返回示例
Web知识
添加Web知识
1、URL
POST /open/v1/api/v2/llm/web/import
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| webUrls | array | 是 | url列表 | 多个url使用换行符分割,最多100个 |
| refresh | int | 是 | 刷新频率/天 | 0-100 |
| taskExtend | string | 是 | 文档训练参数 | 为空代表"{}":自动分段与数据清洗。 有值代表: 1、分段标识符split_by:换行切分punc、标点切分wrap 2、分段最大长度chunk_size(200-800) 3、分段重叠比overlap_proportion(0-20) 4、文本预处理(删除连续空格、换行、制表符):pre_handle_text 5、文本预处理(删除目录、页眉、页脚):pre_handle_directory |
| dirId | string | 是 | 目录id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/web/import' \
2--header 'token: cdeaa589-2934-478b-9fdd-9a2b00a74124' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "webUrls": [
8 "https://www.baidu.com"
9 ],
10 "refresh": 1,
11 "taskExtend": "{}",
12 "dirId": "0"
13}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | [] |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
编辑Web知识
1、URL
POST /open/v1/api/v2/llm/web/update
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| idList | array | 是 | id列表 | 知识id列表 |
| refresh | int | 是 | 刷新频率/天 | 0-100 |
| taskExtend | string | 是 | 文档训练参数 | 为空代表"{}":自动分段与数据清洗。 有值代表: 1、分段标识符split_by:换行切分punc、标点切分wrap 2、分段最大长度chunk_size(200-800) 3、分段重叠比overlap_proportion(0-20) 4、文本预处理(删除连续空格、换行、制表符):pre_handle_text 5、文本预处理(删除目录、页眉、页脚):pre_handle_directory |
| adminId | string | 是 | 租户管理者id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/web/update' \
2--header 'token: cdeaa589-2934-478b-9fdd-9a2b00a74124' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "idList": [
8 "95570780-7ef4-4c8f-8926-3cf6d900894c"
9 ],
10 "refresh": 6,
11 "taskExtend": "{\"split_by\":\"punc\",\"chunk_size\":700,\"overlap_proportion\":10,\"pre_handle_text\":true,\"pre_handle_directory\":true}",
12 "adminId": "48c93c8a53fd47c1bb7a130417531fd9"
13}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
Web知识列表
1、URL
GET /open/v1/api/v2/llm/web/list
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Parameter 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| pn | integer | 是 | 页码 | 1 |
| ps | integer | 是 | 每页数量 | 5 |
| keyword | string | 否 | 关键字 | "" |
| dirId | string | 是 | 目录id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/web/list?keyword=&dirId=0&pn=1&ps=20' \
2--header 'token: cdeaa589-2934-478b-9fdd-9a2b00a74124' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1717499666293 |
| data | object | 是 | 数据 | 数据对象 |
| →total | integer | 是 | 总数 | 1 |
| →pn | integer | 是 | 页码 | 1 |
| →ps | integer | 是 | 每页数量 | 20 |
| →list | array | 是 | 列表 | 列表 |
| →→_effect | integer | 是 | 生效 | 0 |
| →→agentId | string | 是 | ||
| →→id | string | 是 | web知识id | |
| →→name | string | 是 | 名称 | http://fgahjfgah.com |
| →→size | string | 否 | 大小 | 146.0B |
| →→wordNumber | string | 是 | 字数 | 0 |
| →→learnStatus | integer | 是 | 学习状态 | -1学习失败; 0学习中; 1学习成功; 2知识增强中; 3抓取中; -2抓取失败 |
| →→dispatcherStatus | integer | 是 | ||
| →→fileKey | null | 否 | 文件密钥 | null |
| →→modelId | string | 是 | ||
| →→modelFileKey | null | 否 | ||
| →→datasetId | string | 是 | 数据集ID | 1 |
| →→dirId | string | 是 | 目录ID | 0 |
| →→updated | string | 是 | 更新时间 | 2024-06-04 16:08:41 |
| →→created | string | 是 | 创建时间 | 2024-06-04 16:08:41 |
| →→createdUserId | string | 是 | 创建用户ID | e1befa4f6e464e24930eba7fc92dd5c2 |
| →→createdUsername | string | 是 | 创建用户名 | wyl_test7 |
| →→lastEditId | string | 是 | 最后编辑ID | e1befa4f6e464e24930eba7fc92dd5c2 |
| →→lastEditUsername | string | 是 | 最后编辑用户名 | wyl_test7 |
| →→errorMsg | string | 否 | 错误信息 | 模型训练超时:3600s |
| →→type | integer | 是 | 类型 | 2 |
| →→available | integer | 是 | 可用性 | 0文档知识; 1文档片段; 2网页知识 |
| →→labels | null | 否 | 标签 | null |
| →→labelList | array | 否 | 标签列表 | [] |
| →→paramsJson | string | 是 | 参数JSON | {} |
| →→jobId | string | 是 | ||
| →→knowledgeEnhancement | integer | 否 | 知识增强 | 0:未增强,1:增强,2:增强但失败 |
| →→effectStartTime | string | 是 | 生效开始时间 | 2000-01-01 00:00:00 |
| →→effectEndTime | string | 是 | 生效结束时间 | 2099-12-31 23:59:59 |
| →→publishTime | null | 否 | 发布时间 | null |
| →→learntTime | null | 否 | 学习时间 | null |
| →→enhanceMessage | null | 否 | 增强信息 | null |
| →→enhanceState | integer | 否 | 增强状态 | 0 |
| →→webUrl | string | 否 | 网页URL | http://fgahjfgah.com |
| →→refresh | integer | 否 | 刷新 | 0 |
| →→refreshTime | null | 否 | 刷新时间 | null |
| →→knowledgeEnhancementFromJson | boolean | 否 | ||
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
更新Web知识
1、URL
POST /open/v1/api/v2/llm/web/refresh
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| idList | array | 是 | id列表 | 知识id列表 |
| adminId | string | 是 | 租户管理者id |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/web/refresh' \
2--header 'token: cdeaa589-2934-478b-9fdd-9a2b00a74124' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "idList": [
8 "95570780-7ef4-4c8f-8926-3cf6d900894c"
9 ],
10 "adminId": "48c93c8a53fd47c1bb7a130417531fd9"
11}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
Web知识增强
1、URL
POST /open/v1/api/v2/llm/document/enhancement
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Parameter 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| type | string | 是 | 类型 | 固定值,document |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| enhanceIds | array | 是 | 文档ID列表 | ["6c0cb880-f7cc-43f5-9805-a0395f48eb36"] |
| knowledgeType | string | 是 | 类型 | document |
| enhancement | int | 是 | 学习类型 | 0取消增强,1开启增强,2失败重新开启增强 |
| adminId | string | 是 | 租户管理者id | 48c93c8a53fd47c1bb7a130417531fd9 |
| target | string | 是 | 操作类型 | submit |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/document/enhancement?type=document' \
2--header 'token: cdeaa589-2934-478b-9fdd-9a2b00a74124' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "enhanceIds": [
8 "95570780-7ef4-4c8f-8926-3cf6d900894c"
9 ],
10 "knowledgeType": "document",
11 "enhancement": 1,
12 "adminId": "48c93c8a53fd47c1bb7a130417531fd9",
13 "target": "submit"
14}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
删除Web知识
1、URL
POST /open/v1/api/v2/llm/document/batchDelete
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| documentIds | array | 是 | 文档ID列表 | ["6c0cb880-f7cc-43f5-9805-a0395f48eb36"] |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/document/batchDelete' \
2--header 'token: cdeaa589-2934-478b-9fdd-9a2b00a74124' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "documentIds": [
8 "95570780-7ef4-4c8f-8926-3cf6d900894c"
9 ]
10}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
Web知识重新学习
1、URL
POST /open/v1/api/v2/llm/document/batchRetrain
2、描述
3、请求参数
Header 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | 固定值:application/json | |
| uid | string | 是 | 用户ID | 页面右上角用户信息获取 |
| username | string | 是 | 用户名 | 页面右上角用户信息获取 |
Body 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| documentIds | array | 是 | 文档ID列表 | ["6c0cb880-f7cc-43f5-9805-a0395f48eb36"] |
4、请求示例
1curl --location 'https://keyue.cloud.baidu.com/open/v1/api/v2/llm/document/batchRetrain' \
2--header 'token: cdeaa589-2934-478b-9fdd-9a2b00a74124' \
3--header 'Content-Type: application/json' \
4--header 'uid: cf7d9692703d45d1b5517a30ab3efa53' \
5--header 'username: pnstest5' \
6--data '{
7 "documentIds": [
8 "14a1ec70-fbc0-4cb7-ac89-a544572045aa"
9 ]
10}'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | null | 是 | 数据 | null |
| code | integer | 是 | 状态码 | 200 |
| msg | string | 是 | 状态信息 | OK |
6、返回示例
获取开头引导热门问
1、URL
GET /open/api/v3/getHotQuestions
2、描述
3、请求参数
Params 参数
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| token | string | 是 | API KEY | agent token,可以在页面集成-API-API Key获取 |
| Content-Type | string | 是 | <br /> | 固定值:application/json |
4、请求示例
1curl 'https://keyue.cloud.baidu.com/open/api/v3/getHotQuestions?token=xxx'
5、返回响应
数据结构
| 名称 | 类型 | 必选 | 中文名 | 说明 |
|---|---|---|---|---|
| time | integer | 是 | 时间 | 1716985128196 |
| data | object | 是 | 数据 | 数据 |
| -> enableHotStart | integer | 是 | 是否打开了开头热门问 | 1是打开,0 |
| -> hotStartType | integer | 是 | 推荐问类型 | 1是自动推荐问,2是意图推荐问,3是FAQ推荐问,4是自定义问 |
| -> hotQuestions | array | 是 | 推荐问的问题 | 字符串数组 |
| code | integer | 是 | 状态码 | 4002801 |
| msg | string | 是 | 状态信息 | 新建问答标准问题成功 |
