refactor(workflow): 统一 OSS 接口并重构恢复锁

- 将文件地址前缀与上传逻辑迁移至 common/oss
- 恢复执行改用 utils.WithLock 自动续期锁
- 转写提示词增加单镜头最小时长约束
This commit is contained in:
2026-08-29 11:51:30 +08:00
parent 740003a192
commit 67d049e586
13 changed files with 173 additions and 226 deletions
+7 -2
View File
@@ -13,6 +13,7 @@ import (
"unicode/utf8"
commonHttp "gitea.redpowerfuture.com/red-future/common/http"
"gitea.redpowerfuture.com/red-future/common/oss"
"gitea.redpowerfuture.com/red-future/common/utils"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
@@ -249,12 +250,16 @@ func HttpCallResultLambda(ctx context.Context, nodeInput *flowDto.NodeExecutionI
// addFilePathPrefix 递归把 body 中的 MinIO 裸路径(模型网关转存 OSS 后返回,无 http 前缀)补上文件前缀,
// 供目标 HTTP 服务直接下载文件;已是完整 URL 的值保持不变
func addFilePathPrefix(ctx context.Context, url string, body map[string]any) {
prefix, err := utils.GetFileAddressPrefix(ctx)
prefix, err := oss.GetFileAddressPrefix(ctx)
if err != nil {
g.Log().Warningf(ctx, "获取文件前缀失败,保持原路径: %v", err)
return
}
for k, v := range body {
if k == "templates" && g.IsEmpty(v) {
delete(body, k)
continue
}
body[k] = prependFilePathPrefix(prefix, v)
}
// template/template 模板接口要求 video_urls 为数组:标量值包装为单元素数组
@@ -290,7 +295,7 @@ func toVideoURLsArray(v any) any {
func prependFilePathPrefix(prefix string, v any) any {
switch val := v.(type) {
case string:
if utils.IsOSSPath(val) {
if oss.IsOSSPath(val) {
return prefix + val
}
return val