Rest API
与Agent对话
请求以下接口
https://rest.agentweave.ai/api/v1/chat/agent/${agentId}
需要把上述地址最后的 ${agentId} 替换成创建API key的agent的id
在请求头中添加
Authorization: {Access Token 或者 Api Key}
请求体
{
"content": "string", // 对话内容
"id": "string", // 对话id
"type": "string", // 询问内容类型, text
"thread_id": "string" // 会话id,第一次对话可以不填,后续对话需要填上api返回的thread_id
}
返回数据
{
"result": {
"code": 201000, // result code
"message": "Successfully." // result message
},
"data": {
"message": {
"id": "be98451f-6080-43f4-9b28-b097743efcb4", // 消息id
"content": "Hello!", // 回复内容
"type": "text", // 回复类型
"user_id": "microsoft_ai_rag_9e8ac8be-6313-477f-8ead-845a704c6ef4", // 回复用户id
"timestamp": 1746596042399, // 回复时间
"thread_id": "01JTMKS277ZGX7TS3J5WKSPDKS", // 对话id
"agent_id": "microsoft_ai_rag_9e8ac8be-6313-477f-8ead-845a704c6ef4", // 智能体id
"from": "assistant",
"usage": "{\"prompt_tokens\":3097,\"completion_tokens\":12,\"total_tokens\":3109}", // token统计
"references": [],
"client_message_id": "cf89ed62ee014e8dd9a4746" // 客户端提问id
},
"agent_id": "microsoft_ai_rag_9e8ac8be-6313-477f-8ead-845a704c6ef4" // 智能体id
}
}
