帮你快速理解、总结文档立即下载

读取 Skill 资源文件

最近更新时间:2026-09-23 21:01:00
我的收藏

接口介绍

本接口(/v3/skill/read_file)用于读取 Skill 中某个资源文件的内容。功能说明如下:
按路径读取:通过 path 指定要读取的资源文件路径。
版本指定:支持按版本号读取历史版本中的文件,不传 version 则返回最新版本。
编码控制:通过 encoding 参数控制内容编码方式。

Method 与 URL

POST https://memory.tdai.tencentyun.com/v3/skill/read_file

使用示例

curl -i -X POST \\
-H 'Content-Type: application/json' \\
-H 'Authorization: Bearer *********************************' \\
-H "x-tdai-service-id: tdai-mem-xxxxxxxx" \\
https://memory.tdai.tencentyun.com/v3/skill/read_file \\
-d '{
"skill_id":"skill-abc123",
"path":"examples/usage.py"
}'

请求参数

Body 参数

参数
是否必选
参数含义
配置方法及要求
skill_id
是
Skill ID。
数据类型:String。
path
是
文件路径。
数据类型:String。
version
否
指定版本号,不传返回最新版本。
数据类型:Integer。
encoding
否
内容编码方式。
数据类型:String。默认返回原始格式。
team_id
否
团队 ID。
数据类型:String。
agent_id
否
Agent ID。
数据类型:String。
user_id
否
用户 ID。
数据类型:String。
task_id
否
任务 ID。
数据类型:String。

响应示例

{
"code":0,
"message":"ok",
"request_id":"req-mno345",
"data":{
"path":"examples/usage.py",
"content":"print('hello world')",
"mime_type":"text/x-python",
"encoding":"utf-8",
"size":20
}
}

响应参数说明

参数名(一级)
参数名(二级)
参数含义
data
path
文件路径。
content
文件内容。
mime_type
MIME 类型。
encoding
编码方式。
size
文件大小(字节)。

错误码

HTTP 状态码
错误信息
说明
401
Missing or invalid Authorization header
Bearer API Key 缺失或格式不正确。
404
SKILL_NOT_FOUND
Skill 或文件不存在。
500
Internal error
服务内部错误,可有限重试。