import { StableCascadeParams } from "@/types" import { CharacterExpression, CharacterGender, CharacterPose, GenerationMode, HairColor, HairStyle } from './config' import { generateSeed } from "./generateSeed" export function getStableCascadeParams({ prompt, generationMode, negativePrompt, characterAge, characterExpression, characterGender, characterHairColor, characterHairStyle, characterName, characterPose }: { prompt: string generationMode: GenerationMode negativePrompt: string characterAge: number characterExpression: CharacterExpression characterGender: CharacterGender characterHairColor: HairColor characterHairStyle: HairStyle characterName: string characterPose: CharacterPose }): StableCascadeParams { const baseParams: StableCascadeParams = { prompt: "", negativePrompt: "", // between 0.1 and 15 (default 4) guidanceScale: 4, seed: generateSeed(), width: 1024, height: 1024, // between 1 and 50 (default 20) nbPriorInferenceSteps: 20, // between 1 and 50 (default 10) nbDecoderInferenceSteps: 10, } const params: StableCascadeParams = { ...baseParams, ...generationMode === "characters" ? { prompt: [ `${characterAge} years old $${characterGender}`, `${characterHairColor} ${characterHairStyle}`, `looking ${characterExpression}`, `${characterPose}`, `named ${characterName}`, 'beautiful', 'award winning', 'sharp', 'crisp', 'centered', 'aligned' ].filter(x => x).join(", "), negativePrompt: [ negativePrompt, 'drawing', 'painting', 'unrealistic', 'sitting', 'chair', '3D render', 'unaligned', 'cropped', 'bad hands', 'wrong hands', 'deformed', 'glitch', 'blurry', 'overexposed' ].join(", "), } : { prompt: [ 'picture of a single', prompt, '3D render', 'logo', 'ios icon', 'illustration', 'vector graphics', 'svg', 'beautiful', 'award winning', 'sharp', 'crisp', 'centered', 'aligned', ].join(", "), negativePrompt: [ negativePrompt, 'photo', 'gradient', 'many', 'realistic', 'shadow', 'multiple', 'various', 'unaligned', 'cropped', 'bad hands', 'wrong hands', 'deformed', 'glitch', 'blurry', 'overexposed' ].join(", "), } } return params }