From edb7c82e789d6a36b76d2a32fdbe3606e73d9a19 Mon Sep 17 00:00:00 2001 From: Proteus Date: Sun, 22 Dec 2024 04:54:11 -0500 Subject: [PATCH 1/3] add imageSettings types --- packages/core/src/types.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 8bb331e897..6fafa4ede8 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -707,6 +707,18 @@ export type Character = { settings?: { secrets?: { [key: string]: string }; intiface?: boolean; + imageSettings?: { + steps?: number; + width?: number; + height?: number; + negativePrompt?: string; + numIterations?: number; + guidanceScale?: number; + seed?: number; + modelId?: string; + jobId?: string; + count?: number; + }; voice?: { model?: string; // For VITS url?: string; // Legacy VITS support From 9d862ddf631315771dc34725e022e5c778505c20 Mon Sep 17 00:00:00 2001 From: Proteus Date: Sun, 22 Dec 2024 04:55:36 -0500 Subject: [PATCH 2/3] pull imageSettings from character --- packages/plugin-image-generation/src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/plugin-image-generation/src/index.ts b/packages/plugin-image-generation/src/index.ts index 1c9d0305ae..afcf68949a 100644 --- a/packages/plugin-image-generation/src/index.ts +++ b/packages/plugin-image-generation/src/index.ts @@ -120,6 +120,9 @@ const imageGeneration: Action = { const imagePrompt = message.content.text; elizaLogger.log("Image prompt received:", imagePrompt); + const imageSettings = runtime.character?.settings?.imageSettings || {}; + elizaLogger.log("Image settings:", imageSettings); + // TODO: Generate a prompt for the image const res: { image: string; caption: string }[] = []; From ba0b32411656d76be19decca659bfca239fa4fa1 Mon Sep 17 00:00:00 2001 From: Proteus Date: Sun, 22 Dec 2024 04:56:40 -0500 Subject: [PATCH 3/3] use imageSettings from character file while still retaining the ability to call via options with js --- packages/plugin-image-generation/src/index.ts | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/packages/plugin-image-generation/src/index.ts b/packages/plugin-image-generation/src/index.ts index afcf68949a..4600fb3a3d 100644 --- a/packages/plugin-image-generation/src/index.ts +++ b/packages/plugin-image-generation/src/index.ts @@ -131,23 +131,15 @@ const imageGeneration: Action = { const images = await generateImage( { prompt: imagePrompt, - width: options.width || 1024, - height: options.height || 1024, - ...(options.count != null ? { count: options.count || 1 } : {}), - ...(options.negativePrompt != null - ? { negativePrompt: options.negativePrompt } - : {}), - ...(options.numIterations != null - ? { numIterations: options.numIterations } - : {}), - ...(options.guidanceScale != null - ? { guidanceScale: options.guidanceScale } - : {}), - ...(options.seed != null ? { seed: options.seed } : {}), - ...(options.modelId != null - ? { modelId: options.modelId } - : {}), - ...(options.jobId != null ? { jobId: options.jobId } : {}), + width: options.width || imageSettings.width || 1024, + height: options.height || imageSettings.height || 1024, + ...(options.count != null || imageSettings.count != null ? { count: options.count || imageSettings.count || 1 } : {}), + ...(options.negativePrompt != null || imageSettings.negativePrompt != null ? { negativePrompt: options.negativePrompt || imageSettings.negativePrompt } : {}), + ...(options.numIterations != null || imageSettings.numIterations != null ? { numIterations: options.numIterations || imageSettings.numIterations } : {}), + ...(options.guidanceScale != null || imageSettings.guidanceScale != null ? { guidanceScale: options.guidanceScale || imageSettings.guidanceScale } : {}), + ...(options.seed != null || imageSettings.seed != null ? { seed: options.seed || imageSettings.seed } : {}), + ...(options.modelId != null || imageSettings.modelId != null ? { modelId: options.modelId || imageSettings.modelId } : {}), + ...(options.jobId != null || imageSettings.jobId != null ? { jobId: options.jobId || imageSettings.jobId } : {}), }, runtime );