fix: 工程类型与素材风格标签分离,支持双栏自定义标签

- 工程层面:新增 PROJECT_TYPES(2D平台跳跃/角色扮演等8种),替代原先与素材生成重复的风格标签栏
- 素材生成层面:StyleSelector 作为素材风格主配置项,新增 CustomTagsEditor 支持任务级自定义标签
- extractTags 合并工程类型、风格分类、工程自定义标签、任务自定义标签
- StyleSelector 支持 categories 参数复用
- 后端:spritesheet 拆分失败回退为单帧、GIF 上传为独立素材、AssetResponse 增加 metadata 字段
This commit is contained in:
2026-05-25 19:31:36 +08:00
parent c48ba6e61d
commit ab2b72e746
14 changed files with 149 additions and 57 deletions
+19 -7
View File
@@ -1,5 +1,5 @@
import { post } from './client'
import { STYLE_CATEGORIES, getCustomTags } from '../utils/style'
import { STYLE_CATEGORIES, PROJECT_TYPES, PROJECT_TYPE_KEY, getCustomTags } from '../utils/style'
interface OptimizePromptParams {
tags: string[]
@@ -17,14 +17,26 @@ interface OptimizePromptResponse {
* 从风格键值对中提取标签的中文名称作为 tags,包含自定义标签
*/
export function extractTags(style: Record<string, string>): string[] {
const presetTags = STYLE_CATEGORIES.flatMap(cat => {
const tags: string[] = []
// 工程类型标签
const projectType = style[PROJECT_TYPE_KEY]
if (projectType) {
const pt = PROJECT_TYPES.find(p => p.value === projectType)
if (pt) tags.push(pt.label)
}
// 风格分类标签
for (const cat of STYLE_CATEGORIES) {
const value = style[cat.key]
if (!value) return []
if (!value) continue
const option = cat.options.find(o => o.value === value)
return option ? [option.label] : []
})
const customTags = getCustomTags(style)
return [...presetTags, ...customTags]
if (option) tags.push(option.label)
}
// 自定义标签
tags.push(...getCustomTags(style))
return tags
}
/**
+1
View File
@@ -127,6 +127,7 @@ export interface AssetsResponse {
frameHeight: number
frameCount: number
directions: number
gifUrl?: string
}
}