fix: 修复前端无法加载七牛云图片的问题
1. 修复 buildURL 中 url.PathEscape 对路径分隔符 / 的错误编码(/→%2F), 改为逐段编码后拼接 2. AssetResponse 新增 key 字段,返回七牛云对象存储 Key 3. 前端改用 /api/v1/assets/download 接口加载图片,通过后端 302 重定向 访问 CDN,避免浏览器直接访问 CDN 可能出现的跨域或编码问题 4. 更新 api.md 文档,补充 key 字段说明和 download 接口公开属性
This commit is contained in:
+9
-3
@@ -483,8 +483,8 @@ POST /api/v1/prompt/optimize
|
||||
"data": {
|
||||
"assets": [
|
||||
{
|
||||
"id": "asset_001",
|
||||
"url": "https://cdn.example.com/users/user_a1B2c3D4/projects/proj_abc123/tasks/task_xyz789/output/spritesheet.png",
|
||||
"key": "generation/proj_abc123/task_xyz789/0.png",
|
||||
"url": "https://cdn.example.com/generation/proj_abc123/task_xyz789/0.png",
|
||||
"format": "png",
|
||||
"width": 256,
|
||||
"height": 64,
|
||||
@@ -500,9 +500,15 @@ POST /api/v1/prompt/optimize
|
||||
}
|
||||
```
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
| `key` | string | 七牛云对象存储 Key |
|
||||
| `url` | string | CDN 直接访问 URL |
|
||||
| `format` | string | 图片格式(png 等) |
|
||||
|
||||
### GET /api/v1/assets/download
|
||||
|
||||
需认证。返回 302 重定向到七牛云 CDN URL。
|
||||
公开接口(无需认证)。返回 302 重定向到七牛云 CDN URL。前端可通过此接口加载素材图片,作为 CDN 直接访问的替代方案。
|
||||
|
||||
| 参数 | 类型 | 说明 |
|
||||
|------|------|------|
|
||||
|
||||
Reference in New Issue
Block a user