diff --git a/pkg/service/cast/work.go b/pkg/service/cast/work.go index 9fe171f..92c72ee 100644 --- a/pkg/service/cast/work.go +++ b/pkg/service/cast/work.go @@ -260,12 +260,23 @@ func processContentAndAutoTags(ctx *gin.Context, content string) (string, error) ) if err != nil { return content, err - } else if needMore && len(newTags) > 0 { + } + + if resp == nil { + return content, nil + } + + // 保存新生成的标签到数据库 + if needMore && len(newTags) > 0 { if saveErr := SaveTagsToDatabase(ctx, newTags, 4); saveErr != nil { zap.L().Error("processContentAndAutoTags SaveTagsToDatabase failed", zap.Error(saveErr)) return content, errors.New("自动生成标签保存到数据库失败") } } + // 检查一下 resp.Post 是否为空 + if resp.Post == "" { + return content, nil + } zap.L().Info("processContentAndAutoTags ", zap.Any("resp", resp)) return resp.Post, nil }