對話與同步
向 AI 助理發送訊息並取得回應。
curl -X POST \ 'https://api.maiagent.ai/api/v1/chatbots/{chatbot_id}/completions/' \ -H 'Authorization: Api-Key YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "conversation": "string|null", "message": { "content": "string", "attachments": [] }, "is_streaming": boolean }'
參數:
chatbot_id (路徑參數):對話機器人 ID
chatbot_id
conversation (請求內容):可選的對話 ID,用於延續對話
conversation
message.content (請求內容):要發送的訊息內容
message.content
message.attachments (請求內容):附件陣列(如果有的話)
message.attachments
is_streaming (請求內容):是否使用串流回應
is_streaming
回應(非串流):
回應(串流):
伺服器發送事件格式如下:
注意事項:
對於串流回應,伺服器會發送多個包含部分內容的事件,直到回應完成
回應中返回的對話 ID 可用於後續請求中延續對話
Last updated 10 months ago
Was this helpful?
{ "content": "string", "conversationId": "string" }
data: { "content": "string", "conversation_id": "string", "done": boolean }