gongxiangp2/lib/material-type-options.ts
chenpei 4712175cb0 feat(素材链路): 发布白底图双轨与AI生图回传能力
- 完成白底图 WebP 双轨接口、上传链路与预览缓存改造
- 新增 AI 生图平台成品回传接口、任务状态与表单规则
- 补齐 AI 生成标签、任务详情补全、相关测试与对接文档
2026-03-25 10:28:02 +08:00

64 lines
1.7 KiB
TypeScript

import { is3DOriginalType, isProductPackageType } from './material-type-mapper'
export const MATERIAL_TYPE_OPTIONS = [
'3D场景',
'详情模板',
'材质',
'模特',
'实拍图片',
'买家秀图片',
'小红书种草',
'主图模版',
'SKU模版',
'主图视频',
'安装视频',
'种草视频',
'音乐',
'标准模型',
'品牌VI灵感',
'任务-详情',
'任务-页面',
'任务-3D原图',
'任务-AI原图',
'任务-实拍原图',
'任务-视频截图',
] as const
export type MaterialTypeOption = typeof MATERIAL_TYPE_OPTIONS[number]
export function isSelectableMaterialType(type: string): type is MaterialTypeOption {
return MATERIAL_TYPE_OPTIONS.includes(type as MaterialTypeOption)
}
export function filterSelectableMaterialTypes(types: string[]): string[] {
const uniqueTypes = new Set(types.filter(isSelectableMaterialType))
return MATERIAL_TYPE_OPTIONS.filter((type) => uniqueTypes.has(type))
}
export function getSelectableMaterialTypeOptions(currentType?: string | null): string[] {
const options = [...MATERIAL_TYPE_OPTIONS]
if (!currentType || options.includes(currentType as MaterialTypeOption)) {
return options
}
return [currentType, ...options]
}
export function isTaskMaterialType(materialType: string): boolean {
return isProductPackageType(materialType) || is3DOriginalType(materialType)
}
export function supportsTaskNo(materialType: string): boolean {
return isTaskMaterialType(materialType)
}
export function supportsIsFullSet(materialType: string): boolean {
return isProductPackageType(materialType)
}
export function canManuallyReplacePreview(materialType: string): boolean {
return !isTaskMaterialType(materialType)
}