Fraser commited on
Commit
27fe49f
·
1 Parent(s): 1ac7e36

better json gen

Browse files
src/lib/components/MonsterGenerator/MonsterGenerator.svelte CHANGED
@@ -54,11 +54,7 @@ Include all of its visual details, format the description as a single long sente
54
 
55
  The output should be formatted as a JSON instance that conforms to the JSON schema below.
56
 
57
- As an example, for the schema {"properties": {"foo": {"title": "Foo", "description": "a list of strings", "type": "array", "items": {"type": "string"}}}, "required": ["foo"]}
58
- the object {"foo": ["bar", "baz"]} is a well-formatted instance of the schema. The object {"properties": {"foo": ["bar", "baz"]}} is not well-formatted.
59
-
60
- Here is the output schema:
61
- \`\`\`
62
  {
63
  "properties": {
64
  "name": {"type": "string", "description": "The monster's unique name"},
@@ -78,16 +74,14 @@ Here is the output schema:
78
  "specialActionName": {"type": "string", "description": "Name of the monster's ultimate move (one use per battle)"},
79
  "specialActionDescription": {"type": "string", "description": "Describe this powerful finishing move and its dramatic effects in battle"}
80
  },
81
- "required": ["name", "description", "rarity", "HP", "defence", "attack", "speed", "specialPassiveTraitDescription",
82
- "attackActionName", "attackActionDescription", "buffActionName", "buffActionDescription",
83
- "debuffActionName", "debuffActionDescription", "specialActionName", "specialActionDescription"]
84
  }
85
  \`\`\`
86
 
87
  Remember to base the stats on how unique/powerful the original object was. Common objects should have lower stats, unique objects should have higher stats.
88
 
89
- Respond with only valid JSON.`;
90
-
91
  async function handleImageSelected(file: File) {
92
  if (!joyCaptionClient || !rwkvClient || !fluxClient) {
93
  state.error = "Services not connected. Please wait...";
@@ -332,7 +326,7 @@ Respond with only valid JSON.`;
332
  }
333
 
334
  const statsPrompt = MONSTER_STATS_PROMPT(state.monsterConcept);
335
- const systemPrompt = "You are a game designer specializing in monster stats and abilities. Always respond with valid JSON that matches the provided schema exactly.";
336
 
337
  console.log('Generating monster stats from concept');
338
 
 
54
 
55
  The output should be formatted as a JSON instance that conforms to the JSON schema below.
56
 
57
+ \`\`\`json
 
 
 
 
58
  {
59
  "properties": {
60
  "name": {"type": "string", "description": "The monster's unique name"},
 
74
  "specialActionName": {"type": "string", "description": "Name of the monster's ultimate move (one use per battle)"},
75
  "specialActionDescription": {"type": "string", "description": "Describe this powerful finishing move and its dramatic effects in battle"}
76
  },
77
+ "required": ["name", "description", "rarity", "HP", "defence", "attack", "speed", "specialPassiveTraitDescription", "attackActionName", "attackActionDescription", "buffActionName", "buffActionDescription", "debuffActionName", "debuffActionDescription", "specialActionName", "specialActionDescription"]
 
 
78
  }
79
  \`\`\`
80
 
81
  Remember to base the stats on how unique/powerful the original object was. Common objects should have lower stats, unique objects should have higher stats.
82
 
83
+ Write your response within \`\`\`json\`\`\``;
84
+
85
  async function handleImageSelected(file: File) {
86
  if (!joyCaptionClient || !rwkvClient || !fluxClient) {
87
  state.error = "Services not connected. Please wait...";
 
326
  }
327
 
328
  const statsPrompt = MONSTER_STATS_PROMPT(state.monsterConcept);
329
+ const systemPrompt = "You are a game designer specializing in monster stats and abilities. You must ONLY output valid JSON that matches the provided schema exactly. Do not include any text before or after the JSON. Your entire response should be wrapped in a ```json``` code block.";
330
 
331
  console.log('Generating monster stats from concept');
332