POST
/
chat-messages
{
  "event": "message",
  "task_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "message_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "conversation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "mode": "chat",
  "answer": "<string>",
  "metadata": {
    "usage": {
      "prompt_tokens": 123,
      "prompt_unit_price": "<string>",
      "prompt_price_unit": "<string>",
      "prompt_price": "<string>",
      "completion_tokens": 123,
      "completion_unit_price": "<string>",
      "completion_price_unit": "<string>",
      "completion_price": "<string>",
      "total_tokens": 123,
      "total_price": "<string>",
      "currency": "<string>",
      "latency": 123
    },
    "retriever_resources": [
      {
        "position": 123,
        "dataset_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "dataset_name": "<string>",
        "document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "document_name": "<string>",
        "segment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "score": 123,
        "content": "<string>"
      }
    ]
  },
  "created_at": 123
}

Authorizations

Authorization
string
header
required

API-Key 鉴权。所有 API 请求都应在 Authorization HTTP Header 中包含您的 API-Key,格式为:Bearer {API_KEY}。强烈建议开发者把 API-Key 放在后端存储,而非客户端,以免泄露。

Body

application/json

发送对话消息的请求体。

The body is of type object.

Response

200
application/json

请求成功。响应的内容类型和结构取决于请求中的 response_mode 参数。

  • response_modeblocking 时,返回 application/json 格式的 ChatCompletionResponseCn 对象。
  • response_modestreaming 时,返回 text/event-stream 格式的 ChunkChatEventCn 对象流式序列。

阻塞模式下的完整 App 结果。