Decide whether to continue asking (SSE)
POST
/ai-doc/if-continue-askWhen to call
| Current round | After saving the answer |
|---|---|
| Round 1 | Go straight to round 2; do not call this endpoint. |
| Round 2 | Go straight to round 3; do not call this endpoint. |
| Round 3 | Call this endpoint: True starts round 4; False goes to the image check. |
| Round 4 | Do 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-askRequest headers
http
Authorization: Bearer <ACCESS_TOKEN>
Content-Type: application/jsonRequest body
json
{
"session_id": "<SESSION_ID>",
"pet_profile_id": 44
}Request fields
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | Yes | The session_id returned when the session was created. |
pet_profile_id | integer | No | Pet-profile ID; when omitted the profile bound to the session is used. If provided it must match the session. |
lang | string | No | Omit 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: chunkedNo 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 type | Description | Data format |
|---|---|---|
metadata | Stream-start event; occurs exactly once per stream | {"type":"metadata","gateway_request_id":"<REQUEST_ID>"} |
content | Data-stream event; never use it to decide whether the flow continues | {"type":"content","content":"intermediate text"} |
done | Stream-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>"}} |
error | Error 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.
| Field | Type | Description |
|---|---|---|
type | string | Event type: metadata (start), content (increment), done (terminal success) or error (failure). |
content | string | Incremental text carried by a content event. |
data | object | Payload object carried by the done event (it nests another data object). |
session_id | string | Current session ID. |
data.content | string | Verdict string: "True" means keep asking, "False" means the information is sufficient. |
raw_content | string | Raw model output; troubleshooting only. |
gateway_request_id | string | Gateway request ID. |