| | const FireworksAPI = require('../utils/fireworks'); |
| |
|
| | class CharacterGenerator { |
| | constructor() { |
| | this.fireworks = new FireworksAPI(); |
| | } |
| |
|
| | async generateCharacter(description) { |
| | const prompt = `Create a detailed character portrait based on this description: ${description}. |
| | The character should be visually distinct and interesting. |
| | Art style: digital painting, high detail, fantasy`; |
| |
|
| | try { |
| | const result = await this.fireworks.generateImage(prompt, { |
| | model: 'stable-diffusion-xl-1024-v1-0', |
| | steps: 30, |
| | width: 512, |
| | height: 512, |
| | }); |
| |
|
| | return { |
| | characterImage: result.image, |
| | description: description, |
| | prompt: prompt, |
| | }; |
| | } catch (error) { |
| | console.error('Error generating character:', error); |
| | throw error; |
| | } |
| | } |
| |
|
| | async generateCharacterWithFluxSchnell(description) { |
| | |
| | const prompt = `flux schnell style, highly detailed character portrait, ${description}, |
| | fantasy character design, professional digital painting, intricate details, |
| | vibrant colors, cinematic lighting, 8k resolution`; |
| |
|
| | try { |
| | const result = await this.fireworks.generateImage(prompt, { |
| | model: 'stable-diffusion-xl-1024-v1-0', |
| | steps: 20, |
| | width: 512, |
| | height: 512, |
| | }); |
| |
|
| | return { |
| | characterImage: result.image, |
| | description: description, |
| | prompt: prompt, |
| | style: 'fluxSchnell', |
| | }; |
| | } catch (error) { |
| | console.error('Error generating character with Flux Schnell style:', error); |
| | throw error; |
| | } |
| | } |
| | } |
| |
|
| | module.exports = CharacterGenerator; |
| |
|