logs
Browse files
src/lib/components/MonsterGenerator/MonsterGenerator.svelte
CHANGED
|
@@ -222,7 +222,15 @@ Assistant: \`\`\`json`;
|
|
| 222 |
]);
|
| 223 |
|
| 224 |
console.log('RWKV output:', output);
|
| 225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
console.log('Monster concept generated:', state.monsterConcept);
|
| 227 |
|
| 228 |
if (!state.monsterConcept || state.monsterConcept.trim() === '') {
|
|
@@ -255,7 +263,15 @@ Assistant: \`\`\`json`;
|
|
| 255 |
]);
|
| 256 |
|
| 257 |
console.log('Image prompt output:', output);
|
| 258 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
console.log('Image prompt generated:', state.imagePrompt);
|
| 260 |
|
| 261 |
if (!state.imagePrompt || state.imagePrompt.trim() === '') {
|
|
@@ -340,7 +356,13 @@ Assistant: \`\`\`json`;
|
|
| 340 |
]);
|
| 341 |
|
| 342 |
console.log('Stats output:', output);
|
| 343 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 344 |
|
| 345 |
// Extract JSON from the response (remove markdown if present)
|
| 346 |
let cleanJson = jsonString;
|
|
@@ -433,25 +455,39 @@ Assistant: \`\`\`json`;
|
|
| 433 |
}
|
| 434 |
|
| 435 |
try {
|
|
|
|
|
|
|
|
|
|
| 436 |
const monsterData = {
|
| 437 |
name: state.monsterStats.name,
|
| 438 |
imageUrl: state.monsterImage.imageUrl,
|
| 439 |
-
imageData: state.monsterImage.imageData
|
| 440 |
imageCaption: state.imageCaption,
|
| 441 |
concept: state.monsterConcept,
|
| 442 |
imagePrompt: state.imagePrompt,
|
| 443 |
-
stats:
|
| 444 |
};
|
| 445 |
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 450 |
|
| 451 |
const id = await saveMonster(monsterData);
|
| 452 |
console.log('Monster auto-saved with ID:', id);
|
| 453 |
} catch (err) {
|
| 454 |
console.error('Failed to auto-save monster:', err);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
// Don't throw - we don't want to interrupt the workflow
|
| 456 |
}
|
| 457 |
}
|
|
|
|
| 222 |
]);
|
| 223 |
|
| 224 |
console.log('RWKV output:', output);
|
| 225 |
+
let conceptText = output.data[0];
|
| 226 |
+
|
| 227 |
+
// Drop any text after "User:" to prevent additional prompting
|
| 228 |
+
const userIndex = conceptText.indexOf('User:');
|
| 229 |
+
if (userIndex !== -1) {
|
| 230 |
+
conceptText = conceptText.substring(0, userIndex).trim();
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
state.monsterConcept = conceptText;
|
| 234 |
console.log('Monster concept generated:', state.monsterConcept);
|
| 235 |
|
| 236 |
if (!state.monsterConcept || state.monsterConcept.trim() === '') {
|
|
|
|
| 263 |
]);
|
| 264 |
|
| 265 |
console.log('Image prompt output:', output);
|
| 266 |
+
let promptText = output.data[0];
|
| 267 |
+
|
| 268 |
+
// Drop any text after "User:" to prevent additional prompting
|
| 269 |
+
const userIndex = promptText.indexOf('User:');
|
| 270 |
+
if (userIndex !== -1) {
|
| 271 |
+
promptText = promptText.substring(0, userIndex).trim();
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
state.imagePrompt = promptText;
|
| 275 |
console.log('Image prompt generated:', state.imagePrompt);
|
| 276 |
|
| 277 |
if (!state.imagePrompt || state.imagePrompt.trim() === '') {
|
|
|
|
| 356 |
]);
|
| 357 |
|
| 358 |
console.log('Stats output:', output);
|
| 359 |
+
let jsonString = output.data[0];
|
| 360 |
+
|
| 361 |
+
// Drop any text after "User:" to prevent additional prompting
|
| 362 |
+
const userIndex = jsonString.indexOf('User:');
|
| 363 |
+
if (userIndex !== -1) {
|
| 364 |
+
jsonString = jsonString.substring(0, userIndex).trim();
|
| 365 |
+
}
|
| 366 |
|
| 367 |
// Extract JSON from the response (remove markdown if present)
|
| 368 |
let cleanJson = jsonString;
|
|
|
|
| 455 |
}
|
| 456 |
|
| 457 |
try {
|
| 458 |
+
// Create a clean copy of stats to ensure it's serializable
|
| 459 |
+
const cleanStats = JSON.parse(JSON.stringify(state.monsterStats));
|
| 460 |
+
|
| 461 |
const monsterData = {
|
| 462 |
name: state.monsterStats.name,
|
| 463 |
imageUrl: state.monsterImage.imageUrl,
|
| 464 |
+
imageData: state.monsterImage.imageData,
|
| 465 |
imageCaption: state.imageCaption,
|
| 466 |
concept: state.monsterConcept,
|
| 467 |
imagePrompt: state.imagePrompt,
|
| 468 |
+
stats: cleanStats
|
| 469 |
};
|
| 470 |
|
| 471 |
+
// Check for any non-serializable data
|
| 472 |
+
console.log('Checking monster data for serializability:');
|
| 473 |
+
console.log('- name type:', typeof monsterData.name);
|
| 474 |
+
console.log('- imageUrl type:', typeof monsterData.imageUrl);
|
| 475 |
+
console.log('- imageData type:', typeof monsterData.imageData, monsterData.imageData ? `length: ${monsterData.imageData.length}` : 'null/undefined');
|
| 476 |
+
console.log('- imageCaption type:', typeof monsterData.imageCaption);
|
| 477 |
+
console.log('- concept type:', typeof monsterData.concept);
|
| 478 |
+
console.log('- imagePrompt type:', typeof monsterData.imagePrompt);
|
| 479 |
+
console.log('- stats:', cleanStats);
|
| 480 |
|
| 481 |
const id = await saveMonster(monsterData);
|
| 482 |
console.log('Monster auto-saved with ID:', id);
|
| 483 |
} catch (err) {
|
| 484 |
console.error('Failed to auto-save monster:', err);
|
| 485 |
+
console.error('Monster data that failed to save:', {
|
| 486 |
+
name: state.monsterStats?.name,
|
| 487 |
+
hasImageUrl: !!state.monsterImage?.imageUrl,
|
| 488 |
+
hasImageData: !!state.monsterImage?.imageData,
|
| 489 |
+
hasStats: !!state.monsterStats
|
| 490 |
+
});
|
| 491 |
// Don't throw - we don't want to interrupt the workflow
|
| 492 |
}
|
| 493 |
}
|