本技能提供腾讯云智能体开发平台的HTTP SSE对话接口调用指导。
https://wss.lke.cloud.tencent.com/v1/qbot/chat/sse在腾讯云控制台 > 智能体开发平台 > 应用管理 > 发布管理中获取应用的 AppKey。
bash
curl --location 'https://wss.lke.cloud.tencent.com/v1/qbot/chat/sse' \
--header 'Content-Type: application/json' \
--data '{
"session_id": "a29bae68-cb1c-489d-8097-6be78f136acf",
"bot_app_key": "YourAppKey",
"visitor_biz_id": "a29bae68-cb1c-489d-8097-6be78f136acf",
"content": "你好",
"incremental": true,
"streaming_throttle": 10
}'
参数名类型必填说明session_idstring(64)是会话ID,2-64字符,格式:^[a-zA-Z0-9_-]{2,64}$bot_app_keystring(128)是应用密钥visitor_biz_idstring(64)是访客ID,标识当前用户contentstring是消息内容request_idstring(255)否请求ID,用于消息串联file_infosObject[]否文件信息(需配合实时文档解析)streaming_throttleint32否流式回包频率控制,默认5custom_variablesmap[string]string否自定义参数(工作流/API参数)system_rolestring否角色指令(提示词)incrementalbool否内容是否增量输出,默认falsesearch_networkstring否联网搜索:enable/disable/空(跟随配置)model_namestring否指定模型:hunyuan/lke-deepseek-r1/lke-deepseek-v3 等streamstring否是否流式:enable/disable/空workflow_statusstring否工作流开关:enable/disable/空
json
{
"file_name": "文档.pdf",
"file_size": "1024000",
"file_url": "https://cos.url/xxx",
"file_type": "pdf",
"doc_id": "doc_xxx"
}
SSE流会返回以下事件类型:
json
{
"type": "reply",
"payload": {
"content": "回复内容",
"is_final": false,
"is_evil": false,
"is_from_self": false,
"is_llm_generated": true,
"record_id": "msg_xxx",
"session_id": "session_xxx",
"timestamp": 1701330805,
"reply_method": 1,
"knowledge": [...],
"quote_infos": [...]
}
}
关键字段:
is_final: true表示消息输出完毕is_evil: true表示命中敏感内容reply_method: 回复方式(1=大模型回复, 16=工作流回复, 18=智能体回复等)quote_infos: 引用信息,用于标注参考来源json
{
"type": "token_stat",
"payload": {
"elapsed": 1616,
"token_count": 323,
"status_summary": "success",
"procedures": [
{
"name": "knowledge",
"title": "调用知识库",
"status": "success",
"input_count": 308,
"output_count": 15
}
]
}
}
json
{
"type": "reference",
"payload": {
"record_id": "msg_xxx",
"references": [
{
"id": "ref_xxx",
"type": 2,
"name": "文档名称",
"doc_name": "xxx.docx",
"url": "https://..."
}
]
}
}
参考来源类型:
json
{
"type": "thought",
"payload": {
"procedures": [
{
"name": "thought",
"title": "思考",
"debugging": {
"content": "思考过程..."
}
}
]
}
}
json
{
"type": "error",
"error": {
"code": 460004,
"message": "应用不存在"
}
}
错误码说明400请求参数错误460001Token校验失败460004应用不存在460007会话创建失败460011超出并发数限制460020模型请求超时460032模型余额不足460034输入内容过长
json
{
"model_name": "lke-deepseek-r1",
"content": "你好"
}
支持的模型:
hunyuan: 混元高级版hunyuan-turbo: 混元Turbo版lke-deepseek-r1: DeepSeek-R1lke-deepseek-v3: DeepSeek-V3lke-deepseek-r1-0528: DeepSeek-R1-0528lke-deepseek-v3-0324: DeepSeek-V3-0324json
{
"custom_variables": {
"UserID": "10220022",
"Data": "{\"Score\":{\"Chinese\":89}}"
}
}
json
{
"custom_variables": {
"tag_field": "user1|user2"
}
}
如需前端渲染消息,可使用官方组件:
bash
# Vue 2 或 React
npm install lke-component
# Vue 3
npm install lke-component-vue3