fix(canvas): use server video duration options
This commit is contained in:
@@ -265,9 +265,6 @@ type EditableGenerationParameters = Partial<Pick<
|
||||
'resolution' | 'aspectRatio' | 'durationSeconds'
|
||||
>>;
|
||||
|
||||
const MIN_VIDEO_DURATION_SECONDS = 2;
|
||||
const MAX_VIDEO_DURATION_SECONDS = 6;
|
||||
|
||||
function hasSelectableVideoDuration(
|
||||
quote: DesignGenerationQuote,
|
||||
parameters: DesignGenerationParameters,
|
||||
@@ -275,8 +272,6 @@ function hasSelectableVideoDuration(
|
||||
if (quote.medium !== 'video') return true;
|
||||
const durationSeconds = parameters.durationSeconds;
|
||||
return durationSeconds !== null
|
||||
&& durationSeconds >= MIN_VIDEO_DURATION_SECONDS
|
||||
&& durationSeconds <= MAX_VIDEO_DURATION_SECONDS
|
||||
&& quote.generationOptions.durations.some((option) => (
|
||||
!option.disabled && option.value === durationSeconds
|
||||
));
|
||||
@@ -745,11 +740,7 @@ function QuoteCard({
|
||||
onConfirm: () => void;
|
||||
}) {
|
||||
const availableResolutions = quote.generationOptions.resolutions.filter((option) => !option.disabled);
|
||||
const availableDurations = quote.generationOptions.durations.filter((option) => (
|
||||
!option.disabled
|
||||
&& option.value >= MIN_VIDEO_DURATION_SECONDS
|
||||
&& option.value <= MAX_VIDEO_DURATION_SECONDS
|
||||
));
|
||||
const availableDurations = quote.generationOptions.durations.filter((option) => !option.disabled);
|
||||
const availableAspectRatios = quote.generationOptions.aspectRatios.filter((option) => !option.disabled);
|
||||
const selectedDuration = availableDurations.some(
|
||||
(option) => option.value === draft.generationParameters.durationSeconds,
|
||||
@@ -1210,7 +1201,7 @@ export function ImageCanvas() {
|
||||
}
|
||||
if (!quote || quote.quoteId !== quoteId
|
||||
|| !hasSelectableVideoDuration(quote, draft.generationParameters)) {
|
||||
setActionError('请选择 2 至 6 秒的视频时长,等待重新报价完成后再确认。');
|
||||
setActionError('请选择服务端提供的视频时长,等待重新报价完成后再确认。');
|
||||
return;
|
||||
}
|
||||
const requestedWorkspaceId = workspace.workspaceId;
|
||||
|
||||
Reference in New Issue
Block a user