feat: 七牛云存储服务与素材下载接口

- service/storage.go: StorageService 提供 Upload/GetDownloadURL/Delete
- handler/storage.go: GET /api/v1/assets/download 重定向到 CDN URL
- main.go: 注入 StorageService 并注册下载路由
This commit is contained in:
2026-05-25 12:57:13 +08:00
parent d0937c2c35
commit 30a46ff74b
3 changed files with 120 additions and 2 deletions
+7 -2
View File
@@ -31,14 +31,19 @@ func main() {
service.InitLLMConfig(cfg.LLM)
service.InitImageGenConfig(cfg.ImageGen)
// 初始化七牛云存储服务
storageSvc := service.NewStorageService(cfg.Qiniu)
handler.InitStorageService(storageSvc)
r := gin.New()
r.Use(gin.Recovery()) // panic 恢复中间件,防止服务因未捕获异常宕机
// API v1 路由组
v1 := r.Group("/api/v1")
{
v1.GET("/health", handler.Health) // 健康检查
v1.POST("/prompt/optimize", handler.PromptOptimize) // 提示词优化
v1.GET("/health", handler.Health) // 健康检查
v1.POST("/prompt/optimize", handler.PromptOptimize) // 提示词优化
v1.GET("/assets/download", handler.DownloadAsset) // 素材下载
}
// Auth 路由组