diff --git a/frontend/app/web-gold/src/views/kling/stores/useDigitalHumanStore.ts b/frontend/app/web-gold/src/views/kling/stores/useDigitalHumanStore.ts index 8ed6d3ad25..ad06fe3114 100644 --- a/frontend/app/web-gold/src/views/kling/stores/useDigitalHumanStore.ts +++ b/frontend/app/web-gold/src/views/kling/stores/useDigitalHumanStore.ts @@ -17,6 +17,11 @@ import { useUpload } from '@/composables/useUpload' import { DEFAULT_VOICE_PROVIDER } from '@/config/voiceConfig' import type { VoiceMeta, Video, PipelinePhase, VideoStep, AudioStep, CreateStep, TimelineData } from '../types/identify-face' +// ========== 常量 ========== + +/** 视频文件大小上限 100MB(302.ai Kling 接口限制) */ +const MAX_VIDEO_SIZE = 100 * 1024 * 1024 + // ========== 内部类型定义 ========== /** 音频数据 */ @@ -235,6 +240,11 @@ export const useDigitalHumanStore = defineStore('digitalHuman', () => { return } + if (file.size > MAX_VIDEO_SIZE) { + toast.error('视频文件不能超过 100MB') + return + } + // 释放旧的 blob URL if (videoPreviewUrl.value?.startsWith('blob:')) { URL.revokeObjectURL(videoPreviewUrl.value) @@ -251,6 +261,12 @@ export const useDigitalHumanStore = defineStore('digitalHuman', () => { /** 从素材库选择视频(选择后自动识别) */ async function selectVideo(video: Video) { + // 校验视频大小 + if (video.fileSize && video.fileSize > MAX_VIDEO_SIZE) { + toast.error('视频文件不能超过 100MB') + return + } + selectedVideo.value = video videoFile.value = null videoSource.value = 'select'