upload_file_stream

upload_file_stream写操作流式接口
以流式分块方式上传文件到机器人本地(返回可用于发送的本地路径)

通过 POST http://127.0.0.1:3000/upload_file_stream(请求体为 JSON 参数)或 WebSocket 调用。

输入参数

参数 类型 必填 默认 说明
stream_id string 流 ID(客户端生成的 UUID,限 [A-Za-z0-9_-])
chunk_data string 分块数据(Base64)
chunk_index int 分块索引(从 0 开始)
total_chunks int 总分块数(新流必填)
file_size int 文件总大小(字节)
expected_sha256 string 期望的整文件 SHA256(校验)
is_complete bool 是否为最后一个分块/触发合并
filename string 文件名
reset bool 重置并丢弃该流
verify_only bool 仅查询当前流状态
file_retention int 300000 合并文件保留毫秒(0=不回收)

返回 (data)

流式帧:分块确认 type=stream、完成 type=response(含 file_path/file_size/sha256)

该动作返回标准 OneBot 信封;data 结构待补充。

调用示例

curl
Python
JavaScript
Go
SnowLuma SDK
curl -X POST http://127.0.0.1:3000/upload_file_stream \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <access-token>' \
  -d '{"stream_id":"","chunk_data":"","chunk_index":0,"total_chunks":0,"file_size":0,"expected_sha256":"","is_complete":false,"filename":"","reset":false,"verify_only":false,"file_retention":300000}'
在用 AI 助手?

支持 MCP 的客户端可直接发现并调用本动作,无需手写 HTTP。见 MCP 接入