Fraser commited on
Commit
3c9abfc
·
1 Parent(s): 600cde8
src/lib/components/MonsterGenerator/MonsterGenerator.svelte CHANGED
@@ -75,16 +75,16 @@ Here is the output schema:
75
  "specialPassiveTraitDescription": {"type": "string", "description": "Describe a passive ability that gives this monster a unique advantage in battle"},
76
  "attackActionName": {"type": "string", "description": "Name of the monster's primary damage-dealing attack (e.g., 'Flame Burst', 'Toxic Bite')"},
77
  "attackActionDescription": {"type": "string", "description": "Describe how this attack damages the opponent and any special effects"},
78
- "boostActionName": {"type": "string", "description": "Name of the monster's self-buff ability (e.g., 'Iron Defense', 'Speed Boost')"},
79
- "boostActionDescription": {"type": "string", "description": "Describe which stats are boosted and how this improves the monster's battle performance"},
80
- "disparageActionName": {"type": "string", "description": "Name of the monster's enemy debuff ability (e.g., 'Intimidate', 'Slow Poison')"},
81
- "disparageActionDescription": {"type": "string", "description": "Describe which enemy stats are lowered and how this weakens the opponent"},
82
  "specialActionName": {"type": "string", "description": "Name of the monster's ultimate move (one use per battle)"},
83
  "specialActionDescription": {"type": "string", "description": "Describe this powerful finishing move and its dramatic effects in battle"}
84
  },
85
  "required": ["name", "description", "rarity", "HP", "defence", "attack", "speed", "specialPassiveTraitDescription",
86
- "attackActionName", "attackActionDescription", "boostActionName", "boostActionDescription",
87
- "disparageActionName", "disparageActionDescription", "specialActionName", "specialActionDescription"]
88
  }
89
  \`\`\`
90
 
@@ -214,7 +214,7 @@ Assistant: \`\`\`json`;
214
  try {
215
  const output = await rwkvClient.predict(0, [
216
  conceptPrompt,
217
- 300, // maxTokens
218
  0.7, // temperature
219
  0.8, // topP
220
  0.1, // presencePenalty
@@ -247,7 +247,7 @@ Assistant: \`\`\`json`;
247
  try {
248
  const output = await rwkvClient.predict(0, [
249
  promptGenerationPrompt,
250
- 300, // maxTokens
251
  0.7, // temperature
252
  0.8, // topP
253
  0.1, // presencePenalty
@@ -335,8 +335,8 @@ Assistant: \`\`\`json`;
335
  500, // maxTokens - more for JSON
336
  0.3, // temperature - lower for structured output
337
  0.9, // topP
338
- 0.05, // presencePenalty - lower for JSON
339
- 0.05 // countPenalty
340
  ]);
341
 
342
  console.log('Stats output:', output);
@@ -370,12 +370,30 @@ Assistant: \`\`\`json`;
370
  }
371
  }
372
 
373
- // Map specialPassiveTraitDescription to specialPassiveTrait
374
  if (parsedStats.specialPassiveTraitDescription) {
375
  parsedStats.specialPassiveTrait = parsedStats.specialPassiveTraitDescription;
376
  delete parsedStats.specialPassiveTraitDescription;
377
  }
378
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
  const stats: MonsterStats = parsedStats;
380
  state.monsterStats = stats;
381
  console.log('Monster stats generated:', stats);
 
75
  "specialPassiveTraitDescription": {"type": "string", "description": "Describe a passive ability that gives this monster a unique advantage in battle"},
76
  "attackActionName": {"type": "string", "description": "Name of the monster's primary damage-dealing attack (e.g., 'Flame Burst', 'Toxic Bite')"},
77
  "attackActionDescription": {"type": "string", "description": "Describe how this attack damages the opponent and any special effects"},
78
+ "buffActionName": {"type": "string", "description": "Name of the monster's self-enhancement ability (e.g., 'Iron Defense', 'Speed Boost')"},
79
+ "buffActionDescription": {"type": "string", "description": "Describe which stats are boosted and how this improves the monster's battle performance"},
80
+ "debuffActionName": {"type": "string", "description": "Name of the monster's enemy-weakening ability (e.g., 'Intimidate', 'Slow Poison')"},
81
+ "debuffActionDescription": {"type": "string", "description": "Describe which enemy stats are lowered and how this weakens the opponent"},
82
  "specialActionName": {"type": "string", "description": "Name of the monster's ultimate move (one use per battle)"},
83
  "specialActionDescription": {"type": "string", "description": "Describe this powerful finishing move and its dramatic effects in battle"}
84
  },
85
  "required": ["name", "description", "rarity", "HP", "defence", "attack", "speed", "specialPassiveTraitDescription",
86
+ "attackActionName", "attackActionDescription", "buffActionName", "buffActionDescription",
87
+ "debuffActionName", "debuffActionDescription", "specialActionName", "specialActionDescription"]
88
  }
89
  \`\`\`
90
 
 
214
  try {
215
  const output = await rwkvClient.predict(0, [
216
  conceptPrompt,
217
+ 600, // maxTokens
218
  0.7, // temperature
219
  0.8, // topP
220
  0.1, // presencePenalty
 
247
  try {
248
  const output = await rwkvClient.predict(0, [
249
  promptGenerationPrompt,
250
+ 600, // maxTokens
251
  0.7, // temperature
252
  0.8, // topP
253
  0.1, // presencePenalty
 
335
  500, // maxTokens - more for JSON
336
  0.3, // temperature - lower for structured output
337
  0.9, // topP
338
+ 0.0, // presencePenalty - lower for JSON
339
+ 0.0 // countPenalty
340
  ]);
341
 
342
  console.log('Stats output:', output);
 
370
  }
371
  }
372
 
373
+ // Map field names from schema to interface
374
  if (parsedStats.specialPassiveTraitDescription) {
375
  parsedStats.specialPassiveTrait = parsedStats.specialPassiveTraitDescription;
376
  delete parsedStats.specialPassiveTraitDescription;
377
  }
378
 
379
+ // Handle potential old field names from LLM
380
+ if (parsedStats.boostActionName) {
381
+ parsedStats.buffActionName = parsedStats.boostActionName;
382
+ delete parsedStats.boostActionName;
383
+ }
384
+ if (parsedStats.boostActionDescription) {
385
+ parsedStats.buffActionDescription = parsedStats.boostActionDescription;
386
+ delete parsedStats.boostActionDescription;
387
+ }
388
+ if (parsedStats.disparageActionName) {
389
+ parsedStats.debuffActionName = parsedStats.disparageActionName;
390
+ delete parsedStats.disparageActionName;
391
+ }
392
+ if (parsedStats.disparageActionDescription) {
393
+ parsedStats.debuffActionDescription = parsedStats.disparageActionDescription;
394
+ delete parsedStats.disparageActionDescription;
395
+ }
396
+
397
  const stats: MonsterStats = parsedStats;
398
  state.monsterStats = stats;
399
  console.log('Monster stats generated:', stats);
src/lib/components/MonsterGenerator/MonsterResult.svelte CHANGED
@@ -150,12 +150,12 @@
150
  <p>{workflowState.monsterStats.attackActionDescription}</p>
151
  </div>
152
  <div class="ability-item">
153
- <h5>Boost: {workflowState.monsterStats.boostActionName}</h5>
154
- <p>{workflowState.monsterStats.boostActionDescription}</p>
155
  </div>
156
  <div class="ability-item">
157
- <h5>Debuff: {workflowState.monsterStats.disparageActionName}</h5>
158
- <p>{workflowState.monsterStats.disparageActionDescription}</p>
159
  </div>
160
  <div class="ability-item">
161
  <h5>Ultimate: {workflowState.monsterStats.specialActionName}</h5>
 
150
  <p>{workflowState.monsterStats.attackActionDescription}</p>
151
  </div>
152
  <div class="ability-item">
153
+ <h5>Buff: {workflowState.monsterStats.buffActionName}</h5>
154
+ <p>{workflowState.monsterStats.buffActionDescription}</p>
155
  </div>
156
  <div class="ability-item">
157
+ <h5>Debuff: {workflowState.monsterStats.debuffActionName}</h5>
158
+ <p>{workflowState.monsterStats.debuffActionDescription}</p>
159
  </div>
160
  <div class="ability-item">
161
  <h5>Ultimate: {workflowState.monsterStats.specialActionName}</h5>
src/lib/types/index.ts CHANGED
@@ -114,10 +114,10 @@ export interface MonsterStats {
114
  specialPassiveTrait: string;
115
  attackActionName: string;
116
  attackActionDescription: string;
117
- boostActionName: string;
118
- boostActionDescription: string;
119
- disparageActionName: string;
120
- disparageActionDescription: string;
121
  specialActionName: string;
122
  specialActionDescription: string;
123
  }
 
114
  specialPassiveTrait: string;
115
  attackActionName: string;
116
  attackActionDescription: string;
117
+ buffActionName: string;
118
+ buffActionDescription: string;
119
+ debuffActionName: string;
120
+ debuffActionDescription: string;
121
  specialActionName: string;
122
  specialActionDescription: string;
123
  }