feat: refine AI retouch workflow

This commit is contained in:
2026-08-17 15:09:15 +08:00
parent 8e444f7434
commit 76aa7bb4aa
6 changed files with 106 additions and 29 deletions
@@ -386,10 +386,17 @@ enum TravelAlbumAIRetouchWorkflow: Sendable, Equatable {
}
}
/// 当前分组是否允许不选择;仅首次修图的氛围感模板选填。
/// 当前分组是否允许不选择;首次修图和原图 Tab 覆盖重修的氛围感模板选填。
func isOptional(_ category: TravelAlbumAIRetouchTemplateCategory) -> Bool {
if case .initial = self, category == .atmosphere { return true }
return false
guard category == .atmosphere else { return false }
switch self {
case .initial:
return true
case .reretouch(_, _, .all):
return true
case .reretouch:
return false
}
}
/// 工作流目标是否满足接口的最小参数要求。
@@ -66,9 +66,12 @@ final class TravelAlbumAIRetouchTemplateViewModel {
return false
}
/// 首次修图页固定展示的氛围感与封面生成规则说明。
/// 首次修图页按照当前选图数量展示氛围感与封面生成规则。
var initialTipsText: String {
"Tips:氛围感修图为选填,可横向选择一种样式;选中后每张照片会额外生成1个独立结果,第一张照片仍另生成封面。"
if visibleCategories.contains(.cover) {
return "Tips:氛围感修图为选填;封面风格为必选,将使用第一张照片另生成封面。"
}
return "Tips:氛围感修图为选填,选中后每张照片会额外生成1个独立结果。"
}
/// 当前分组是否为选填。
@@ -284,8 +284,8 @@ final class TravelAlbumAIRetouchTemplateViewController: BaseViewController {
header.apply(
title: category.title,
badge: category == .cover
? .gift
: (self.viewModel.isOptional(category) ? .optional : nil)
? .requiredGift
: (self.viewModel.isOptional(category) ? .optional : .required)
)
case .mode:
return nil
@@ -845,11 +845,12 @@ final class TravelAlbumAIRetouchModeCell: UICollectionViewCell {
/// 模板分组标题右侧的业务标记。
fileprivate enum AIRetouchTemplateSectionBadge {
case required
case optional
case gift
case requiredGift
}
/// AI 修图模板分组标题,可附带选填或赠送标记。
/// AI 修图模板分组标题,展示必选、选填或封面赠送规则。
final class TravelAlbumAIRetouchSectionHeader: UICollectionReusableView {
static let reuseIdentifier = "TravelAlbumAIRetouchSectionHeader"
@@ -896,12 +897,16 @@ final class TravelAlbumAIRetouchSectionHeader: UICollectionReusableView {
titleLabel.text = title
badgeContainer.isHidden = badge == nil
switch badge {
case .required:
badgeLabel.text = "必选"
badgeLabel.textColor = AIRetouchTemplateStyle.danger
badgeContainer.backgroundColor = AIRetouchTemplateStyle.danger.withAlphaComponent(0.1)
case .optional:
badgeLabel.text = "选填"
badgeLabel.textColor = AIRetouchTemplateStyle.primary
badgeContainer.backgroundColor = AIRetouchTemplateStyle.primary.withAlphaComponent(0.1)
case .gift:
badgeLabel.text = "赠送 · 不占额度"
case .requiredGift:
badgeLabel.text = "必选 · 赠送 · 不占额度"
badgeLabel.textColor = AIRetouchTemplateStyle.gift
badgeContainer.backgroundColor = AIRetouchTemplateStyle.giftBackground
case nil: