Skip to content

Commit 491806b

Browse files
imunoriNorihiko Imuraclaude
authored
fix: prevent empty negativeText from being sent to Bedrock image API (#1479)
Co-authored-by: Norihiko Imura <norihiko@Norihikos-Air.lan> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e904d96 commit 491806b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

packages/cdk/lambda/utils/models.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ const createBodyImageAmazonGeneralImage = (params: GenerateImageParams) => {
805805
(params.textPrompt.find((x) => x.weight > 0)?.text || '') +
806806
', ' +
807807
params.stylePreset,
808-
negativeText: params.textPrompt.find((x) => x.weight < 0)?.text,
808+
negativeText: params.textPrompt.find((x) => x.weight < 0)?.text || undefined,
809809
images: [params.initImage],
810810
similarityStrength: Math.max(params.imageStrength || 0.2, 0.2), // Min 0.2
811811
},
@@ -819,7 +819,7 @@ const createBodyImageAmazonGeneralImage = (params: GenerateImageParams) => {
819819
(params.textPrompt.find((x) => x.weight > 0)?.text || '') +
820820
', ' +
821821
params.stylePreset,
822-
negativeText: params.textPrompt.find((x) => x.weight < 0)?.text,
822+
negativeText: params.textPrompt.find((x) => x.weight < 0)?.text || undefined,
823823
image: params.initImage,
824824
maskImage: params.maskImage,
825825
maskPrompt: params.maskPrompt,
@@ -834,7 +834,7 @@ const createBodyImageAmazonGeneralImage = (params: GenerateImageParams) => {
834834
(params.textPrompt.find((x) => x.weight > 0)?.text || '') +
835835
', ' +
836836
params.stylePreset,
837-
negativeText: params.textPrompt.find((x) => x.weight < 0)?.text,
837+
negativeText: params.textPrompt.find((x) => x.weight < 0)?.text || undefined,
838838
image: params.initImage,
839839
maskImage: params.maskImage,
840840
maskPrompt: params.maskPrompt,
@@ -850,7 +850,7 @@ const createBodyImageAmazonGeneralImage = (params: GenerateImageParams) => {
850850
(params.textPrompt.find((x) => x.weight > 0)?.text || '') +
851851
', ' +
852852
params.stylePreset,
853-
negativeText: params.textPrompt.find((x) => x.weight < 0)?.text || '',
853+
negativeText: params.textPrompt.find((x) => x.weight < 0)?.text || undefined,
854854
},
855855
imageGenerationConfig: imageGenerationConfig,
856856
};
@@ -869,7 +869,7 @@ const createBodyImageAmazonAdvancedImage = (params: GenerateImageParams) => {
869869
taskType: 'COLOR_GUIDED_GENERATION',
870870
colorGuidedGenerationParams: {
871871
text: params.textPrompt.find((x) => x.weight > 0)?.text || '',
872-
negativeText: params.textPrompt.find((x) => x.weight < 0)?.text,
872+
negativeText: params.textPrompt.find((x) => x.weight < 0)?.text || undefined,
873873
referenceImage: params.initImage,
874874
colors: params.colors!,
875875
},

0 commit comments

Comments
 (0)