Skip to content

Commit 85c08a9

Browse files
committed
Switched prompts
1 parent 4f23a45 commit 85c08a9

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

product-image-generator/app/trigger/generate-images.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const generateImages = task({
3636
await generateImage.batchTriggerAndWait(
3737
payload.images.map((p) => ({
3838
payload: p,
39-
}))
39+
})),
4040
);
4141

4242
metadata.set("progress", {
@@ -110,9 +110,12 @@ export const generateImage = task({
110110
});
111111

112112
const stylePrompts = {
113-
"isolated-table": `Professional product photography on clean white table with studio lighting, minimalist background, commercial style. The product should be flat on to the camera.`,
114-
"lifestyle-scene": `Lifestyle product photography of a person of any gender or ethnicity in the sunshine holding the product in their hand with a big smile on their face - they should be pointing to the product. This should be a cool lifestyle shot`,
115-
"hero-shot": `Professional lifestyle shot of elegant hands holding and presenting the product, dramatic lighting, luxury commercial photography style, perfect for marketing materials, human interaction with product`,
113+
"isolated-table":
114+
`Professional lifestyle shot of elegant hands holding and presenting the product, dramatic lighting, luxury commercial photography style, perfect for marketing materials, human interaction with product`,
115+
"lifestyle-scene":
116+
`Lifestyle product photography of a person of any gender or ethnicity in the sunshine holding the product in their hand with a big smile on their face - they should be pointing to the product. This should be a cool lifestyle shot`,
117+
"hero-shot":
118+
`Create a shot of this product being used in a busy environment, with people interacting with it. The product should be the focal point of the image, and the people should be in the background.`,
116119
custom: "Professional product photography",
117120
};
118121

@@ -121,11 +124,12 @@ export type StylePrompt = keyof typeof stylePrompts;
121124
// Generate enhanced prompt for image generation
122125
function prompt(promptStyle: StylePrompt, customPrompt?: string) {
123126
// Style-specific prompts
124-
const baseStylePrompt =
125-
customPrompt || stylePrompts[promptStyle] || stylePrompts["isolated-table"];
127+
const baseStylePrompt = customPrompt || stylePrompts[promptStyle] ||
128+
stylePrompts["isolated-table"];
126129

127130
// Combine everything into one unambiguous prompt
128-
const enhancedPrompt = `${baseStylePrompt}. MANDATORY PRODUCT PRESERVATION: You MUST recreate the EXACT product from the reference image. The product must be IDENTICAL to the reference image - same brand name, same exact model number, same exact colors and color combinations, same shape, same proportions, same text, same logos, same design elements, same materials, same finish. DO NOT change any colors, DO NOT substitute different models or color variants, DO NOT modify the product itself in any way. The product must be pixel-perfect identical. Only change the background, lighting, and camera angle. If you cannot preserve the exact product, do not generate the image.`;
131+
const enhancedPrompt =
132+
`${baseStylePrompt}. MANDATORY PRODUCT PRESERVATION: You MUST recreate the EXACT product from the reference image. The product must be IDENTICAL to the reference image - same brand name, same exact model number, same exact colors and color combinations, same shape, same proportions, same text, same logos, same design elements, same materials, same finish. DO NOT change any colors, DO NOT substitute different models or color variants, DO NOT modify the product itself in any way. The product must be pixel-perfect identical. Only change the background, lighting, and camera angle. If you cannot preserve the exact product, do not generate the image.`;
129133

130134
return enhancedPrompt;
131135
}
@@ -135,8 +139,8 @@ async function uploadImageToR2(imageUrl: string, filename?: string) {
135139
const imageBuffer = Buffer.from(await image.arrayBuffer());
136140

137141
const timestamp = Date.now();
138-
const finalFilename =
139-
filename || `generated-${timestamp}.png`.replace(/[^a-zA-Z0-9.-]/g, "_");
142+
const finalFilename = filename ||
143+
`generated-${timestamp}.png`.replace(/[^a-zA-Z0-9.-]/g, "_");
140144

141145
// Generate unique key for R2
142146
const r2Key = `uploaded-images/${timestamp}-${finalFilename}`;

0 commit comments

Comments
 (0)