Fraser commited on
Commit
d5e2d02
·
1 Parent(s): a7ae22e

less terse visual description

Browse files
src/lib/components/PicletGenerator/PicletGenerator.svelte CHANGED
@@ -341,7 +341,7 @@ Format your response exactly as follows:
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 {
@@ -446,7 +446,7 @@ Create a concise visual description (1-3 sentences, max 100 words). Focus only o
446
 
447
  try {
448
  const output = await fluxClient.predict("/infer", [
449
- `${workflowState.imagePrompt}\nNow generate an Anime image of the monster in an idle pose with a plain dark-grey background. This is a ${tier} tier monster with a ${tierDescriptions[tier as keyof typeof tierDescriptions]}. The monster should not be attacking or in motion. The full monster must be visible within the frame.`,
450
  0, // seed
451
  true, // randomizeSeed
452
  1024, // width
@@ -809,6 +809,15 @@ Write your response within \`\`\`json\`\`\``;
809
  // Fix invalid priority values like "priority": +1 to "priority": 1
810
  cleanJson = cleanJson.replace(/"priority":\s*\+(\d+)/g, '"priority": $1');
811
 
 
 
 
 
 
 
 
 
 
812
  const parsedStats = JSON.parse(cleanJson.trim());
813
 
814
  // Validate the battle-ready monster structure
 
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
+ {Extensive visual description of the Pokémon style monster for image generation. Focus on key visual elements: body shape, colors, distinctive features, pose. Keep this optimized for AI image generation.}
345
  \`\`\``;
346
 
347
  try {
 
446
 
447
  try {
448
  const output = await fluxClient.predict("/infer", [
449
+ `${workflowState.imagePrompt}\nNow generate an Pokémon Anime image of the monster in an idle pose with a plain dark-grey background. This is a ${tier} tier monster with a ${tierDescriptions[tier as keyof typeof tierDescriptions]}. The monster should not be attacking or in motion. The full monster must be visible within the frame.`,
450
  0, // seed
451
  true, // randomizeSeed
452
  1024, // width
 
809
  // Fix invalid priority values like "priority": +1 to "priority": 1
810
  cleanJson = cleanJson.replace(/"priority":\s*\+(\d+)/g, '"priority": $1');
811
 
812
+ // Fix unescaped newlines in string values
813
+ cleanJson = cleanJson.replace(/"([^"\\]*)(?:\\.|[^"\\])*"/g, (match) => {
814
+ // Only process if this looks like a string value (not a property name)
815
+ if (match.includes('\n')) {
816
+ return match.replace(/\n/g, '\\n').replace(/\r/g, '\\r');
817
+ }
818
+ return match;
819
+ });
820
+
821
  const parsedStats = JSON.parse(cleanJson.trim());
822
 
823
  // Validate the battle-ready monster structure