ChatConversation

更新时间:
复制 MD 格式

Sends a conversation message to an agent to start a new conversation or continue an existing one. This operation supports Server-Sent Events (SSE).

Operation description

Request

  • You can use this API to send a conversation message to an agent. The response can be streamed using Server-Sent Events (SSE).

  • If the ConversationId parameter is provided, the API continues the specified conversation. If this parameter is omitted, a new conversation is created.

  • The Config field accepts additional input in JSON format.

  • On success, the response includes information such as the message ID for the conversation turn and the reply content. On error, it includes the corresponding error code and error message.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST /api/v1/conversations/chat HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body.

{}

InstanceId

string

Yes

The instance ID.

learn-pairec-xxx

ConversationId

string

No

The conversation ID. Omit this parameter to start a new conversation, or provide it to continue an existing one.

e47cfae9-c0cc-42e1-91e2-e67cdb0e7b96

Content

string

Yes

The content of the message.

校验引擎配置

Config

string

No

Additional input for the request, in JSON format.

{}

Response elements

Element

Type

Description

Example

object

The response body.

RequestId

string

The request ID.

728C5E01-ABF6-5AA8-B9FC-B3BA05DECC77

ConversationId

string

The conversation ID.

e47cfae9-c0cc-42e1-91e2-e67cdb0e7b96

MessageId

string

The message ID.

chat-abcdefg

Event

string

The event type.

message

Answer

string

The content of the reply.

FeatureDB7天读写量为xxx

GmtCreateTime

string

The creation time.

2021-12-15T23:24:33.132+08:00

ErrorCode

string

The error code.

SERVER_ERROR

ErrorMessage

string

The error message.

connection failed

SkillName

string

""

Func

string

""

CallId

string

""

Examples

Success response

JSON format

{
  "RequestId": "728C5E01-ABF6-5AA8-B9FC-B3BA05DECC77",
  "ConversationId": "e47cfae9-c0cc-42e1-91e2-e67cdb0e7b96",
  "MessageId": "chat-abcdefg",
  "Event": "message",
  "Answer": "FeatureDB近7天读写量为xxx",
  "GmtCreateTime": "2021-12-15T23:24:33.132+08:00",
  "ErrorCode": "SERVER_ERROR",
  "ErrorMessage": "connection failed",
  "SkillName": "\"\"",
  "Func": "\"\"",
  "CallId": "\"\""
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.