Fraser commited on
Commit
55f5c6c
·
1 Parent(s): a017c89
src/lib/components/PicletGenerator/PicletGenerator.svelte CHANGED
@@ -338,7 +338,10 @@ Format your response exactly as follows:
338
  {Creative name that hints at the original object}
339
 
340
  # Monster Description
341
- {Detailed physical description showing how the object becomes a creature. Ensure the creature uses all the unique attributes of the object. Include colors, shapes, materials, eyes, limbs, mouth, and distinctive features. This section should be comprehensive as it will be used for both stats generation and image creation.}
 
 
 
342
  \`\`\``;
343
 
344
  try {
@@ -370,9 +373,9 @@ Format your response exactly as follows:
370
  }
371
  }
372
 
373
- // Ensure the response starts with expected markdown headers
374
- if (!cleanedResponse.includes('# Object Rarity') || !cleanedResponse.includes('# Monster Name')) {
375
- console.warn('Response does not contain expected markdown structure');
376
  }
377
 
378
  workflowState.picletConcept = cleanedResponse;
@@ -390,13 +393,13 @@ Format your response exactly as follows:
390
  throw new Error(`HunyuanTurbos service not available or no concept/caption available for prompt generation`);
391
  }
392
 
393
- // Extract the Monster Description from the structured concept
394
- const visualDescMatch = workflowState.picletConcept.match(/# Monster Description\s*\n([\s\S]*?)(?=#|$)/);
395
 
396
- if (visualDescMatch && visualDescMatch[1]) {
397
- workflowState.imagePrompt = visualDescMatch[1].trim();
398
- console.log('Extracted visual description for image generation:', workflowState.imagePrompt);
399
- return; // Skip qwen3 call since we have the description
400
  }
401
 
402
  // Fallback: if format parsing fails, use qwen3 to extract visual description
 
338
  {Creative name that hints at the original object}
339
 
340
  # Monster Description
341
+ {Detailed physical description showing how the object becomes a creature. Ensure the creature uses all the unique attributes of the object. Include colors, shapes, materials, eyes, limbs, mouth, and distinctive features. This section will be used for stats generation and lore.}
342
+
343
+ # Monster Image Prompt
344
+ {Concise 1-2 sentence visual description for image generation. Focus only on key visual elements: body shape, colors, distinctive features, pose. Keep this terse and optimized for AI image generation.}
345
  \`\`\``;
346
 
347
  try {
 
373
  }
374
  }
375
 
376
+ // Ensure the response contains expected markdown headers
377
+ if (!cleanedResponse.includes('# Object Rarity') || !cleanedResponse.includes('# Monster Name') || !cleanedResponse.includes('# Monster Image Prompt')) {
378
+ console.warn('Response does not contain expected markdown structure (missing Object Rarity, Monster Name, or Monster Image Prompt)');
379
  }
380
 
381
  workflowState.picletConcept = cleanedResponse;
 
393
  throw new Error(`HunyuanTurbos service not available or no concept/caption available for prompt generation`);
394
  }
395
 
396
+ // Extract the Monster Image Prompt from the structured concept
397
+ const imagePromptMatch = workflowState.picletConcept.match(/# Monster Image Prompt\s*\n([\s\S]*?)(?=^#|$)/m);
398
 
399
+ if (imagePromptMatch && imagePromptMatch[1]) {
400
+ workflowState.imagePrompt = imagePromptMatch[1].trim();
401
+ console.log('Extracted image prompt for generation:', workflowState.imagePrompt);
402
+ return; // Skip fallback call since we have the prompt
403
  }
404
 
405
  // Fallback: if format parsing fails, use qwen3 to extract visual description