Skip to content

Decide whether to continue asking (SSE) ​

POST/ai-doc/if-continue-ask

When to call ​

Current roundAfter saving the answer
Round 1Go straight to round 2; do not call this endpoint.
Round 2Go straight to round 3; do not call this endpoint.
Round 3Call this endpoint: True starts round 4; False goes to the image check.
Round 4Do not call this endpoint; go straight to the image check.

Request URL ​

text
POST https://open-api.habitaxx.com/v1/ms-ai-fast/ai-doc/if-continue-ask

Request headers ​

http
Authorization: Bearer <ACCESS_TOKEN>
Content-Type: application/json

Request body ​

json
{
  "session_id": "<SESSION_ID>",
  "pet_profile_id": 44
}

Request fields ​

FieldTypeRequiredDescription
session_idstringYesThe session_id returned when the session was created.
pet_profile_idintegerNoPet-profile ID; when omitted the profile bound to the session is used. If provided it must match the session.
langstringNoOmit it or send the same language as the session, for example zh-CN.

Response headers ​

http
Content-Type: text/event-stream; charset=utf-8
Cache-Control: no-cache
Transfer-Encoding: chunked

No Content-Length; read it as a stream. See Streaming responses for the frame format, event types and proxy buffering.

Response type and example ​

Content-Type: text/event-stream. Every event is a single data: {...} line and event blocks are separated by a blank line; the event type lives in the JSON type field, and no event: line is used.

text
data: {"type":"metadata","gateway_request_id":"<REQUEST_ID>"}

data: {"type":"content","content":"正在判断是否还需要继续询问。"}

data: {"type":"done","data":{"session_id":"<SESSION_ID>","data":{"content":"True"},"raw_content":"True","gateway_request_id":"<REQUEST_ID>"}}

data: {"type":"error","code":"AI_DOC_CONTINUE_STREAM_FAILED","error_code":5401,"message":"流式判断是否继续追问失败","retryable":true,"recommended_action":"retry_later"}

Event format ​

Event typeDescriptionData format
metadataStream-start event; occurs exactly once per stream{"type":"metadata","gateway_request_id":"<REQUEST_ID>"}
contentData-stream event; never use it to decide whether the flow continues{"type":"content","content":"intermediate text"}
doneStream-end event; only this means success. The content inside the event is the string "True" or "False", not a JSON boolean{"type":"done","data":{"session_id":"<SESSION_ID>","data":{"content":"True"},"raw_content":"True","gateway_request_id":"<REQUEST_ID>"}}
errorError event; retry only when retryable is true, with a bounded retry budget{"type":"error","code":"AI_DOC_CONTINUE_STREAM_FAILED","error_code":5401,"message":"流式判断是否继续追问失败","retryable":true,"recommended_action":"retry_later"}

When content is "True", start round 4 (begin again from POST /ai-doc/keywords); when it is "False", call Decide whether an image is needed. On an error event or a broken connection, do not continue.

Done payload fields ​

Paths below are relative to the response data; data.xxx refers to a field of the nested inner data object.

FieldTypeDescription
typestringEvent type: metadata (start), content (increment), done (terminal success) or error (failure).
contentstringIncremental text carried by a content event.
dataobjectPayload object carried by the done event (it nests another data object).
session_idstringCurrent session ID.
data.contentstringVerdict string: "True" means keep asking, "False" means the information is sufficient.
raw_contentstringRaw model output; troubleshooting only.
gateway_request_idstringGateway request ID.
最近更新

Qijie Open Platform · API Documentation