# 提供 阿里ai来上传文件并解析部分pdf ## 一、POST 上传文件并解析 POST /upload-file > Body 请求参数 ```yaml file: "" file_id: "" user_msg: "" ``` ### 请求参数 |名称|位置|类型|必选|说明| |---|---|---|---|---| |body|body|object| 否 |none| |» file|body|string(binary)| 否 |待解析文件| |» file_id|body|string| 否 |ai上传文件的id,为空时file必传| |» user_msg|body|string| 否 |ai提示词| > 返回示例 > 200 Response ```json { "file_id": "string", "content": "string" } ``` ### 返回结果 |状态码|状态码含义|说明|数据模型| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| ### 返回数据结构 状态码 **200** |名称|类型|必选|约束|中文名|说明| |---|---|---|---|---|---| |» file_id|string|true|none|ai上传的文件id|none| |» content|string|true|none|ai解析结果|none| ## 二、GET 上传文件绝对路径并解析 > 当file_id不为空时 适合在相同服务器上传,因为要根据文件路径找到对应的文件 GET /upload-filepath ### 请求参数 |名称|位置|类型|必选|说明| |---|---|---|---|---| |filepath|query|string| 否 |文件绝对路径,file_id为空时必传| |file_id|query|string| 否 |ai上传的文件id| |user_msg|query|string| 否 |ai提示词,不传时有默认值| > 返回示例 > 200 Response ```json { "file_id": "string", "content": "string" } ``` ### 返回结果 |状态码|状态码含义|说明|数据模型| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|none|Inline| ### 返回数据结构 状态码 **200** |名称|类型|必选|约束|中文名|说明| |---|---|---|---|---|---| |» file_id|string|true|none|ai上传的文件id|none| |» content|string|true|none|ai解析内容|none|