Fraser commited on
Commit
310d740
·
1 Parent(s): 5650eb2
src/lib/components/PicletGenerator/PicletGenerator.svelte CHANGED
@@ -875,6 +875,9 @@ Write your response within \`\`\`json\`\`\``;
875
 
876
  console.log('Final JSON to parse (length: ' + cleanJson.length + '):', cleanJson.substring(0, 500) + '...');
877
 
 
 
 
878
  const parsedStats = JSON.parse(cleanJson.trim());
879
 
880
  // Validate the battle-ready monster structure
 
875
 
876
  console.log('Final JSON to parse (length: ' + cleanJson.length + '):', cleanJson.substring(0, 500) + '...');
877
 
878
+ // Fix invalid priority values like "priority": +1 to "priority": 1
879
+ cleanJson = cleanJson.replace(/"priority":\s*\+(\d+)/g, '"priority": $1');
880
+
881
  const parsedStats = JSON.parse(cleanJson.trim());
882
 
883
  // Validate the battle-ready monster structure