package service import ( "context" "strings" "time" "gitea.redpowerfuture.com/red-future/common/oss" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/util/gconv" ) // modelCallMaxRetries 上游调用最大重试次数 const modelCallMaxRetries = 10 // retryWait 指数退避等待(第 attempt 次重试,等待 1< 0 { return gconv.String(arr[0]) } return gconv.String(v) } // extractChunkText 从流式分片字段取值并转存 OSS,返回首位文本(数组取首个元素,去掉首尾空白)。 // 空值 / 仅空白 / 数组全空 返回空串。 func extractChunkText(ctx context.Context, v any) string { if v == nil || g.IsEmpty(v) { return "" } return strings.TrimSpace(firstText(oss.TempURLToOSS(ctx, v))) }