Upload latest code and optimized prompts (v6)
This commit is contained in:
629
lib/template-config.js
Normal file
629
lib/template-config.js
Normal file
@@ -0,0 +1,629 @@
|
||||
/**
|
||||
* 可配置的套路模板系统
|
||||
* 运营人员可以自定义每张图的布局和内容
|
||||
*/
|
||||
|
||||
// ============================================================
|
||||
// 默认套路配置(基于真实交付成品分析)
|
||||
// ============================================================
|
||||
|
||||
const DEFAULT_MAIN_TEMPLATES = {
|
||||
// Main_01: 场景首图 + 卖点文字
|
||||
Main_01: {
|
||||
type: 'lifestyle_with_features',
|
||||
name: '场景首图+卖点',
|
||||
aspectRatio: '1:1',
|
||||
layout: {
|
||||
scene: 'left-center', // 场景图位置
|
||||
title: 'center-bottom', // 标题位置
|
||||
features: 'bottom-row' // 卖点位置
|
||||
},
|
||||
config: {
|
||||
title: 'DESIGNED FOR COMFORTABLE RECOVERY',
|
||||
titleStyle: 'curved-banner', // curved-banner | simple | none
|
||||
features: [
|
||||
{ icon: 'egg', text: 'LIGHTER THAN AN EGG' },
|
||||
{ icon: 'water', text: 'WATERPROOF & EASY WIPE' },
|
||||
{ icon: 'cloud', text: 'BREATHABLE COTTON LINING' }
|
||||
],
|
||||
background: 'warm-home'
|
||||
}
|
||||
},
|
||||
|
||||
// Main_02: 白底平铺 + 局部放大(关键改进!)
|
||||
Main_02: {
|
||||
type: 'product_with_callouts',
|
||||
name: '白底平铺+细节放大',
|
||||
aspectRatio: '1:1',
|
||||
layout: {
|
||||
product: 'center',
|
||||
callouts: 'corners' // 放大镜效果在角落
|
||||
},
|
||||
config: {
|
||||
title: 'DURABLE WATERPROOF PU LAYER',
|
||||
titlePosition: 'top',
|
||||
callouts: [
|
||||
{
|
||||
position: 'bottom-left',
|
||||
target: 'material-edge',
|
||||
label: 'DURABLE WATERPROOF PU LAYER',
|
||||
hasArrow: true
|
||||
},
|
||||
{
|
||||
position: 'bottom-right',
|
||||
target: 'neck-binding',
|
||||
label: 'DOUBLE-LAYER COMFORT',
|
||||
hasArrow: true
|
||||
}
|
||||
],
|
||||
background: 'white'
|
||||
}
|
||||
},
|
||||
|
||||
// Main_03: 功能调节展示
|
||||
Main_03: {
|
||||
type: 'feature_showcase',
|
||||
name: '功能调节展示',
|
||||
aspectRatio: '1:1',
|
||||
layout: {
|
||||
mainScene: 'left',
|
||||
featureCircles: 'right-column'
|
||||
},
|
||||
config: {
|
||||
title: 'ADJUSTABLE STRAP FOR A SECURE FIT',
|
||||
titlePosition: 'top-left',
|
||||
mainScene: {
|
||||
type: 'cat-wearing',
|
||||
background: 'lifestyle'
|
||||
},
|
||||
featureCircles: [
|
||||
{ label: 'SECURE THE ADJUSTABLE BELLY STRAP', showDetail: 'velcro-close-up' },
|
||||
{ label: 'ADJUST FOR A SNUG FIT', showDetail: 'full-product-view' }
|
||||
],
|
||||
background: 'matching-color' // 使用产品主色作为背景
|
||||
}
|
||||
},
|
||||
|
||||
// Main_04: 多场景使用(4宫格)
|
||||
Main_04: {
|
||||
type: 'multi_scenario_grid',
|
||||
name: '多场景使用',
|
||||
aspectRatio: '1:1',
|
||||
layout: {
|
||||
grid: '2x2',
|
||||
captionPosition: 'below-each'
|
||||
},
|
||||
config: {
|
||||
scenarios: [
|
||||
{ scene: 'standing', caption: '• HYGIENIC & EASY TO CLEAN', subtext: 'WATERPROOF OUTER LAYER' },
|
||||
{ scene: 'eating', caption: '• UNRESTRICTED EATING/DRINKING', subtext: 'SPECIALLY DESIGNED OPENING' },
|
||||
{ scene: 'playing', caption: '• REVERSIBLE WEAR', subtext: 'FLIP-OVER DESIGN' },
|
||||
{ scene: 'sleeping', caption: '• 360° COMFORT', subtext: 'FREE MOVEMENT' }
|
||||
],
|
||||
background: 'warm-beige'
|
||||
}
|
||||
},
|
||||
|
||||
// Main_05: 尺寸图
|
||||
Main_05: {
|
||||
type: 'size_chart',
|
||||
name: '尺寸图',
|
||||
aspectRatio: '1:1',
|
||||
layout: {
|
||||
product: 'top-center',
|
||||
table: 'bottom'
|
||||
},
|
||||
config: {
|
||||
title: 'PRODUCT SIZE',
|
||||
measurements: ['NECK', 'WIDTH'],
|
||||
sizeChart: {
|
||||
XS: { neck: '5.6-6.8IN', depth: '3.2IN' },
|
||||
S: { neck: '7.2-8.4IN', depth: '4IN' },
|
||||
M: { neck: '8.8-10.4IN', depth: '5IN' },
|
||||
L: { neck: '10.8-12.4IN', depth: '6IN' },
|
||||
XL: { neck: '12.8-14.4IN', depth: '7IN' }
|
||||
},
|
||||
footer: 'NOTE: ALWAYS MEASURE YOUR PET\'S NECK BEFORE SELECTING A SIZE'
|
||||
}
|
||||
},
|
||||
|
||||
// Main_06: 多角度展示
|
||||
Main_06: {
|
||||
type: 'multiple_angles',
|
||||
name: '多角度展示',
|
||||
aspectRatio: '1:1',
|
||||
layout: {
|
||||
images: 'side-by-side',
|
||||
divider: 'curved-line'
|
||||
},
|
||||
config: {
|
||||
angles: [
|
||||
{ view: 'front', petType: 'cat' },
|
||||
{ view: 'side', petType: 'cat' }
|
||||
],
|
||||
background: 'warm-interior'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const DEFAULT_APLUS_TEMPLATES = {
|
||||
// APlus_01: 品牌横幅
|
||||
APlus_01: {
|
||||
type: 'brand_banner',
|
||||
name: '品牌横幅',
|
||||
aspectRatio: '3:2',
|
||||
config: {
|
||||
brandName: 'TOUCHDOG',
|
||||
productName: 'CAT SOFT CONE COLLAR',
|
||||
brandStyle: 'playful-curved', // 品牌字体风格
|
||||
brandColor: '#E8A87C', // 珊瑚色
|
||||
scene: 'cat-on-furniture',
|
||||
background: 'warm-home'
|
||||
}
|
||||
},
|
||||
|
||||
// APlus_02: 对比图(关键改进!)
|
||||
APlus_02: {
|
||||
type: 'comparison',
|
||||
name: '对比图',
|
||||
aspectRatio: '3:2',
|
||||
layout: {
|
||||
left: 'our-product',
|
||||
right: 'competitor',
|
||||
center: 'none' // 不要中间的产品图!
|
||||
},
|
||||
config: {
|
||||
leftSide: {
|
||||
label: 'OUR',
|
||||
labelBg: '#E8876C',
|
||||
checkmark: true,
|
||||
colorful: true,
|
||||
sellingPoints: [
|
||||
'CLOUD-LIGHT COMFORT',
|
||||
'WIDER & CLEARER',
|
||||
'FOLDABLE & PORTABLE'
|
||||
]
|
||||
},
|
||||
rightSide: {
|
||||
label: 'OTHER',
|
||||
labelBg: '#808080',
|
||||
xmark: true,
|
||||
grayscale: true,
|
||||
weaknesses: [
|
||||
'HEAVY & BULKY',
|
||||
'BLOCKS VISION & MOVEMENT',
|
||||
'HARD TO STORE'
|
||||
]
|
||||
},
|
||||
background: 'warm-beige'
|
||||
}
|
||||
},
|
||||
|
||||
// APlus_03: 功能细节
|
||||
APlus_03: {
|
||||
type: 'feature_details',
|
||||
name: '功能细节',
|
||||
aspectRatio: '3:2',
|
||||
config: {
|
||||
title: 'ENGINEERED FOR UNCOMPROMISED COMFORT',
|
||||
detailImages: [
|
||||
{ focus: 'inner-lining', caption: 'STURDY AND BREATHABLE', subtext: 'DURABLE AND COMFORTABLE' },
|
||||
{ focus: 'wearing-with-size', caption: 'EASY TO CLEAN, STYLISH', subtext: 'AND ATTRACTIVE' },
|
||||
{ focus: 'stitching-detail', caption: 'REINFORCED STITCHING', subtext: 'AND DURABLE FABRIC' }
|
||||
],
|
||||
background: 'warm-beige'
|
||||
}
|
||||
},
|
||||
|
||||
// APlus_04: 多场景横版
|
||||
APlus_04: {
|
||||
type: 'multi_scenario_horizontal',
|
||||
name: '多场景横版',
|
||||
aspectRatio: '3:2',
|
||||
config: {
|
||||
scenarios: [
|
||||
{ scene: 'standing', caption: '• HYGIENIC & EASY TO CLEAN' },
|
||||
{ scene: 'eating', caption: '• UNRESTRICTED EATING/DRINKING' },
|
||||
{ scene: 'playing', caption: '• REVERSIBLE WEAR' },
|
||||
{ scene: 'sleeping', caption: '• 360° COMFORT' }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
// APlus_05: 多角度横版
|
||||
APlus_05: {
|
||||
type: 'multiple_angles_horizontal',
|
||||
name: '多角度横版',
|
||||
aspectRatio: '3:2',
|
||||
config: {
|
||||
angles: ['front', 'side'],
|
||||
dividerStyle: 'curved'
|
||||
}
|
||||
},
|
||||
|
||||
// APlus_06: 尺寸表横版
|
||||
APlus_06: {
|
||||
type: 'size_chart_horizontal',
|
||||
name: '尺寸表横版',
|
||||
aspectRatio: '3:2',
|
||||
config: {
|
||||
title: 'PRODUCT SIZE',
|
||||
layout: 'product-left-table-right'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
// 从配置生成Prompt的函数
|
||||
// ============================================================
|
||||
|
||||
function generatePromptFromConfig(templateConfig, product, skuInfo) {
|
||||
const { type, config, layout } = templateConfig;
|
||||
|
||||
// 基础产品描述
|
||||
const productDesc = product.goldenDescription || 'Pet recovery cone collar';
|
||||
|
||||
switch (type) {
|
||||
case 'lifestyle_with_features':
|
||||
return generateLifestyleWithFeatures(productDesc, config, skuInfo);
|
||||
|
||||
case 'product_with_callouts':
|
||||
return generateProductWithCallouts(productDesc, config, skuInfo);
|
||||
|
||||
case 'feature_showcase':
|
||||
return generateFeatureShowcase(productDesc, config, skuInfo);
|
||||
|
||||
case 'multi_scenario_grid':
|
||||
return generateMultiScenarioGrid(productDesc, config, skuInfo);
|
||||
|
||||
case 'size_chart':
|
||||
return generateSizeChart(productDesc, config, skuInfo);
|
||||
|
||||
case 'multiple_angles':
|
||||
return generateMultipleAngles(productDesc, config, skuInfo);
|
||||
|
||||
case 'brand_banner':
|
||||
return generateBrandBanner(productDesc, config, skuInfo);
|
||||
|
||||
case 'comparison':
|
||||
return generateComparison(productDesc, config, skuInfo);
|
||||
|
||||
case 'feature_details':
|
||||
return generateFeatureDetails(productDesc, config, skuInfo);
|
||||
|
||||
default:
|
||||
return generateGenericPrompt(productDesc, config, skuInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 各类型Prompt生成函数
|
||||
// ============================================================
|
||||
|
||||
function generateLifestyleWithFeatures(productDesc, config, skuInfo) {
|
||||
return `
|
||||
[AMAZON MAIN IMAGE - LIFESTYLE WITH FEATURE TEXT]
|
||||
|
||||
PRODUCT (MUST MATCH REFERENCE IMAGE EXACTLY):
|
||||
${productDesc}
|
||||
|
||||
SCENE:
|
||||
- Beautiful ${skuInfo.petType || 'cat'} wearing the product comfortably
|
||||
- Warm, cozy home interior background (soft focus)
|
||||
- Product clearly visible, occupies 50-60% of frame
|
||||
- Pet looks comfortable and relaxed
|
||||
|
||||
TEXT OVERLAY REQUIREMENTS:
|
||||
- ${config.titleStyle === 'curved-banner' ? 'CURVED BANNER in muted blue (#8BB8C4) across center' : 'SIMPLE TITLE at center-bottom'}
|
||||
- TITLE TEXT: "${config.title}" in white, clean sans-serif font
|
||||
- BOTTOM ROW: 3 feature boxes in rounded rectangles
|
||||
${config.features.map((f, i) => ` - Box ${i+1}: "${f.text}" with ${f.icon} icon`).join('\n')}
|
||||
|
||||
STYLE:
|
||||
- Professional Amazon product photography
|
||||
- Warm color palette
|
||||
- Clean, readable text
|
||||
- Subtle paw print watermarks
|
||||
- 8K quality, 1:1 aspect ratio
|
||||
|
||||
CRITICAL: Product must match reference image EXACTLY in shape, color, and material.
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function generateProductWithCallouts(productDesc, config, skuInfo) {
|
||||
return `
|
||||
[AMAZON MAIN IMAGE - PRODUCT WITH DETAIL CALLOUTS]
|
||||
|
||||
PRODUCT (MUST MATCH REFERENCE IMAGE EXACTLY):
|
||||
${productDesc}
|
||||
|
||||
LAYOUT:
|
||||
- TOP: Title "${config.title}" in dark green banner with white text
|
||||
- CENTER: Product C-shape flat lay view on white/light background
|
||||
- CALLOUT CIRCLES: Magnifying glass style detail views with arrows pointing to product
|
||||
|
||||
CALLOUT DETAILS:
|
||||
${config.callouts.map(c => `- ${c.position.toUpperCase()}: Circular magnified view of ${c.target}
|
||||
Label: "${c.label}"
|
||||
Arrow pointing from circle to corresponding area on product`).join('\n')}
|
||||
|
||||
STYLE:
|
||||
- Clean product photography with infographic elements
|
||||
- Dark green (#2D4A3E) for title banner
|
||||
- Thin lines/arrows connecting callouts to product
|
||||
- Professional Amazon listing style
|
||||
- 8K quality, 1:1 aspect ratio
|
||||
|
||||
CRITICAL: Product must show C-shaped opening clearly. Match reference image EXACTLY.
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function generateFeatureShowcase(productDesc, config, skuInfo) {
|
||||
return `
|
||||
[AMAZON MAIN IMAGE - FEATURE SHOWCASE]
|
||||
|
||||
PRODUCT (MUST MATCH REFERENCE IMAGE EXACTLY):
|
||||
${productDesc}
|
||||
|
||||
LAYOUT:
|
||||
- BACKGROUND: Solid color matching product main color (use product's primary color)
|
||||
- TOP-LEFT: Large title "${config.title}" in dark text
|
||||
- LEFT SIDE (60%): Main lifestyle scene - ${skuInfo.petType || 'cat'} wearing product, walking through doorway/arch
|
||||
- RIGHT SIDE (40%): 2 feature detail circles stacked vertically
|
||||
|
||||
FEATURE CIRCLES:
|
||||
${config.featureCircles.map((f, i) => `${i+1}. Circle showing: ${f.showDetail}
|
||||
Button/label below: "${f.label}"`).join('\n')}
|
||||
|
||||
STYLE:
|
||||
- Lifestyle photography meets infographic
|
||||
- Rounded rectangle buttons for labels
|
||||
- Paw print decorations scattered on background
|
||||
- Modern, clean design
|
||||
- 8K quality, 1:1 aspect ratio
|
||||
|
||||
CRITICAL: Product color and shape must match reference image EXACTLY.
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function generateMultiScenarioGrid(productDesc, config, skuInfo) {
|
||||
return `
|
||||
[AMAZON MAIN IMAGE - MULTI-SCENARIO 2x2 GRID]
|
||||
|
||||
PRODUCT (MUST MATCH REFERENCE IMAGE EXACTLY):
|
||||
${productDesc}
|
||||
|
||||
LAYOUT: 2x2 grid of scenes, each in rounded rectangle frame
|
||||
|
||||
${config.scenarios.map((s, i) => `SCENE ${i+1} (${['TOP-LEFT', 'TOP-RIGHT', 'BOTTOM-LEFT', 'BOTTOM-RIGHT'][i]}):
|
||||
- ${skuInfo.petType || 'Cat'} ${s.scene} while wearing product
|
||||
- Caption below: "${s.caption}"
|
||||
- Subtext: "${s.subtext}"`).join('\n\n')}
|
||||
|
||||
BACKGROUND: Warm beige (#F5EDE4) with subtle paw print watermarks
|
||||
|
||||
STYLE:
|
||||
- Each scene in rounded rectangle with slight shadow
|
||||
- Captions in dark text, clean sans-serif
|
||||
- Professional lifestyle photography
|
||||
- 8K quality, 1:1 aspect ratio
|
||||
|
||||
CRITICAL: Product in ALL 4 scenes must be identical and match reference image.
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function generateSizeChart(productDesc, config, skuInfo) {
|
||||
return `
|
||||
[AMAZON MAIN IMAGE - SIZE CHART INFOGRAPHIC]
|
||||
|
||||
PRODUCT (MUST MATCH REFERENCE IMAGE EXACTLY):
|
||||
${productDesc}
|
||||
|
||||
LAYOUT:
|
||||
- TOP: Title "${config.title}" in bold dark text
|
||||
- CENTER: Product flat lay with measurement arrows and labels
|
||||
- Arrow across neck opening: "NECK"
|
||||
- Arrow across width: "WIDTH"
|
||||
- BOTTOM: Size chart table
|
||||
|
||||
SIZE CHART TABLE (clean, rounded corners):
|
||||
| SIZE | NECK CIRCUMFERENCE | DEPTH |
|
||||
${Object.entries(config.sizeChart).map(([size, dims]) =>
|
||||
`| ${size} | ${dims.neck} | ${dims.depth} |`).join('\n')}
|
||||
|
||||
FOOTER TEXT: "${config.footer}"
|
||||
|
||||
BACKGROUND: Warm beige with subtle paw prints
|
||||
|
||||
STYLE:
|
||||
- Clean infographic design
|
||||
- Table with alternating row colors
|
||||
- Professional product photography
|
||||
- 8K quality, 1:1 aspect ratio
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function generateMultipleAngles(productDesc, config, skuInfo) {
|
||||
return `
|
||||
[AMAZON MAIN IMAGE - MULTIPLE ANGLES]
|
||||
|
||||
PRODUCT (MUST MATCH REFERENCE IMAGE EXACTLY):
|
||||
${productDesc}
|
||||
|
||||
LAYOUT:
|
||||
- Split view with decorative curved divider in center
|
||||
- LEFT: ${skuInfo.petType || 'Cat'} wearing product, ${config.angles[0].view} view
|
||||
- RIGHT: Same ${skuInfo.petType || 'cat'} or similar, ${config.angles[1].view} view
|
||||
|
||||
SCENE:
|
||||
- Warm home interior background
|
||||
- Both pets look comfortable
|
||||
- Product clearly visible from different angles
|
||||
|
||||
STYLE:
|
||||
- Lifestyle photography
|
||||
- Soft warm lighting
|
||||
- Decorative curved line or wave between images
|
||||
- NO text overlay
|
||||
- 8K quality, 1:1 aspect ratio
|
||||
|
||||
CRITICAL: Product must be IDENTICAL in both views, matching reference image exactly.
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function generateBrandBanner(productDesc, config, skuInfo) {
|
||||
return `
|
||||
[AMAZON A+ BRAND BANNER - HORIZONTAL]
|
||||
|
||||
PRODUCT (MUST MATCH REFERENCE IMAGE EXACTLY):
|
||||
${productDesc}
|
||||
|
||||
LAYOUT (970x600px aspect ratio):
|
||||
- LEFT 40%: Brand text area with decorative elements
|
||||
- RIGHT 60%: Lifestyle scene
|
||||
|
||||
LEFT SIDE:
|
||||
- Brand name "${config.brandName}" in playful, slightly curved font
|
||||
- Color: ${config.brandColor} (coral/salmon)
|
||||
- Decorative paw prints around text
|
||||
- Product name "${config.productName}" below in smaller gray text
|
||||
|
||||
RIGHT SIDE:
|
||||
- ${skuInfo.petType || 'Cat'} wearing product on modern furniture
|
||||
- Warm cozy interior background
|
||||
|
||||
STYLE:
|
||||
- Professional Amazon A+ content
|
||||
- Warm, inviting color palette
|
||||
- 8K quality, ~1.6:1 aspect ratio
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function generateComparison(productDesc, config, skuInfo) {
|
||||
const { leftSide, rightSide } = config;
|
||||
|
||||
return `
|
||||
[AMAZON A+ COMPARISON IMAGE - SPLIT SCREEN]
|
||||
|
||||
PRODUCT (MUST MATCH REFERENCE IMAGE EXACTLY):
|
||||
${productDesc}
|
||||
|
||||
LAYOUT: Two-column comparison, NO center product image
|
||||
|
||||
LEFT SIDE (OUR PRODUCT):
|
||||
- GREEN CHECKMARK icon at top
|
||||
- "${leftSide.label}" label on ${leftSide.labelBg} background
|
||||
- ${skuInfo.petType || 'Cat'} wearing OUR PRODUCT (must match reference exactly!)
|
||||
- Cat looks HAPPY and comfortable
|
||||
- FULL COLOR, warm tones
|
||||
- Selling points in white text on colored background:
|
||||
${leftSide.sellingPoints.map(p => ` • ${p}`).join('\n')}
|
||||
|
||||
RIGHT SIDE (COMPETITOR):
|
||||
- RED X-MARK icon at top
|
||||
- "${rightSide.label}" label on ${rightSide.labelBg} background
|
||||
- ${skuInfo.petType || 'Cat'} wearing HARD PLASTIC transparent cone
|
||||
- Cat looks SAD/uncomfortable
|
||||
- GRAYSCALE/desaturated
|
||||
- Weaknesses in gray text:
|
||||
${rightSide.weaknesses.map(p => ` • ${p}`).join('\n')}
|
||||
|
||||
BACKGROUND: Warm beige (#F5EDE4) with paw print watermarks
|
||||
|
||||
STYLE:
|
||||
- Clear visual contrast between sides
|
||||
- Professional comparison layout
|
||||
- Clean readable text
|
||||
- 8K quality, ~1.6:1 aspect ratio
|
||||
|
||||
CRITICAL:
|
||||
- LEFT product must match reference image EXACTLY (our soft cone)
|
||||
- RIGHT shows generic hard plastic cone (NOT our product)
|
||||
- NO product image in the center
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function generateFeatureDetails(productDesc, config, skuInfo) {
|
||||
return `
|
||||
[AMAZON A+ FEATURE DETAILS - HORIZONTAL]
|
||||
|
||||
PRODUCT (MUST MATCH REFERENCE IMAGE EXACTLY):
|
||||
${productDesc}
|
||||
|
||||
LAYOUT:
|
||||
- TOP: Large title "${config.title}" in bold dark font
|
||||
- MIDDLE: 3 detail images in rounded rectangles, evenly spaced
|
||||
|
||||
${config.detailImages.map((d, i) => `DETAIL ${i+1}:
|
||||
- Focus: ${d.focus}
|
||||
- Caption: "${d.caption}"
|
||||
- Subtext: "${d.subtext}"`).join('\n\n')}
|
||||
|
||||
BACKGROUND: Warm beige (#F5EDE4) with subtle paw print watermarks
|
||||
|
||||
STYLE:
|
||||
- Professional product detail photography
|
||||
- Clean modern typography
|
||||
- Rounded rectangle frames for each detail
|
||||
- 8K quality, ~1.6:1 aspect ratio
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function generateGenericPrompt(productDesc, config, skuInfo) {
|
||||
return `
|
||||
[AMAZON PRODUCT IMAGE]
|
||||
|
||||
PRODUCT:
|
||||
${productDesc}
|
||||
|
||||
REQUIREMENTS:
|
||||
- Professional product photography
|
||||
- Match reference image exactly
|
||||
- High quality, clear details
|
||||
- 8K resolution
|
||||
`.trim();
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// 导出
|
||||
// ============================================================
|
||||
|
||||
module.exports = {
|
||||
DEFAULT_MAIN_TEMPLATES,
|
||||
DEFAULT_APLUS_TEMPLATES,
|
||||
generatePromptFromConfig,
|
||||
|
||||
// 生成所有12张图的Prompts
|
||||
generateAllPrompts: (product, skuInfo, customConfig = {}) => {
|
||||
const mainTemplates = { ...DEFAULT_MAIN_TEMPLATES, ...customConfig.main };
|
||||
const aplusTemplates = { ...DEFAULT_APLUS_TEMPLATES, ...customConfig.aplus };
|
||||
|
||||
const prompts = [];
|
||||
|
||||
// 主图6张
|
||||
for (const [id, template] of Object.entries(mainTemplates)) {
|
||||
prompts.push({
|
||||
id,
|
||||
name: template.name,
|
||||
aspectRatio: template.aspectRatio || '1:1',
|
||||
type: template.type,
|
||||
prompt: generatePromptFromConfig(template, product, skuInfo)
|
||||
});
|
||||
}
|
||||
|
||||
// A+图6张
|
||||
for (const [id, template] of Object.entries(aplusTemplates)) {
|
||||
prompts.push({
|
||||
id,
|
||||
name: template.name,
|
||||
aspectRatio: template.aspectRatio || '3:2',
|
||||
type: template.type,
|
||||
prompt: generatePromptFromConfig(template, product, skuInfo)
|
||||
});
|
||||
}
|
||||
|
||||
return prompts;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user