feat(server): 模型目录 models[] 增加 coverUrl(封面缩略图)

This commit is contained in:
2026-08-31 16:22:43 +08:00
parent c8a2495fc9
commit 09bdaf36cc
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -457,6 +457,7 @@ type ModelCatalogItem struct {
Notes string `json:"notes"`
PublishedAt *gtime.Time `json:"publishedAt"`
DownloadUrl string `json:"downloadUrl"` // /download/trainings/<文件名前缀>.tflite(前缀空回退数据集名)
CoverUrl string `json:"coverUrl"` // /api/v1/app/cover?namePrefix=<前缀>App 模型清单缩略图)
}
type ModelCatalogRes struct {
+2
View File
@@ -3,6 +3,7 @@ package service
import (
"context"
"encoding/json"
"net/url"
"observer-server/biz/dao"
"observer-server/biz/model/dto"
@@ -39,6 +40,7 @@ func (s *modelVersionService) ClientCatalog(ctx context.Context) (*dto.ModelCata
Notes: v.Notes,
PublishedAt: v.CreatedAt,
DownloadUrl: "/download/trainings/" + modelNames[v.DatasetId] + ".tflite",
CoverUrl: "/api/v1/app/cover?namePrefix=" + url.PathEscape(modelNames[v.DatasetId]),
})
}
return &dto.ModelCatalogRes{List: items}, nil