Comic Developer
Initial clean commit - Comic generator with SDXL
4595df6
const CharacterGenerator = require('./characterGenerator');
class Personagene {
constructor() {
this.characterGenerator = new CharacterGenerator();
}
async createPersonagene(characteristics) {
// Create a detailed description based on characteristics
const description = this._buildCharacterDescription(characteristics);
// Generate character with Flux Schnell style
const character = await this.characterGenerator.generateCharacterWithFluxSchnell(description);
return {
...character,
characteristics: characteristics,
id: this._generateId(),
};
}
_buildCharacterDescription(characteristics) {
const traits = [];
if (characteristics.appearance) {
traits.push(`appearance: ${characteristics.appearance}`);
}
if (characteristics.clothing) {
traits.push(`clothing: ${characteristics.clothing}`);
}
if (characteristics.personality) {
traits.push(`personality: ${characteristics.personality}`);
}
if (characteristics.background) {
traits.push(`background: ${characteristics.background}`);
}
if (characteristics.abilities) {
traits.push(`abilities: ${characteristics.abilities}`);
}
return traits.join(', ');
}
_generateId() {
return Math.random().toString(36).substr(2, 9);
}
async createRandomPersonagene() {
const randomCharacteristics = this._generateRandomCharacteristics();
return await this.createPersonagene(randomCharacteristics);
}
_generateRandomCharacteristics() {
const appearances = [
'elf with pointed ears and silver hair',
'human with scarred face and muscular build',
'dwarf with long beard and battle axe',
'orc with green skin and tusks',
'angel with white wings and golden halo'
];
const clothings = [
'armor made of dragon scales',
'robe with mystical symbols',
'leather jacket with metal studs',
'tattered cloak hiding magical artifacts',
'royal garments with gemstone embroidery'
];
const personalities = [
'brave and honorable',
'cunning and mysterious',
'wise and patient',
'reckless and impulsive',
'kind-hearted but naive'
];
const backgrounds = [
'raised in a hidden monastery',
'former royal guard turned outlaw',
'scholar from ancient library',
'survivor of destroyed village',
'chosen one from prophecy'
];
const abilities = [
'master sword fighter',
'powerful fire magic user',
'skilled archer with enchanted bow',
'telepath with mind reading powers',
'shape-shifter who can become any animal'
];
return {
appearance: appearances[Math.floor(Math.random() * appearances.length)],
clothing: clothings[Math.floor(Math.random() * clothings.length)],
personality: personalities[Math.floor(Math.random() * personalities.length)],
background: backgrounds[Math.floor(Math.random() * backgrounds.length)],
abilities: abilities[Math.floor(Math.random() * abilities.length)],
};
}
}
module.exports = Personagene;