feat(generate): 图片持久化到本地 generation/ 目录,前端对接真实 API
后端:
- POST /api/v1/generate 接收 projectId,生成 taskId,将图片保存至 generation/{projectId}/{taskId}/
- 新增 GET /api/v1/tasks/:taskId 和 GET /api/v1/tasks/:taskId/assets 查询端点
- 添加 /generation 静态文件服务,前端可通过 URL 直接访问生成的图片
- PipelineInput 增加 ProjectID/TaskID 字段
前端:
- generate.ts 对接真实后端 API,移除 mock 模式
- 401 时不再强制登出跳转,改为抛错由调用方处理
- GeneratePage 加载工程风格,传递 projectId 和完整参数
- generation store 简化为同步 API 模式,移除 WebSocket mock
- ResultPage 使用 getTask/getAssets 按 taskId 查询结果
This commit is contained in:
Regular → Executable
+9
-3
@@ -17,9 +17,15 @@ type EditImageRequest struct {
|
||||
Count int `json:"count"` // 生成数量,默认 1
|
||||
}
|
||||
|
||||
// editAssetResponse 编辑结果素材(返回 base64)。
|
||||
type editAssetResponse struct {
|
||||
Data string `json:"data"`
|
||||
Format string `json:"format"`
|
||||
}
|
||||
|
||||
// EditImageResponse 图片编辑响应体。
|
||||
type EditImageResponse struct {
|
||||
Assets []AssetResponse `json:"assets"`
|
||||
Assets []editAssetResponse `json:"assets"`
|
||||
}
|
||||
|
||||
// EditImage 图片编辑接口,基于已有图片和文本指令生成修改后的图片。
|
||||
@@ -47,9 +53,9 @@ func EditImage(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
assets := make([]AssetResponse, len(images))
|
||||
assets := make([]editAssetResponse, len(images))
|
||||
for i, img := range images {
|
||||
assets[i] = AssetResponse{
|
||||
assets[i] = editAssetResponse{
|
||||
Data: base64.StdEncoding.EncodeToString(img.Data),
|
||||
Format: img.Format,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user