判断是否继续追问
流式输出当前多轮问诊是否已经收集到足够的诊断信息。大模型结合历史问答综合评估,返回是否需要进一步追问("True" 或 "False")。
请求地址
POST
/v1/ms-ai-fast/ai-doc/if-continue-ask
请求参数
请求头
| 请求头 | 类型 | 必填 | 说明 |
|---|---|---|---|
Authorization | string | 是 | 访问凭证,采用 Bearer Token 规范,格式为 Bearer <ACCESS_TOKEN>。 |
Content-Type | string | 是 | 请求体格式,固定为 application/json。 |
Accept | string | 是 | 客户端接收类型,固定为 text/event-stream。 |
请求体 (Body)
json
{
"session_id": "session_6407c5cc22f84c5aae0aeba23e1f1428",
"pet_profile_id": 44,
"lang": "zh-CN"
}| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
session_id | string | 是 | 会话唯一标识符。 |
pet_profile_id | integer | 否 | 宠物档案 ID;若传入必须与会话一致。 |
lang | string | 否 | 语言代码,默认 zh-CN。 |
响应头
http
Content-Type: text/event-stream; charset=utf-8
Cache-Control: no-cache
Transfer-Encoding: chunked响应不返回 Content-Length,必须按流式读取。帧格式、事件类型与代理缓冲说明见流式响应。
响应示例
text
data: {"type":"metadata","gateway_request_id":"gw_req_318920"}
data: {"type":"content","content":"False"}
data: {"type":"done","data":{"session_id":"session_6407c5cc22f84c5aae0aeba23e1f1428","data":{"content":"False"},"raw_content":"False","gateway_request_id":"gw_req_318920"}}下表路径相对于响应 data:data.xxx 表示内层 data 对象中的字段。
| 参数名 | 类型 | 说明 |
|---|---|---|
type | string | 事件类型:metadata(开始)、content(增量)、done(完成结束)、error(异常)。 |
data | object | done 事件核心结果体。 |
session_id | string | 关联的当前会话 ID。 |
data.content | string | 判定结论:"True" 表示病情尚不明确、建议继续追问;"False" 表示信息已足够、可以结束问诊进入小结阶段。 |
raw_content | string | 模型原生返回内容。 |
gateway_request_id | string | 网关请求追踪标识。 |
事件格式
| 事件类型 | 说明 | data: 原文 |
|---|---|---|
metadata | 流开始事件,每个流只出现一次 | {"type":"metadata","gateway_request_id":"<REQUEST_ID>"} |
content | 数据流事件;不能用它判断流程是否继续 | {"type":"content","content":"中间文本"} |
done | 流结束事件;只有收到它才算成功。事件内 content 是字符串 "True" 或 "False",不是 JSON 布尔值 | {"type":"done","data":{"session_id":"<SESSION_ID>","data":{"content":"True"},"raw_content":"True","gateway_request_id":"<REQUEST_ID>"}} |
error | 错误事件;仅在 retryable 为 true 时可有限重试 | {"type":"error","code":"AI_DOC_CONTINUE_STREAM_FAILED","error_code":5401,"message":"流式判断是否继续追问失败","retryable":true,"recommended_action":"retry_later"} |
content 为 "True" 时进入第 4 轮(回到 POST /ai-doc/keywords 重新开始);为 "False" 时调用判断是否需要图片。收到 error 事件或连接中断时,不要继续后续流程。