fix: show image size adjusted credit cost
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-05-22 21:26:52 +08:00
parent b58e0f945e
commit cad16e70ba
3 changed files with 26 additions and 4 deletions

View File

@ -3171,6 +3171,7 @@ export function CanvasChatPanel({
supportsWatermark?: boolean;
supportsSeed?: boolean;
creditCostPerImage?: number;
creditCostMultiplierBySize?: Record<string, number>;
creditDiscountRate?: number;
creditCostPerVideo?: number;
videoDurationOptions?: number[];
@ -3198,6 +3199,7 @@ export function CanvasChatPanel({
supportsWatermark?: boolean;
supportsSeed?: boolean;
creditCostPerImage?: number;
creditCostMultiplierBySize?: Record<string, number>;
creditDiscountRate?: number;
creditCostPerVideo?: number;
videoDurationOptions?: number[];
@ -8332,7 +8334,10 @@ export function CanvasChatPanel({
const pointsEnabled = membershipSummary?.pointsSystemConfig?.enabled === true;
const blockOnInsufficient =
membershipSummary?.pointsSystemConfig?.blockOnInsufficient !== false;
const unitCost = getImageCreditCostFromConfig(currentModel?.imageGenConfig);
const unitCost = getImageCreditCostFromConfig(
currentModel?.imageGenConfig,
imageParams?.imageSize
);
if (!pointsEnabled || !blockOnInsufficient || unitCost <= 0) {
return true;
@ -8364,6 +8369,7 @@ export function CanvasChatPanel({
activeComposerMode,
currentModel?.imageGenConfig,
imageParams?.imageCount,
imageParams?.imageSize,
isVideoModel,
membershipSummary?.isHighVip,
membershipSummary?.pointsSystemConfig?.blockOnInsufficient,
@ -8393,7 +8399,10 @@ export function CanvasChatPanel({
: null;
}
const unitCost = getImageCreditCostFromConfig(currentModel?.imageGenConfig);
const unitCost = getImageCreditCostFromConfig(
currentModel?.imageGenConfig,
imageParams?.imageSize
);
const imageCount = Math.max(
1,
Math.round(Number(imageParams?.imageCount || 1))
@ -8409,6 +8418,7 @@ export function CanvasChatPanel({
activeComposerMode,
currentModel?.imageGenConfig,
imageParams?.imageCount,
imageParams?.imageSize,
isVideoModel,
membershipSummary?.isHighVip,
membershipSummary?.pointsSystemConfig?.enabled,

View File

@ -552,6 +552,8 @@ export function Chat({
supportsWatermark?: boolean;
supportsSeed?: boolean;
creditCostPerImage?: number;
creditCostMultiplierBySize?: Record<string, number>;
creditDiscountRate?: number;
creditCostPerVideo?: number;
videoDurationOptions?: number[];
creditCostPerVideoByDuration?: Record<string, number>;

View File

@ -41,6 +41,7 @@ type DynamicModel = {
supportsWatermark?: boolean;
supportsSeed?: boolean;
creditCostPerImage?: number;
creditCostMultiplierBySize?: Record<string, number>;
creditDiscountRate?: number;
creditCostPerVideo?: number;
videoDurationOptions?: number[];
@ -220,6 +221,7 @@ function PureMultimodalInput({
supportsWatermark?: boolean;
supportsSeed?: boolean;
creditCostPerImage?: number;
creditCostMultiplierBySize?: Record<string, number>;
creditDiscountRate?: number;
creditCostPerVideo?: number;
videoDurationOptions?: number[];
@ -356,7 +358,10 @@ function PureMultimodalInput({
}
if (!isImageModel) return null;
const unitCost = getImageCreditCostFromConfig(imageGenConfig);
const unitCost = getImageCreditCostFromConfig(
imageGenConfig,
imageParams?.imageSize
);
const imageCount = Math.max(
1,
Math.round(Number(imageParams?.imageCount || 1))
@ -371,6 +376,7 @@ function PureMultimodalInput({
}, [
imageGenConfig,
imageParams?.imageCount,
imageParams?.imageSize,
isImageModel,
isVideoModel,
membershipSummary?.isHighVip,
@ -450,7 +456,10 @@ function PureMultimodalInput({
const pointsEnabled = membershipSummary?.pointsSystemConfig?.enabled === true;
const blockOnInsufficient =
membershipSummary?.pointsSystemConfig?.blockOnInsufficient !== false;
const unitCost = getImageCreditCostFromConfig(imageGenConfig);
const unitCost = getImageCreditCostFromConfig(
imageGenConfig,
imageParams?.imageSize
);
if (!pointsEnabled || !blockOnInsufficient || unitCost <= 0) {
return true;
@ -481,6 +490,7 @@ function PureMultimodalInput({
}, [
imageGenConfig,
imageParams?.imageCount,
imageParams?.imageSize,
isImageModel,
isVideoModel,
membershipSummary?.isHighVip,