Skip to content

编辑文件

对指定文件进行字符串替换编辑。old_string 必须在文件中存在,new_string 为空时等同于删除 old_string

  • 接口路径:POST /v1/openapi/app/files/edit

请求头

参数名必填说明
Content-Typeapplication/json
Authorization鉴权凭证,格式 Bearer sk_xxx

请求参数

json
{
  "user_id": "user123",
  "path": "/data/file.txt",
  "old_string": "hello world",
  "new_string": "hello Go",
  "replace_all": false
}
参数名类型必填说明
user_idstring业务方用户 ID,用于确定所属工作空间
pathstring文件路径
old_stringstring待替换的原始字符串,必须在文件中存在
new_stringstring替换后的新字符串,默认为空(即删除)
replace_allbool是否替换所有匹配项,默认 false

响应示例

json
{
  "code": 200,
  "data": {},
  "message": "",
  "trace_id": "stu901"
}

AI 应用开发平台 - 面向医疗场景的 AI 应用创新引擎