Skip to content

Commit 2721c9e

Browse files
JHZLOsobychacko
authored andcommitted
refactor: simplify stylePreset merge logic in StabilityAiImageOptions builder
Replaces redundant or conflicting stylePreset assignments with a single mergeOption call using runtime style and default stylePreset. Signed-off-by: Jhzlo <[email protected]>
1 parent 0147d3b commit 2721c9e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

models/spring-ai-stability-ai/src/main/java/org/springframework/ai/stabilityai/StabilityAiImageModel.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,13 @@ StabilityAiImageOptions mergeOptions(ImageOptions runtimeOptions, StabilityAiIma
130130
defaultOptions.getResponseFormat()))
131131
.width(ModelOptionsUtils.mergeOption(runtimeOptions.getWidth(), defaultOptions.getWidth()))
132132
.height(ModelOptionsUtils.mergeOption(runtimeOptions.getHeight(), defaultOptions.getHeight()))
133-
.stylePreset(ModelOptionsUtils.mergeOption(runtimeOptions.getStyle(), defaultOptions.getStyle()))
134133
// Always set the stability-specific defaults
135134
.cfgScale(defaultOptions.getCfgScale())
136135
.clipGuidancePreset(defaultOptions.getClipGuidancePreset())
137136
.sampler(defaultOptions.getSampler())
138137
.seed(defaultOptions.getSeed())
139138
.steps(defaultOptions.getSteps())
140-
.stylePreset(defaultOptions.getStylePreset());
139+
.stylePreset(ModelOptionsUtils.mergeOption(runtimeOptions.getStyle(), defaultOptions.getStylePreset()));
141140
if (runtimeOptions instanceof StabilityAiImageOptions) {
142141
StabilityAiImageOptions stabilityOptions = (StabilityAiImageOptions) runtimeOptions;
143142
// Handle Stability AI specific image options

0 commit comments

Comments
 (0)