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:
2026-05-25 15:25:40 +08:00
parent 50caad8e6c
commit 2f8e7ead17
5 changed files with 20 additions and 5 deletions
+2
View File
@@ -36,6 +36,7 @@ type GenerateResponse struct {
// AssetResponse 单个素材响应。
type AssetResponse struct {
Key string `json:"key"`
URL string `json:"url"`
Format string `json:"format"`
}
@@ -156,6 +157,7 @@ func runPipelineBg(projectID, taskID string, req GenerateRequest) {
return
}
assets[i] = AssetResponse{
Key: key,
URL: cdnURL,
Format: a.Format,
}