Skip to content

Commit 276bb5f

Browse files
author
Yukimi Kazari
committed
Enhance cost calculation in metadata processing to include an additional charge for director reference images. This change ensures that the total cost reflects the presence of these images, improving the accuracy of cost estimations.
1 parent b2e7e70 commit 276bb5f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/utils/metadata-utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,12 @@ export function calculateCost(metadata: Metadata, isOpus = false): number {
8686
const opusDiscount =
8787
isOpus && steps <= 28 && adjustedResolution <= 1024 * 1024;
8888

89-
return perSample * (n_samples - (opusDiscount ? 1 : 0));
89+
let totalCost = perSample * (n_samples - (opusDiscount ? 1 : 0));
90+
91+
// Add +5 cost for director reference images
92+
if (metadata.director_reference_images?.length) {
93+
totalCost += 5;
94+
}
95+
96+
return totalCost;
9097
}

0 commit comments

Comments
 (0)