|
1 | | -export type ImageProviderId = 'openai' | 'openrouter' | 'stability' | 'replicate' | (string & {}); |
| 1 | +export type ImageProviderId = 'openai' | 'openrouter' | 'stability' | 'replicate' | 'stable-diffusion-local' | (string & {}); |
2 | 2 | export type ImageModality = 'image' | 'text'; |
3 | 3 | export type ImageBackground = 'transparent' | 'opaque' | 'auto'; |
4 | 4 | export type ImageOutputFormat = 'png' | 'jpeg' | 'jpg' | 'webp'; |
@@ -72,11 +72,39 @@ export interface ReplicateImageProviderOptions { |
72 | 72 | extraBody?: Record<string, unknown>; |
73 | 73 | } |
74 | 74 |
|
| 75 | +export interface StableDiffusionLocalImageProviderOptions { |
| 76 | + /** Number of inference steps (default 25). */ |
| 77 | + steps?: number; |
| 78 | + /** Classifier-free guidance scale (default 7.5). */ |
| 79 | + cfgScale?: number; |
| 80 | + /** Random seed (-1 for random). */ |
| 81 | + seed?: number; |
| 82 | + /** Sampler name (e.g. 'Euler a', 'DPM++ 2M Karras'). */ |
| 83 | + sampler?: string; |
| 84 | + /** Negative prompt. */ |
| 85 | + negativePrompt?: string; |
| 86 | + /** Image width in pixels (default 512). */ |
| 87 | + width?: number; |
| 88 | + /** Image height in pixels (default 512). */ |
| 89 | + height?: number; |
| 90 | + /** Number of images to generate (default 1). */ |
| 91 | + batchSize?: number; |
| 92 | + /** ControlNet settings forwarded verbatim to the backend. */ |
| 93 | + controlnet?: Record<string, unknown>; |
| 94 | + /** LoRA models to apply. Injected into the prompt as `<lora:name:weight>`. */ |
| 95 | + loras?: Array<{ name: string; weight?: number }>; |
| 96 | + /** Enable high-resolution fix (A1111 only). */ |
| 97 | + hrFix?: boolean; |
| 98 | + /** Denoising strength for high-res fix or img2img (default 0.7). */ |
| 99 | + denoisingStrength?: number; |
| 100 | +} |
| 101 | + |
75 | 102 | export interface ImageProviderOptionBag { |
76 | 103 | openai?: OpenAIImageProviderOptions; |
77 | 104 | openrouter?: OpenRouterImageProviderOptions; |
78 | 105 | stability?: StabilityImageProviderOptions; |
79 | 106 | replicate?: ReplicateImageProviderOptions; |
| 107 | + 'stable-diffusion-local'?: StableDiffusionLocalImageProviderOptions; |
80 | 108 | [providerId: string]: unknown; |
81 | 109 | } |
82 | 110 |
|
@@ -118,7 +146,7 @@ export interface IImageProvider { |
118 | 146 | shutdown?(): Promise<void>; |
119 | 147 | } |
120 | 148 |
|
121 | | -const BUILT_IN_IMAGE_PROVIDER_IDS = new Set(['openai', 'openrouter', 'stability', 'replicate']); |
| 149 | +const BUILT_IN_IMAGE_PROVIDER_IDS = new Set(['openai', 'openrouter', 'stability', 'replicate', 'stable-diffusion-local']); |
122 | 150 |
|
123 | 151 | export function getImageProviderOptions<T extends object>( |
124 | 152 | providerId: string, |
|
0 commit comments