auto-save 2026-05-18 23:44 (+6, ~5)
This commit is contained in:
447
src/lib/templates.ts
Normal file
447
src/lib/templates.ts
Normal file
@@ -0,0 +1,447 @@
|
||||
import type { AssetTemplate, CharacterSpec, PackKind } from './types';
|
||||
|
||||
export const FILENAME_SCHEMA = '{sessionId}_{characterSlug}_{pack}_{view}_{version}.{ext}';
|
||||
|
||||
export const PACK_LABELS: Record<PackKind, string> = {
|
||||
patent: '专利包',
|
||||
production: '生产打样包',
|
||||
marketing: '宣发包',
|
||||
};
|
||||
|
||||
export const CHARACTER_SPEC_FIELDS: Array<{ key: keyof CharacterSpec; label: string; hint: string }> = [
|
||||
{ key: 'name', label: '名称', hint: '玩具/IP 名称' },
|
||||
{ key: 'oneLiner', label: '一句话定位', hint: '面向谁、解决什么情绪或场景' },
|
||||
{ key: 'targetUser', label: '目标用户', hint: '儿童、潮玩、礼品、品牌客户等' },
|
||||
{ key: 'speciesShape', label: '物种/形态', hint: '动物、人形、怪兽、机甲、食物拟人等' },
|
||||
{ key: 'bodyRatio', label: '身体比例', hint: '头身比、胖瘦、坐姿/站姿' },
|
||||
{ key: 'faceFeatures', label: '五官表情', hint: '眼睛、嘴巴、腮红、表情、眉毛' },
|
||||
{ key: 'colorPalette', label: '配色', hint: '主色、辅色、强调色、禁用色' },
|
||||
{ key: 'materials', label: '材料', hint: '毛绒、刺绣、印花、塑料件、织带、金属件' },
|
||||
{ key: 'accessories', label: '配件', hint: '衣服、帽子、背包、吊牌、电子件等' },
|
||||
{ key: 'signatureElements', label: '识别元素', hint: '最能形成识别度的 3-5 个元素' },
|
||||
{ key: 'manufacturingNotes', label: '生产提醒', hint: '避免过细尖角、过多小件等' },
|
||||
{ key: 'patentFocus', label: '专利重点', hint: '希望保护的外观特征' },
|
||||
{ key: 'marketingAngle', label: '营销角度', hint: '陪伴、治愈、收藏、科技感、礼物等' },
|
||||
{ key: 'negativePrompt', label: '禁忌项', hint: '不要出现的元素' },
|
||||
{ key: 'sourceImageId', label: '源图 ID', hint: '选中方案来源' },
|
||||
{ key: 'sourceImageUrl', label: '源图链接', hint: '选中方案来源' },
|
||||
{ key: 'lockedAt', label: '锁定时间', hint: '角色设定生成时间' },
|
||||
];
|
||||
|
||||
const patentChecklist = [
|
||||
'白底或浅灰底,产品居中',
|
||||
'无营销文案、场景道具、水印和价格信息',
|
||||
'五官、配色、配件位置与源图保持一致',
|
||||
'视角和比例清楚,外观重点可见',
|
||||
];
|
||||
|
||||
const productionChecklist = [
|
||||
'有清晰标注线和中文说明',
|
||||
'尺寸单位默认 cm,小部件可用 mm',
|
||||
'材料、工艺、颜色或结构信息足以支持工厂沟通',
|
||||
'不混入营销海报和场景背景',
|
||||
];
|
||||
|
||||
const marketingChecklist = [
|
||||
'角色与锁定设定一致',
|
||||
'画面明确服务一个渠道或卖点',
|
||||
'文案不遮挡产品关键外观',
|
||||
'镜头、色温、背景质感与同包素材统一',
|
||||
];
|
||||
|
||||
export const PATENT_TEMPLATES: AssetTemplate[] = [
|
||||
{
|
||||
id: 'patent_front',
|
||||
kind: 'patent',
|
||||
view: 'front',
|
||||
title: '主视图',
|
||||
description: '正面外观,是外观保护的核心视角。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'front',
|
||||
promptTemplate: '生成外观设计专利主视图:{character}. 正面正交视角,白底,产品居中,比例统一,无文字无水印无场景道具,清楚展示五官、身体比例、配色和配件。',
|
||||
checklist: patentChecklist,
|
||||
},
|
||||
{
|
||||
id: 'patent_back',
|
||||
kind: 'patent',
|
||||
view: 'back',
|
||||
title: '后视图',
|
||||
description: '展示背部、后脑、尾巴、标签和后侧配件。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'back',
|
||||
promptTemplate: '生成外观设计专利后视图:{character}. 背面正交视角,白底,产品居中,比例与主视图一致,无文字无水印,清楚展示背部结构、尾巴、标签位和后侧配件。',
|
||||
checklist: patentChecklist,
|
||||
},
|
||||
{
|
||||
id: 'patent_left',
|
||||
kind: 'patent',
|
||||
view: 'left',
|
||||
title: '左视图',
|
||||
description: '展示侧面厚度、鼻子凸起、耳朵和四肢外凸关系。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'left',
|
||||
promptTemplate: '生成外观设计专利左视图:{character}. 左侧正交视角,白底,比例统一,无文字无水印,突出厚度、耳朵角度、鼻子凸起、手脚位置。',
|
||||
checklist: patentChecklist,
|
||||
},
|
||||
{
|
||||
id: 'patent_right',
|
||||
kind: 'patent',
|
||||
view: 'right',
|
||||
title: '右视图',
|
||||
description: '确认侧面对称性或非对称外观。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'right',
|
||||
promptTemplate: '生成外观设计专利右视图:{character}. 右侧正交视角,白底,比例统一,无文字无水印,确认侧面轮廓、配件和四肢关系。',
|
||||
checklist: patentChecklist,
|
||||
},
|
||||
{
|
||||
id: 'patent_top',
|
||||
kind: 'patent',
|
||||
view: 'top',
|
||||
title: '俯视图',
|
||||
description: '展示头顶、耳朵、角、帽子或顶部装饰。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'top',
|
||||
promptTemplate: '生成外观设计专利俯视图:{character}. 从正上方观察,白底,产品居中,无文字无水印,展示头顶、耳朵、角、发饰、帽子和顶部轮廓。',
|
||||
checklist: patentChecklist,
|
||||
},
|
||||
{
|
||||
id: 'patent_bottom',
|
||||
kind: 'patent',
|
||||
view: 'bottom',
|
||||
title: '仰视图',
|
||||
description: '展示脚底、底部标签、底盘和坐姿稳定结构。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'bottom',
|
||||
promptTemplate: '生成外观设计专利仰视图:{character}. 从正下方观察,白底,产品居中,无文字无水印,展示脚底、底部标签、底盘形态和底部轮廓。',
|
||||
checklist: patentChecklist,
|
||||
},
|
||||
{
|
||||
id: 'patent_perspective_front',
|
||||
kind: 'patent',
|
||||
view: 'perspective_front',
|
||||
title: '前侧立体图',
|
||||
description: '45 度前侧展示整体体积和外观印象。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'perspective-front',
|
||||
promptTemplate: '生成外观设计专利前 45 度立体图:{character}. 白底,产品居中,无文字无水印,展示整体体积、正面五官、身体厚度和主要配件。',
|
||||
checklist: patentChecklist,
|
||||
},
|
||||
{
|
||||
id: 'patent_perspective_back',
|
||||
kind: 'patent',
|
||||
view: 'perspective_back',
|
||||
title: '后侧立体图',
|
||||
description: '45 度后侧补充背部和体积信息。',
|
||||
required: false,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'perspective-back',
|
||||
promptTemplate: '生成外观设计专利后 45 度立体图:{character}. 白底,产品居中,无文字无水印,展示背面轮廓、尾巴、后侧配件和整体厚度。',
|
||||
checklist: patentChecklist,
|
||||
},
|
||||
{
|
||||
id: 'patent_detail_face',
|
||||
kind: 'patent',
|
||||
view: 'detail_face',
|
||||
title: '脸部局部放大',
|
||||
description: '放大眼睛、嘴巴、腮红和表情细节。',
|
||||
required: false,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'detail-face',
|
||||
promptTemplate: '生成外观设计专利脸部局部放大图:{character}. 白底,无文字无水印,只放大脸部区域,清楚展示眼睛、嘴巴、腮红、表情和刺绣/印花边界。',
|
||||
checklist: patentChecklist,
|
||||
},
|
||||
{
|
||||
id: 'patent_detail_accessory',
|
||||
kind: 'patent',
|
||||
view: 'detail_accessory',
|
||||
title: '配件局部放大',
|
||||
description: '放大服装、尾巴、背包或机械件等识别部件。',
|
||||
required: false,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'detail-accessory',
|
||||
promptTemplate: '生成外观设计专利配件局部放大图:{character}. 白底,无文字无水印,放大最具识别度的配件、服装、尾巴、背包或机械部件。',
|
||||
checklist: patentChecklist,
|
||||
},
|
||||
];
|
||||
|
||||
export const PRODUCTION_TEMPLATES: AssetTemplate[] = [
|
||||
{
|
||||
id: 'prod_front_spec',
|
||||
kind: 'production',
|
||||
view: 'front_spec',
|
||||
title: '正面打样图',
|
||||
description: '标注总高、头宽、身体宽和手脚位置。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'front-spec',
|
||||
promptTemplate: '生成毛绒玩具生产正面打样图:{character}. 正面正交视角,白底,带清晰尺寸标注线和中文标注:总高、头宽、身体宽、手长、腿长、关键配件位置。',
|
||||
checklist: productionChecklist,
|
||||
},
|
||||
{
|
||||
id: 'prod_back_spec',
|
||||
kind: 'production',
|
||||
view: 'back_spec',
|
||||
title: '背面打样图',
|
||||
description: '标注背部结构、尾巴、标签位和缝线。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'back-spec',
|
||||
promptTemplate: '生成毛绒玩具生产背面打样图:{character}. 背面正交视角,白底,带中文标注:后脑、背部拼接、尾巴、标签位、缝线和后侧配件。',
|
||||
checklist: productionChecklist,
|
||||
},
|
||||
{
|
||||
id: 'prod_left_spec',
|
||||
kind: 'production',
|
||||
view: 'left_spec',
|
||||
title: '左侧打样图',
|
||||
description: '标注厚度、鼻子凸起、耳朵角度。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'left-spec',
|
||||
promptTemplate: '生成毛绒玩具生产左侧打样图:{character}. 左侧正交视角,白底,带中文尺寸标注:头部厚度、身体厚度、鼻子凸起、耳朵角度、四肢侧面位置。',
|
||||
checklist: productionChecklist,
|
||||
},
|
||||
{
|
||||
id: 'prod_right_spec',
|
||||
kind: 'production',
|
||||
view: 'right_spec',
|
||||
title: '右侧打样图',
|
||||
description: '确认侧面对称性或非对称细节。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'right-spec',
|
||||
promptTemplate: '生成毛绒玩具生产右侧打样图:{character}. 右侧正交视角,白底,带中文尺寸标注,确认侧面厚度、配件位置和非对称细节。',
|
||||
checklist: productionChecklist,
|
||||
},
|
||||
{
|
||||
id: 'prod_dimension_overall',
|
||||
kind: 'production',
|
||||
view: 'dimension_overall',
|
||||
title: '整体尺寸图',
|
||||
description: '标注总高、坐高、臂展和头身比。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'dimension-overall',
|
||||
promptTemplate: '生成毛绒玩具整体尺寸图:{character}. 白底,技术说明风格,标注总高、坐高、臂展、头身比、头宽、身体宽,单位 cm。',
|
||||
checklist: productionChecklist,
|
||||
},
|
||||
{
|
||||
id: 'prod_material_board',
|
||||
kind: 'production',
|
||||
view: 'material_board',
|
||||
title: '材料工艺板',
|
||||
description: '说明面料、刺绣、印花、塑料件和填充。',
|
||||
required: true,
|
||||
aspectRatio: '4:5',
|
||||
filenamePart: 'material-board',
|
||||
promptTemplate: '生成毛绒玩具材料工艺板:{character}. 干净版式,包含面料样块、刺绣/印花说明、塑料件/织带/金属件说明、填充软硬度和坐姿稳定要求,中文标注。',
|
||||
checklist: productionChecklist,
|
||||
},
|
||||
{
|
||||
id: 'prod_color_board',
|
||||
kind: 'production',
|
||||
view: 'color_board',
|
||||
title: '颜色板',
|
||||
description: '主色、辅色、五官、衣服和配件色。',
|
||||
required: true,
|
||||
aspectRatio: '4:5',
|
||||
filenamePart: 'color-board',
|
||||
promptTemplate: '生成毛绒玩具颜色板:{character}. 包含主色、辅色、强调色、五官色、衣服/配件色,给出 HEX 色值和建议 Pantone 占位,中文标注。',
|
||||
checklist: productionChecklist,
|
||||
},
|
||||
{
|
||||
id: 'prod_part_breakdown',
|
||||
kind: 'production',
|
||||
view: 'part_breakdown',
|
||||
title: '拆件图',
|
||||
description: '拆分头、身体、四肢、耳朵、服装和配件。',
|
||||
required: true,
|
||||
aspectRatio: '4:5',
|
||||
filenamePart: 'part-breakdown',
|
||||
promptTemplate: '生成毛绒玩具拆件图:{character}. 技术图风格,白底,将头、身体、四肢、耳朵、服装、配件分开展示,带中文部件名称和数量标注。',
|
||||
checklist: productionChecklist,
|
||||
},
|
||||
{
|
||||
id: 'prod_packaging_structure',
|
||||
kind: 'production',
|
||||
view: 'packaging_structure',
|
||||
title: '包装结构图',
|
||||
description: '礼盒、吊卡、内托和说明卡草案。',
|
||||
required: false,
|
||||
aspectRatio: '4:5',
|
||||
filenamePart: 'packaging-structure',
|
||||
promptTemplate: '生成玩具包装结构草图:{character}. 展示礼盒、吊卡、内托、说明卡和包装尺寸建议,干净白底,中文标注,适合给工厂沟通。',
|
||||
checklist: productionChecklist,
|
||||
},
|
||||
{
|
||||
id: 'prod_label_tag',
|
||||
kind: 'production',
|
||||
view: 'label_tag',
|
||||
title: '标签吊牌图',
|
||||
description: '吊牌、水洗标和品牌标位置与内容草案。',
|
||||
required: false,
|
||||
aspectRatio: '4:5',
|
||||
filenamePart: 'label-tag',
|
||||
promptTemplate: '生成玩具标签吊牌说明图:{character}. 展示吊牌、水洗标、品牌标的位置和内容草案,包含尺寸建议和中文标注,白底技术版式。',
|
||||
checklist: productionChecklist,
|
||||
},
|
||||
];
|
||||
|
||||
export const MARKETING_TEMPLATES: AssetTemplate[] = [
|
||||
{
|
||||
id: 'mkt_hero_kv',
|
||||
kind: 'marketing',
|
||||
view: 'hero_kv',
|
||||
title: '主视觉 KV',
|
||||
description: '一眼讲清角色、气质和核心卖点。',
|
||||
required: true,
|
||||
aspectRatio: '16:9',
|
||||
filenamePart: 'hero-kv',
|
||||
promptTemplate: '生成玩具新品主视觉 KV:{character}. 高级商业摄影,干净但有情绪的背景,突出角色核心卖点,可加入简洁中文标题占位,但不要遮挡产品。',
|
||||
checklist: marketingChecklist,
|
||||
},
|
||||
{
|
||||
id: 'mkt_white_front',
|
||||
kind: 'marketing',
|
||||
view: 'white_front',
|
||||
title: '白底正面商品图',
|
||||
description: '电商基础商品图。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'white-front',
|
||||
promptTemplate: '生成电商白底商品图:{character}. 正面,产品居中,柔和阴影,高清质感,无多余文字,适合主图。',
|
||||
checklist: marketingChecklist,
|
||||
},
|
||||
{
|
||||
id: 'mkt_white_45',
|
||||
kind: 'marketing',
|
||||
view: 'white_45',
|
||||
title: '白底 45 度商品图',
|
||||
description: '展示体积和可爱感。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'white-45',
|
||||
promptTemplate: '生成电商白底 45 度商品图:{character}. 前侧 45 度,产品居中,柔和阴影,展示整体体积、毛绒质感和主要配件。',
|
||||
checklist: marketingChecklist,
|
||||
},
|
||||
{
|
||||
id: 'mkt_white_back',
|
||||
kind: 'marketing',
|
||||
view: 'white_back',
|
||||
title: '白底背面商品图',
|
||||
description: '展示背部和后侧细节。',
|
||||
required: true,
|
||||
aspectRatio: '1:1',
|
||||
filenamePart: 'white-back',
|
||||
promptTemplate: '生成电商白底背面商品图:{character}. 背面,产品居中,柔和阴影,展示背部、尾巴、标签和后侧配件。',
|
||||
checklist: marketingChecklist,
|
||||
},
|
||||
{
|
||||
id: 'mkt_detail_face',
|
||||
kind: 'marketing',
|
||||
view: 'detail_face',
|
||||
title: '脸部细节图',
|
||||
description: '展示五官、刺绣和表情。',
|
||||
required: true,
|
||||
aspectRatio: '4:5',
|
||||
filenamePart: 'detail-face',
|
||||
promptTemplate: '生成玩具脸部细节宣发图:{character}. 近景特写,突出眼睛、嘴巴、腮红、刺绣/印花工艺和治愈表情,可加入简短卖点文案。',
|
||||
checklist: marketingChecklist,
|
||||
},
|
||||
{
|
||||
id: 'mkt_detail_material',
|
||||
kind: 'marketing',
|
||||
view: 'detail_material',
|
||||
title: '面料触感图',
|
||||
description: '展示毛绒、填充和触感卖点。',
|
||||
required: true,
|
||||
aspectRatio: '4:5',
|
||||
filenamePart: 'detail-material',
|
||||
promptTemplate: '生成玩具面料触感宣发图:{character}. 微距商业摄影,突出毛绒质感、柔软填充、可抱触感,可加入简短中文卖点。',
|
||||
checklist: marketingChecklist,
|
||||
},
|
||||
{
|
||||
id: 'mkt_scene_bedroom',
|
||||
kind: 'marketing',
|
||||
view: 'scene_bedroom',
|
||||
title: '卧室陪伴场景',
|
||||
description: '床头、儿童房或治愈陪伴场景。',
|
||||
required: true,
|
||||
aspectRatio: '4:5',
|
||||
filenamePart: 'scene-bedroom',
|
||||
promptTemplate: '生成玩具卧室陪伴场景图:{character}. 温暖床头或儿童房场景,柔和自然光,突出陪伴、治愈和礼物感。',
|
||||
checklist: marketingChecklist,
|
||||
},
|
||||
{
|
||||
id: 'mkt_size_lifestyle',
|
||||
kind: 'marketing',
|
||||
view: 'size_lifestyle',
|
||||
title: '尺寸对比图',
|
||||
description: '用手持、桌面或沙发对比表达尺寸。',
|
||||
required: true,
|
||||
aspectRatio: '4:5',
|
||||
filenamePart: 'size-lifestyle',
|
||||
promptTemplate: '生成玩具尺寸对比宣发图:{character}. 手持或桌面生活方式场景,体现真实大小和可抱感,可加入尺寸文案占位。',
|
||||
checklist: marketingChecklist,
|
||||
},
|
||||
{
|
||||
id: 'mkt_social_vertical',
|
||||
kind: 'marketing',
|
||||
view: 'social_vertical',
|
||||
title: '竖版社媒封面',
|
||||
description: '小红书、短视频封面,3:4 或 9:16。',
|
||||
required: false,
|
||||
aspectRatio: '9:16',
|
||||
filenamePart: 'social-vertical',
|
||||
promptTemplate: '生成竖版社媒封面图:{character}. 9:16,适合小红书/短视频,强视觉中心,留出标题区域,产品不变形,风格统一。',
|
||||
checklist: marketingChecklist,
|
||||
},
|
||||
{
|
||||
id: 'mkt_ecommerce_longpage',
|
||||
kind: 'marketing',
|
||||
view: 'ecommerce_longpage',
|
||||
title: '电商详情页模块',
|
||||
description: '整合概念、尺寸、材质、卖点和包装。',
|
||||
required: false,
|
||||
aspectRatio: 'long',
|
||||
filenamePart: 'ecommerce-longpage',
|
||||
promptTemplate: '生成电商详情页长图模块:{character}. 结构化版式,包含角色故事、核心卖点、尺寸、材质、细节、包装展示,中文标题和短文案占位。',
|
||||
checklist: marketingChecklist,
|
||||
},
|
||||
];
|
||||
|
||||
export const PACK_TEMPLATES: Record<PackKind, AssetTemplate[]> = {
|
||||
patent: PATENT_TEMPLATES,
|
||||
production: PRODUCTION_TEMPLATES,
|
||||
marketing: MARKETING_TEMPLATES,
|
||||
};
|
||||
|
||||
export function getPackTemplates(kind: PackKind): AssetTemplate[] {
|
||||
return PACK_TEMPLATES[kind];
|
||||
}
|
||||
|
||||
export function renderCharacterSummary(spec: CharacterSpec): string {
|
||||
return [
|
||||
`${spec.name},${spec.oneLiner}`,
|
||||
`目标用户:${spec.targetUser}`,
|
||||
`形态:${spec.speciesShape}`,
|
||||
`比例:${spec.bodyRatio}`,
|
||||
`五官:${spec.faceFeatures}`,
|
||||
`配色:${spec.colorPalette.join('、')}`,
|
||||
`材料:${spec.materials.join('、')}`,
|
||||
`配件:${spec.accessories.join('、')}`,
|
||||
`识别元素:${spec.signatureElements.join('、')}`,
|
||||
`专利重点:${spec.patentFocus.join('、')}`,
|
||||
`营销角度:${spec.marketingAngle.join('、')}`,
|
||||
`不要出现:${spec.negativePrompt}`,
|
||||
].join(';');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user