LogoLogo
註冊/登入
  • 使用者手冊
  • 技術人員手冊
  • API 文件
  • AI 助理市集
  • 歡迎來到 MaiAgent
  • 生成式 AI 快速入門
    • 大型語言模型(LLM)
    • RAG 知識庫檢索系統
    • Embedding 模型
    • Reranker 模型
    • Parser 解析工具
    • 圖像辨識支援
    • 使用環境規劃(SaaS/私有雲/地端)
    • GPU 算力硬體規劃
  • 進階生成式 AI 技術
    • Text to SQL
    • Function Calling
    • Canvas
    • AI 安全防護機制
  • AI 助理模組
    • 角色指令
    • 知識庫
    • FAQ 常見問題管理
    • 回覆評估與監測結果
    • AWS Guardrails
  • API 串接
    • 快速上手
    • AI 助理列表
    • 對話與訊息回覆(串流/同步)
    • 建立對話與訊息
    • Webhook
    • 檔案上傳
    • 檔案上傳知識庫
    • 附件上傳
  • Line LIFF 串接
    • 什麼是 LINE LIFF
    • 如何串接
  • Remote MCP 串接
    • Remote MCP 服務概述
    • Composio 串接
  • 其他
    • Google Sheet 串接
    • n8n 串接
    • MaiAgent vs. Dify 比較
Powered by GitBook
On this page

Was this helpful?

  1. API 串接

對話與訊息回覆(串流/同步)

對話與同步

向 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

  • conversation (請求內容):可選的對話 ID,用於延續對話

  • message.content (請求內容):要發送的訊息內容

  • message.attachments (請求內容):附件陣列(如果有的話)

  • is_streaming (請求內容):是否使用串流回應

回應(非串流):

{
  "content": "string",
  "conversationId": "string"
}

回應(串流):

伺服器發送事件格式如下:

data: {
  "content": "string",
  "conversation_id": "string",
  "done": boolean
}

注意事項:

  • 對於串流回應,伺服器會發送多個包含部分內容的事件,直到回應完成

  • 回應中返回的對話 ID 可用於後續請求中延續對話

串接成果

PreviousAI 助理列表Next建立對話與訊息

Last updated 3 months ago

Was this helpful?