Skip to content

Commit 5a4a54d

Browse files
authored
Refactor proposal (#63)
1 parent afe7de4 commit 5a4a54d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/internal/models/createBackgroundModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ function createPredominantGradientBackgroundModel(background: BackgroundPredomin
205205
function createGenerativeFillBackgroundModel(background: BackgroundGenerativeFillQualifier): IGenerativeFillBackgroundModel {
206206
return {
207207
backgroundType: background.getBackgroundType(),
208-
...(background.getPrompt() ? { prompt: decodeURIComponent(background.getPrompt()) } : {})
208+
...(background.getPrompt() ? { prompt: background.getPrompt() } : {})
209209
};
210210
}
211211

src/qualifiers/background/shared/BackgroundGenerativeFillQualifier.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class BackgroundGenerativeFillQualifier extends BackgroundQualifier {
1616
}
1717

1818
prompt(prompt: string): BackgroundGenerativeFillQualifier {
19-
this._prompt = prompt ? encodePromptComponent(prompt) : prompt;
19+
this._prompt = decodeURIComponent(prompt);
2020
return this;
2121
}
2222

2323
getPrompt(): string | undefined {
24-
return this._prompt ? decodeURIComponent(this._prompt) : this._prompt;
24+
return this._prompt;
2525
}
2626

2727
getBackgroundType(): 'generativeFill' {
@@ -33,7 +33,7 @@ class BackgroundGenerativeFillQualifier extends BackgroundQualifier {
3333
* Override the toString() function to explicitly stringify the qualifier.
3434
*/
3535
toString(): string {
36-
return `b_gen_fill${this._prompt ? `:prompt_${this._prompt}` : ''}`;
36+
return `b_gen_fill${this._prompt ? `:prompt_${encodePromptComponent(this._prompt)}` : ''}`;
3737
}
3838
}
3939

0 commit comments

Comments
 (0)