Chat
智能体接口
Chat
Chat with agent (streaming or non-streaming)
POST
Chat
Documentation Index
Fetch the complete documentation index at: https://docs.reportify.cn/llms.txt
Use this file to discover all available pages before exploring further.
智能体对话聊天
URL:/v1/agent/conversations/{conversation_id}/chat方法:
POST描述: 与智能体进行对话聊天,支持流式和非流式响应。
路径参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| conversation_id | integer | 是 | 对话 ID |
请求参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| message | string | 是 | 用户消息内容 |
| documents | array[object] | 否 | 关联的文档列表(默认为空数组) |
| stream | boolean | 否 | 是否使用流式响应(默认 true) |
documents 对象结构
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| doc_id | string | 是 | 文档 ID |
| doc_title | string | 是 | 文档标题 |
| file_type | string | 否 | 文档文件类型 |
响应参数(流式 SSE)
响应为 Server-Sent Events (SSE) 流,每个事件包含以下字段。 响应头:X-REPORTIFY-ASSISTANT-MESSAGE-ID:助手消息 ID,可用于后续调用获取消息事件接口
| 参数名 | 类型 | 描述 |
|---|---|---|
| event_id | string | 唯一事件标识符 |
| event_type | string | 事件类型(见下方枚举值) |
| timestamp | integer | 事件时间戳(毫秒) |
| response_id | string | 响应标识符,用于分组事件 |
| workflow_id | string | 工作流标识符 |
| execution_id | string | 执行标识符 |
| run_id | string | 运行标识符,用于关联一组 start 和 end 事件(如 workflow_start 和 workflow_end、tool_start 和 tool_end) |
| node_id | string | 节点标识符 |
| node_name | string | 节点显示名称 |
| node_type | string | 节点类型(start, tool, agent, end) |
| agent_id | string | 智能体标识符 |
| agent_name | string | 智能体显示名称 |
| agent_type | string | 智能体类型 |
| tool_id | string | 工具标识符 |
| tool_name | string | 工具显示名称 |
| input | object | 组件的输入数据 |
| output | object | 组件的输出数据 |
| content | string | 事件内容(用于流式输出) |
| error | object | 错误信息(如果事件类型为 error) |
| offset | integer | 事件偏移量 |
event_type 枚举值
init- 初始化workflow_start- 工作流开始workflow_end- 工作流结束node_start- 节点开始node_end- 节点结束agent_start- 智能体开始agent_end- 智能体结束tool_start- 工具开始tool_end- 工具结束stream_start- 流式开始streaming- 流式输出中stream_end- 流式结束usage- 使用情况cancel- 取消error- 错误
input 对象结构(tool_start 事件)
当event_type 为 tool_start 时,input 字段包含工具的输入参数:
| 参数名 | 类型 | 描述 |
|---|---|---|
| query | string | 搜索查询 |
| symbols | array | 股票代码列表 |
| start_datetime | string | 开始时间 |
| end_datetime | string | 结束时间 |
| num | integer | 返回数量 |
| filetype | string | 文件类型 |
| response_mode | string | 响应模式 |
output 对象结构
tool_end 事件的 output: 当event_type 为 tool_end 时,output 字段包含工具的输出结果:
| 参数名 | 类型 | 描述 |
|---|---|---|
| content | string | 输出内容(JSON 字符串格式,包含 docs、total_count、took_ms、chunks 等字段) |
event_type 为 agent_end 时,output 字段包含智能体的输出结果:
| 参数名 | 类型 | 描述 |
|---|---|---|
| content | string | 智能体输出内容(Markdown 格式) |
event_type 为 node_end 时,output 字段包含节点的输出结果:
| 参数名 | 类型 | 描述 |
|---|---|---|
| content | string | 节点输出内容(文本或 Markdown 格式) |
| filetype | string | 文件类型(如 markdown) |
| filename | string | 文件名 |
| filepath | string | 文件路径 |
注意:当workflow_end 事件的 output: 当node_type为end时,output 通常只包含content字段;当node_type为agent时,output 可能包含完整的文件信息。
event_type 为 workflow_end 时,output 字段包含工作流的最终输出结果:
| 参数名 | 类型 | 描述 |
|---|---|---|
| object | 输出对象(key 为最后一个 node 的 node_id,如 generate_daily_report) | |
| └─ title | string | 报告标题 |
| └─ filetype | string | 文件类型(如 markdown) |
| └─ content | string | 报告完整内容 |
| └─ filename | string | 文件名 |
| └─ filepath | string | 文件路径 |
注意:output是一个字典,其 key 对应工作流中最后一个节点的node_id。例如,如果最后一个节点的node_id为generate_daily_report,则 output 结构为{"generate_daily_report": {...}}。
请求示例
cURL响应示例(SSE 流)
1. init 事件示例:事件流程说明
一个完整的对话流程通常包含以下事件序列:- init → 初始化会话
- workflow_start → 工作流开始执行
- node_start → 节点开始(如”开始”节点)
- agent_start → 智能体开始执行(当节点类型为 agent 时)
- stream_start → 流式输出开始(智能体开始思考)
- streaming → 流式内容输出(多次,逐步输出内容)
- stream_end → 流式输出结束
- tool_start → 工具调用开始(如新闻搜索)
- tool_end → 工具调用结束(返回结果)
- agent_end → 智能体执行结束(包含智能体输出结果)
- node_end → 节点结束(包含节点输出结果)
- workflow_end → 工作流执行完成(包含最终输出结果)
run_id 关联机制
run_id 是用于关联一组 start 和 end 事件的标识符,帮助追踪事件的配对关系:
- workflow_start 和 workflow_end 共享同一个
run_id - node_start 和 node_end 共享同一个
run_id - agent_start 和 agent_end 共享同一个
run_id - stream_start 和 stream_end 共享同一个
run_id - tool_start 和 tool_end 共享同一个
run_id
注意:
- 实际流程中可能包含多个节点、多个智能体、多个工具调用,事件会按照执行顺序依次返回
- 通过
run_id可以准确匹配每个start事件对应的end事件- 当节点类型为
agent时,会触发agent_start和agent_end事件- 同一个智能体内可能有多个流式输出(stream_start/streaming/stream_end)和多个工具调用(tool_start/tool_end)
agent_end事件的output字段包含智能体的输出内容node_end事件的output字段包含节点的输出内容(可能包含文件信息)workflow_end事件的output字段包含工作流的最终输出结果(如生成的报告)
错误响应
| 状态码 | 描述 |
|---|---|
| 400 | 请求错误 |
| 422 | 请求参数验证失败 |
| 500 | 服务器内部错误 |
Authorizations
Enter your Bearer token
Path Parameters
对话 ID
Body
application/json
Response
Successful Response (Server-Sent Events stream)
工作流流式事件对象
唯一事件标识符
Example:
"019b24ef23a1f4da18256b402868fae31764"
事件类型
Available options:
init, workflow_start, workflow_end, node_start, node_end, agent_start, agent_end, tool_start, tool_end, stream_start, streaming, stream_end, usage, cancel, error Example:
"init"
事件时间戳(毫秒)
Example:
1765851210657
响应标识符,用于分组事件
Example:
"019b24ef238cc97730971a9a0080c99c"
工作流标识符
Example:
"11887655289749510"
执行标识符
Example:
"1dfccd9d-c365-4b7a-adae-aa9123684ec4"
运行标识符,用于关联一组 start 和 end 事件(如 workflow_start 和 workflow_end、tool_start 和 tool_end),用于分组相关的开始/结束事件对
Example:
""
节点标识符
节点显示名称
节点类型(start, tool, agent, end)
智能体标识符
智能体显示名称
智能体类型(builtin_agent, react_agent 等)
工具标识符
工具显示名称
组件的输入数据
Example:
{
"query": "NVIDIA AMD Intel GPU 半导体 最新动态",
"symbols": ["US:NVDA", "US:AMD", "US:INTC"],
"start_datetime": "2025-12-15T00:00:00",
"end_datetime": "2025-12-16T02:14:15",
"num": 15,
"filetype": "json"
}
组件的输出数据。
- 对于 tool_end 事件:包含 content 字段(JSON 字符串格式)
- 对于 agent_end 事件:包含 content 字段(Markdown 格式)
- 对于 node_end 事件:包含 content、filetype、filename、filepath 字段
- 对于 workflow_end 事件:字典的 key 为最后一个 node 的 node_id,value 包含 title、filetype、content、filename、filepath 字段
Example:
{
"content": "{\"docs\": [{\"doc_id\": \"1197862772277383168\", \"title\": \"示例文档\"}], \"total_count\": 10}"
}
事件内容(用于思考/流式输出)
Example:
""
错误信息(如果事件类型为 error)
事件偏移量
Example:
9195
