Appearance
流式 SSE
一次请求创建任务并返回事件流。请求体与对应资产的创建接口相同(见 接口参考)。
POST /api/open/v1/{asset}-valuations/stream[?callbackUrl=...]
Accept: text/event-stream
Content-Type: application/json
Body: 资产入参 JSON| 参数 | 位置 | 说明 |
|---|---|---|
callbackUrl | query(可选) | 终态 Webhook |
| Body | JSON | 与 POST /{asset}-valuations 一致 |
事件类型
| type | 含义 |
|---|---|
user | 提示片段 |
thinking | 思考过程(常有 status: start / delta / end) |
conclusion | 结论片段 |
result | 结构化结果(与查询成功时的 result 同构) |
error | 失败 |
done | 结束;或单独一行 data:[DONE] |
服务端 SSE 超时约 120 秒。更长任务请用 轮询 或 Webhook。
不要再使用已移除的 GET /{id}/stream 与 autoStart。
设备示例
入参字段见 设备估值。
bash
curl -N -X POST "http://localhost:8080/api/open/v1/equipment-valuations/stream" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-H "X-Api-Key: aai_你的密钥" \
-d '{
"model": "STC200",
"manufactureDate": "2021-06",
"manufacturer": "徐工"
}'SDK
ts
const { result, events } = await client.equipment.valuateStream(
{
model: "STC200",
manufactureDate: "2021-06",
manufacturer: "徐工",
},
{
onEvent: (e) => {
if (e.type === "thinking" && e.payload?.status === "delta") {
process.stdout.write(String(e.payload.delta ?? ""));
}
},
},
);