userId 参数已设置,则校验对应会话的联系人和userId是否匹配,若不匹配,则返回错误;dialogId 参数已设置,则校验对应会话的联系人和userId是否匹配,若不匹配,则返回错误;dialogId 参数未设置,则复用当前联系人关联的会话;dialogId 参数未设置,则新建联系人和新的会话;dialogId 参数已设置,则使用该会话关联的联系人;dialogId 参数未设置,则新建匿名联系人和新的会话;Method:POST
Body:
{
"id": "消息 id",
"content": "agent 回复消息内容",
"createdAt": "消息时间",
"agentLogs": "agent 活动日志", // 具体日志内容可参考接口的响应描述
"attachments": {
"key": "",
"name": "附件名称",
"url": "附件链接",
"contentType": "附件类型"
}
}{
"query": "我想申请订单退款,订单号是 202602050001,可以帮我看下流程吗?",
"dialogId": "dlg_20260205103045_abc123",
"userId": "user_987654321",
"channelType": {
"type": "WECHAT",
"proxy": "CHATLY"
},
"async": false,
"sendWebhook": "https://api.example.com/webhook/agent-callback",
"files": [
{
"name": "order_screenshot.png",
"type": "image/png",
"url": "https://cdn.example.com/uploads/order_screenshot.png",
"size": 245
},
{
"name": "order_screenshot.png",
"type": "image/png",
"url": "https://cdn.example.com/uploads/order_screenshot.png",
"size": 245
}
]
}curl --location --request POST 'https://app.3chatai.com/api/open/v4/butler/chat/completions' \
--header 'Cookie;' \
--header 'Content-Type: application/json' \
--data-raw '{
"query": "我想申请订单退款,订单号是 202602050001,可以帮我看下流程吗?",
"dialogId": "dlg_20260205103045_abc123",
"userId": "user_987654321",
"channelType": {
"type": "WECHAT",
"proxy": "CHATLY"
},
"async": false,
"sendWebhook": "https://api.example.com/webhook/agent-callback",
"files": [
{
"name": "order_screenshot.png",
"type": "image/png",
"url": "https://cdn.example.com/uploads/order_screenshot.png",
"size": 245
},
{
"name": "order_screenshot.png",
"type": "image/png",
"url": "https://cdn.example.com/uploads/order_screenshot.png",
"size": 245
}
]
}'{
"code": 200,
"message": "success",
"data": {
"dialogId": "dlg_20260205103045_abc123",
"agentLogs": [
{
"type": "knowledge_hit",
"name": "RefundPolicyAgent",
"message": "命中退款流程相关知识库内容",
"status": "success",
"kb": [
{
"content": "用户在订单支付完成后7天内可申请退款,退款将原路返回,处理时间为3-5个工作日。",
"chunk_id": "chunk_refund_001",
"document_id": "doc_refund_policy_v1",
"document_name": "退款政策说明",
"enabled": true,
"lang": "zh-CN",
"score": 0.87,
"source": "knowledge_base",
"created_at": 1707100800
}
],
"entity": {
"name": "refund_type",
"values": [
"订单退款"
]
},
"timestamp": 1707100845123
}
],
"messages": [
{
"type": "assistant",
"contentType": "text",
"text": "您好~如果您需要申请退款,只要在订单支付完成后的7天内提交申请即可。退款会原路返回,一般会在3-5个工作日内完成处理。如需我帮您发起退款,也可以直接告诉我订单号。",
"url": "",
"meta": {
"width": 0,
"height": 0,
"size_kb": 0,
"duration": 0,
"format": "",
"coverUrl": ""
}
}
]
}
}