Skip to content

🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"

TypeScript

feat: refine default role style prompt in config and standardize string literal quotes in professional editor UI.

awslessc83d2163e36e
diff --git a/configs/config.example.yaml b/configs/config.example.yaml
index 276701e..4672911 100644
--- a/configs/config.example.yaml
+++ b/configs/config.example.yaml
@@ -29,7 +29,7 @@ ai:
default_video_provider: "doubao"
style:
default_style: '{"style_config":{"style_base":["Japanese anime style","Post-apocalyptic isekai narrative aesthetic","soft painterly cel-shading","official animation screenshot","high-production key animation frame","consistent visual tone across all elements"],"lighting":["muted ambient light with warm golden highlights","soft diffused shadows","volumetric lighting to emphasize character-background contrast","color palette: muted grays/blood reds for background, clean whites/soft neutrals for character"],"texture":["smooth cel animation texture","subtle gradient shading","minimal film grain","consistent color harmony between character and environment"],"composition":["dynamic contrast between relaxed foreground character and chaotic blurred post-apocalyptic background","shallow depth of field","layered visual hierarchy to highlight protagonist"],"style_references":["in the visual style of Frieren: Beyond Journey''s End","relaxed character aesthetic inspired by Mob Psycho 100","professional anime production quality"],"consistency_controls":["stable character design proportions","no facial deformation","uniform shading style across all elements","maintained color palette consistency","preserved clean ''everyday'' vibe of protagonist against grim setting"]}}'
- default_role_style: "Modern Japanese anime style, cel-shaded. The layout features a large full-body main illustration and three-view orthographic references (Front, Side, Back) neatly arranged on a single horizontal white canvas, high quality, detailed, anime style, character design, no complex background, no scenery, focus on character"
+ default_role_style: "Modern Japanese anime style, cel-shaded. The layout features a large full-body main illustration and three-view orthographic references (Front, Side, Back) neatly arranged on a single horizontal white canvas, high quality, detailed, anime style, character design, character remains standing, no any background, no scenery, focus on character"
default_scene_style: "Modern Japanese anime style, cel-shaded. The layout features a large main anime background scene illustration and three-view orthographic references (Front, Side, Back) of the scene neatly arranged on a single horizontal white canvas. "
default_prop_style: "Modern Japanese anime style, cel-shaded. The layout features a large full-body main illustration and three-view orthographic references (Front, Side, Back) of the scene neatly arranged on a single horizontal white canvas. "
default_image_ratio: "16:9"
diff --git a/web/src/views/drama/ProfessionalEditor.vue b/web/src/views/drama/ProfessionalEditor.vue
index 733548d..45d6784 100644
--- a/web/src/views/drama/ProfessionalEditor.vue
+++ b/web/src/views/drama/ProfessionalEditor.vue
@@ -1,13 +1,20 @@
<template>
<div class="professional-editor">
<!-- 顶部工具栏 -->
- <AppHeader :fixed="false" :show-logo="false" @config-updated="loadVideoModels">
+ <AppHeader
+ :fixed="false"
+ :show-logo="false"
+ @config-updated="loadVideoModels"
+ >
<template #left>
<el-button text @click="goBack" class="back-btn">
<el-icon><ArrowLeft /></el-icon>
- <span>{{ $t('editor.backToEpisode') }}</span>
+ <span>{{ $t("editor.backToEpisode") }}</span>
</el-button>
- <span class="episode-title">{{ drama?.title }} - {{ $t('editor.episode', { number: episodeNumber }) }}</span>
+ <span class="episode-title"
+ >{{ drama?.title }} -
+ {{ $t("editor.episode", { number: episodeNumber }) }}</span
+ >
</template>
</AppHeader>
@@ -16,25 +23,46 @@
<!-- 左侧分镜列表 -->
<div class="storyboard-panel">
<div class="panel-header">
- <h3>{{ $t('storyboard.scriptStructure') }}</h3>
- <el-button text :icon="Plus" @click="handleAddStoryboard">{{ $t('storyboard.add') }}</el-button>
+ <h3>{{ $t("storyboard.scriptStructure") }}</h3>
+ <el-button text :icon="Plus" @click="handleAddStoryboard">{{
+ $t("storyboard.add")
+ }}</el-button>
</div>
<div class="storyboard-list">
- <div v-for="(shot, index) in storyboards" :key="shot.id" class="storyboard-item"
- :class="{ active: currentStoryboardId === shot.id }" @click="selectStoryboard(shot.id)">
+ <div
+ v-for="(shot, index) in storyboards"
+ :key="shot.id"
+ class="storyboard-item"
+ :class="{ active: currentStoryboardId === shot.id }"
+ @click="selectStoryboard(shot.id)"
+ >
<div class="shot-content">
<div class="shot-header">
<div class="shot-title-row">
- <span class="shot-number">{{ $t('storyboard.shotNumber', { number: shot.storyboard_number }) }}</span>
- <span class="shot-title">{{ shot.title || $t('storyboard.untitled') }}</span>
+ <span class="shot-number">{{
+ $t("storyboard.shotNumber", {
+ number: shot.storyboard_number,
+ })
+ }}</span>
+ <span class="shot-title">{{
+ shot.title || $t("storyboard.untitled")
+ }}</span>
</div>
<div class="shot-actions">
<span class="shot-duration">{{ shot.duration }}s</span>
- <el-button link type="danger" :icon="Delete" @click.stop="handleDeleteStoryboard(shot)" class="delete-btn" />
+ <el-button
+ link
+ type="danger"
+ :icon="Delete"
+ @click.stop="handleDeleteStoryboard(shot)"
+ class="delete-btn"
+ />
</div>
</div>
- <div class="shot-action" v-if="shot.action">{{ shot.action }}</div>
+ <div class="shot-action" v-if="shot.action">
+ {{ shot.action }}
+ </div>
</div>
</div>
</div>
@@ -42,38 +70,76 @@
<!-- 中间时间线编辑区域 -->
<div class="timeline-area">
- <VideoTimelineEditor ref="timelineEditorRef" v-if="storyboards.length > 0" :scenes="storyboards"
- :episode-id="episodeId.toString()" :drama-id="dramaId.toString()" :assets="videoAssets"
- @select-scene="handleTimelineSelect" @asset-deleted="loadVideoAssets"
- @merge-completed="handleMergeCompleted" />
- <el-empty v-else :description="$t('storyboard.noStoryboard')" class="empty-timeline" />
+ <VideoTimelineEditor
+ ref="timelineEditorRef"
+ v-if="storyboards.length > 0"
+ :scenes="storyboards"
+ :episode-id="episodeId.toString()"
+ :drama-id="dramaId.toString()"
+ :assets="videoAssets"
+ @select-scene="handleTimelineSelect"
+ @asset-deleted="loadVideoAssets"
+ @merge-completed="handleMergeCompleted"
+ />
+ <el-empty
+ v-else
+ :description="$t('storyboard.noStoryboard')"
+ class="empty-timeline"
+ />
</div>
<!-- 右侧编辑面板 -->
<div class="edit-panel">
<el-tabs v-model="activeTab" class="edit-tabs">
<!-- 镜头属性标签 -->
- <el-tab-pane :label="$t('storyboard.shotProperties')" name="shot" v-if="currentStoryboard">
+ <el-tab-pane
+ :label="$t('storyboard.shotProperties')"
+ name="shot"
+ v-if="currentStoryboard"
+ >
<div v-if="currentStoryboard" class="shot-editor-new">
<!-- 场景(Scene) -->
<div class="scene-section">
<div class="section-label">
- {{ $t('storyboard.scene') }} (Scene)
- <el-button size="small" text @click="showSceneSelector = true">{{ $t('storyboard.selectScene')
- }}</el-button>
+ {{ $t("storyboard.scene") }} (Scene)
+ <el-button
+ size="small"
+ text
+ @click="showSceneSelector = true"
+ >{{ $t("storyboard.selectScene") }}</el-button
+ >
</div>
- <div class="scene-preview" v-if="currentStoryboard.background?.image_url" @click="showSceneImage">
- <img :src="currentStoryboard.background.image_url" alt="场景" style="cursor: pointer;" />
+ <div
+ class="scene-preview"
+ v-if="currentStoryboard.background?.image_url"
+ @click="showSceneImage"
+ >
+ <img
+ :src="currentStoryboard.background.image_url"
+ alt="场景"
+ style="cursor: pointer"
+ />
<div class="scene-info">
- <div>{{ currentStoryboard.background.location }} · {{ currentStoryboard.background.time }}</div>
- <div class="scene-id">{{ $t('editor.sceneId') }}: {{ currentStoryboard.scene_id || 'N/A' }}</div>
+ <div>
+ {{ currentStoryboard.background.location }} ·
+ {{ currentStoryboard.background.time }}
+ </div>
+ <div class="scene-id">
+ {{ $t("editor.sceneId") }}:
+ {{ currentStoryboard.scene_id || "N/A" }}
+ </div>
</div>
</div>
<div class="scene-preview-empty" v-else>
<el-icon :size="48" color="#666">
<Picture />
</el-icon>
- <div>{{ currentStoryboard.background ? $t('editor.sceneGenerating') : $t('editor.noBackground') }}
+ <div>
+ {{
+ currentStoryboard.background
+ ? $t("editor.sceneGenerating")
+ : $t("editor.noBackground")
+ }}
</div>
</div>
</div>
@@ -81,27 +147,48 @@
<!-- 登场角色(Cast) -->
<div class="cast-section">
<div class="section-label">
- {{ $t('editor.cast') }} (Cast)
- <el-button size="small" text :icon="Plus" @click="showCharacterSelector = true">{{
- $t('editor.addCharacter') }}</el-button>
+ {{ $t("editor.cast") }} (Cast)
+ <el-button
+ size="small"
+ text
+ :icon="Plus"
+ @click="showCharacterSelector = true"
+ >{{ $t("editor.addCharacter") }}</el-button
+ >
</div>
<div class="cast-list">
- <div v-for="char in currentStoryboardCharacters" :key="char.id" class="cast-item active">
+ <div
+ v-for="char in currentStoryboardCharacters"
+ :key="char.id"
+ class="cast-item active"
+ >
<div class="cast-avatar" @click="showCharacterImage(char)">
- <img v-if="char.image_url" :src="char.image_url" :alt="char.name" />
- <span v-else>{{ char.name?.[0] || '?' }}</span>
+ <img
+ v-if="char.image_url"
+ :src="char.image_url"
+ :alt="char.name"
+ />
+ <span v-else>{{ char.name?.[0] || "?" }}</span>
</div>
<div class="cast-name">{{ char.name }}</div>
- <div class="cast-remove" @click.stop="toggleCharacterInShot(char.id)"
- :title="$t('editor.removeCharacter')">
+ <div
+ class="cast-remove"
+ @click.stop="toggleCharacterInShot(char.id)"
+ :title="$t('editor.removeCharacter')"
+ >
<el-icon :size="14">
<Close />
</el-icon>
</div>
</div>
- <div v-if="!currentStoryboard?.characters || currentStoryboard.characters.length === 0"
- class="cast-empty">
- {{ $t('editor.noCharacters') }}
+ <div
+ v-if="
+ !currentStoryboard?.characters ||
+ currentStoryboard.characters.length === 0
+ "
+ class="cast-empty"
+ >
+ {{ $t("editor.noCharacters") }}
</div>
</div>
</div>
@@ -109,38 +196,66 @@
<!-- 道具(Props) -->
<div class="cast-section">
<div class="section-label">
- {{ $t('editor.props') }} (Props)
- <el-button size="small" text :icon="Plus" @click="showPropSelector = true">{{ $t('editor.addProp') }}</el-button>
+ {{ $t("editor.props") }} (Props)
+ <el-button
+ size="small"
+ text
+ :icon="Plus"
+ @click="showPropSelector = true"
+ >{{ $t("editor.addProp") }}</el-button
+ >
</div>
<div class="cast-list">
- <div v-for="prop in currentStoryboardProps" :key="prop.id" class="cast-item active">
+ <div
+ v-for="prop in currentStoryboardProps"
+ :key="prop.id"
+ class="cast-item active"
+ >
<div class="cast-avatar">
- <img v-if="prop.image_url" :src="prop.image_url" :alt="prop.name" />
+ <img
+ v-if="prop.image_url"
+ :src="prop.image_url"
+ :alt="prop.name"
+ />
<el-icon v-else><Box /></el-icon>
</div>
<div class="cast-name">{{ prop.name }}</div>
- <div class="cast-remove" @click.stop="togglePropInShot(prop.id)"
- title="移除道具">
+ <div
+ class="cast-remove"
+ @click.stop="togglePropInShot(prop.id)"
+ title="移除道具"
+ >
<el-icon :size="14">
<Close />
</el-icon>
</div>
</div>
- <div v-if="!currentStoryboardProps || currentStoryboardProps.length === 0"
- class="cast-empty">
- {{ $t('editor.noProps') }}
+ <div
+ v-if="
+ !currentStoryboardProps ||
+ currentStoryboardProps.length === 0
+ "
+ class="cast-empty"
+ >
+ {{ $t("editor.noProps") }}
</div>
</div>
</div>
<!-- 视效设置 -->
<div class="settings-section">
- <div class="section-label">{{ $t('editor.visualSettings') }}</div>
+ <div class="section-label">
+ {{ $t("editor.visualSettings") }}
+ </div>
<div class="settings-grid">
<div class="setting-item">
- <label>{{ $t('editor.shotType') }}</label>
- <el-select v-model="currentStoryboard.shot_type" clearable
- :placeholder="$t('editor.shotTypePlaceholder')" @change="saveStoryboardField('shot_type')">
+ <label>{{ $t("editor.shotType") }}</label>
+ <el-select
+ v-model="currentStoryboard.shot_type"
+ clearable
+ :placeholder="$t('editor.shotTypePlaceholder')"
+ @change="saveStoryboardField('shot_type')"
+ >
<el-option label="大远景" value="大远景" />
<el-option label="远景" value="远景" />
<el-option label="全景" value="全景" />
@@ -154,9 +269,13 @@
</div>
<div class="setting-item">
- <label>{{ $t('editor.movement') }}</label>
- <el-select v-model="currentStoryboard.movement" clearable
- :placeholder="$t('editor.movementPlaceholder')" @change="saveStoryboardField('movement')">
+ <label>{{ $t("editor.movement") }}</label>
+ <el-select
+ v-model="currentStoryboard.movement"
+ clearable
+ :placeholder="$t('editor.movementPlaceholder')"
+ @change="saveStoryboardField('movement')"
+ >
<el-option label="固定镜头" value="固定镜头" />
<el-option label="推镜" value="推镜" />
<el-option label="拉镜" value="拉镜" />
@@ -175,18 +294,28 @@
</div>
<div class="setting-item">
- <label>{{ $t('editor.angle') }}</label>
- <el-select v-model="currentStoryboard.angle" clearable
- :placeholder="$t('editor.anglePlaceholder')" @change="saveStoryboardField('angle')">
+ <label>{{ $t("editor.angle") }}</label>
+ <el-select
+ v-model="currentStoryboard.angle"
+ clearable
+ :placeholder="$t('editor.anglePlaceholder')"
+ @change="saveStoryboardField('angle')"
+ >
<el-option label="平视" value="平视" />
<el-option label="俯视" value="俯视" />
<el-option label="仰视" value="仰视" />
- <el-option label="大俯视(鸟瞰)" value="大俯视(鸟瞰)" />
+ <el-option
+ label="大俯视(鸟瞰)"
+ value="大俯视(鸟瞰)"
+ />
<el-option label="大仰视" value="大仰视" />
<el-option label="正侧面" value="正侧面" />
<el-option label="斜侧面" value="斜侧面" />
<el-option label="背面" value="背面" />
- <el-option label="倾斜(荷兰角)" value="倾斜(荷兰角)" />
+ <el-option
+ label="倾斜(荷兰角)"
+ value="倾斜(荷兰角)"
+ />
<el-option label="主观视角" value="主观视角" />
<el-option label="过肩" value="过肩" />
</el-select>
@@ -196,53 +325,99 @@
<!-- 叙事内容 -->
<div class="narrative-section">
- <div class="section-label">{{ $t('editor.action') }} (Action)</div>
- <el-input v-model="currentStoryboard.action" type="textarea" :rows="3"
- :placeholder="$t('editor.actionPlaceholder')" @blur="saveStoryboardField('action')" />
+ <div class="section-label">
+ {{ $t("editor.action") }} (Action)
+ </div>
+ <el-input
+ v-model="currentStoryboard.action"
+ type="textarea"
+ :rows="3"
+ :placeholder="$t('editor.actionPlaceholder')"
+ @blur="saveStoryboardField('action')"
+ />
</div>
<div class="narrative-section">
- <div class="section-label">{{ $t('editor.result') }} (Result)</div>
- <el-input v-model="currentStoryboard.result" type="textarea" :rows="2"
- :placeholder="$t('editor.resultPlaceholder')" @blur="saveStoryboardField('result')" />
+ <div class="section-label">
+ {{ $t("editor.result") }} (Result)
+ </div>
+ <el-input
+ v-model="currentStoryboard.result"
+ type="textarea"
+ :rows="2"
+ :placeholder="$t('editor.resultPlaceholder')"
+ @blur="saveStoryboardField('result')"
+ />
</div>
<div class="dialogue-section">
- <div class="section-label">{{ $t('editor.dialogue') }} (Dialogue)</div>
- <el-input v-model="currentStoryboard.dialogue" type="textarea" :rows="3"
- :placeholder="$t('editor.dialoguePlaceholder')" @blur="saveStoryboardField('dialogue')" />
+ <div class="section-label">
+ {{ $t("editor.dialogue") }} (Dialogue)
+ </div>
+ <el-input
+ v-model="currentStoryboard.dialogue"
+ type="textarea"
+ :rows="3"
+ :placeholder="$t('editor.dialoguePlaceholder')"
+ @blur="saveStoryboardField('dialogue')"
+ />
</div>
<div class="narrative-section">
- <div class="section-label">{{ $t('editor.description') }} (Description)</div>
- <el-input v-model="currentStoryboard.description" type="textarea" :rows="3"
- :placeholder="$t('editor.descriptionPlaceholder')" @blur="saveStoryboardField('description')" />
+ <div class="section-label">
+ {{ $t("editor.description") }} (Description)
+ </div>
+ <el-input
+ v-model="currentStoryboard.description"
+ type="textarea"
+ :rows="3"
+ :placeholder="$t('editor.descriptionPlaceholder')"
+ @blur="saveStoryboardField('description')"
+ />
</div>
<!-- 音效设置 -->
<div class="settings-section">
- <div class="section-label">{{ $t('editor.soundEffects') }}</div>
+ <div class="section-label">{{ $t("editor.soundEffects") }}</div>
<div class="audio-controls">
- <el-input v-model="currentStoryboard.sound_effect" :placeholder="$t('editor.soundEffectsPlaceholder')"
- size="small" type="textarea" :rows="2" @blur="saveStoryboardField('sound_effect')" />
+ <el-input
+ v-model="currentStoryboard.sound_effect"
+ :placeholder="$t('editor.soundEffectsPlaceholder')"
+ size="small"
+ type="textarea"
+ :rows="2"
+ @blur="saveStoryboardField('sound_effect')"
+ />
</div>
</div>
<!-- 配乐设置 -->
<div class="settings-section">
- <div class="section-label">{{ $t('editor.bgmPrompt') }}</div>
+ <div class="section-label">{{ $t("editor.bgmPrompt") }}</div>
<div class="audio-controls">
- <el-input v-model="currentStoryboard.bgm_prompt" :placeholder="$t('editor.bgmPromptPlaceholder')"
- size="small" type="textarea" :rows="2" @blur="saveStoryboardField('bgm_prompt')" />
+ <el-input
+ v-model="currentStoryboard.bgm_prompt"
+ :placeholder="$t('editor.bgmPromptPlaceholder')"
+ size="small"
+ type="textarea"
+ :rows="2"
+ @blur="saveStoryboardField('bgm_prompt')"
+ />
</div>
</div>
<!-- 氛围设置 -->
<div class="settings-section">
- <div class="section-label">{{ $t('editor.atmosphere') }}</div>
+ <div class="section-label">{{ $t("editor.atmosphere") }}</div>
<div class="audio-controls">
- <el-input v-model="currentStoryboard.atmosphere" :placeholder="$t('editor.atmospherePlaceholder')"
- size="small" type="textarea" :rows="2" @blur="saveStoryboardField('atmosphere')" />
+ <el-input
+ v-model="currentStoryboard.atmosphere"
+ :placeholder="$t('editor.atmospherePlaceholder')"
+ size="small"
+ type="textarea"
+ :rows="2"
+ @blur="saveStoryboardField('atmosphere')"
+ />
</div>
</div>
</div>
@@ -255,53 +430,127 @@
<div class="image-generation-section">
<!-- 帧类型选择 -->
<div class="frame-type-selector">
- <div class="section-label">{{ $t('editor.selectFrameType') }}</div>
+ <div class="section-label">
+ {{ $t("editor.selectFrameType") }}
+ </div>
<el-radio-group v-model="selectedFrameType" size="small">
- <el-radio-button label="first">{{ $t('editor.firstFrame') }}</el-radio-button>
- <el-radio-button label="last">{{ $t('editor.lastFrame') }}</el-radio-button>
- <el-radio-button label="panel">{{ $t('editor.panelFrame') }}</el-radio-button>
- <el-radio-button label="action">{{ $t('editor.actionSequence') }}</el-radio-button>
- <el-radio-button label="key">{{ $t('editor.keyFrame') }}</el-radio-button>
+ <el-radio-button label="first">{{
+ $t("editor.firstFrame")
+ }}</el-radio-button>
+ <el-radio-button label="last">{{
+ $t("editor.lastFrame")
+ }}</el-radio-button>
+ <el-radio-button label="panel">{{
+ $t("editor.panelFrame")
+ }}</el-radio-button>
+ <el-radio-button label="action">{{
+ $t("editor.actionSequence")
+ }}</el-radio-button>
+ <el-radio-button label="key">{{
+ $t("editor.keyFrame")
+ }}</el-radio-button>
</el-radio-group>
- <el-input-number v-if="selectedFrameType === 'panel'" v-model="panelCount" :min="2" :max="6"
- size="small" class="panel-count-input" style="margin-left: 10px; margin-top: 12px;" />
- <span v-if="selectedFrameType === 'panel'" class="panel-count-label">{{ $t('editor.panelCount')
- }}</span>
+ <el-input-number
+ v-if="selectedFrameType === 'panel'"
+ v-model="panelCount"
+ :min="2"
+ :max="6"
+ size="small"
+ class="panel-count-input"
+ style="margin-left: 10px; margin-top: 12px"
+ />
+ <span
+ v-if="selectedFrameType === 'panel'"
+ class="panel-count-label"
+ >{{ $t("editor.panelCount") }}</span
+ >
</div>
<!-- 提示词区域 -->
<div class="prompt-section">
<div class="section-label">
- {{ $t('editor.prompt') }}
- <el-button size="small" type="primary"
- :disabled="currentStoryboard && generatingPromptStates[currentStoryboard.id]"
- :loading="currentStoryboard && generatingPromptStates[currentStoryboard.id]"
- @click="extractFramePrompt" style="margin-left: 10px;">
- {{ $t('editor.extractPrompt') }}
+ {{ $t("editor.prompt") }}
+ <el-button
+ size="small"
+ type="primary"
+ :disabled="
+ isGeneratingPrompt(
+ currentStoryboard?.id,
+ selectedFrameType,
+ )
+ "
+ :loading="
+ isGeneratingPrompt(
+ currentStoryboard?.id,
+ selectedFrameType,
+ )
+ "
+ @click="extractFramePrompt"
+ style="margin-left: 10px"
+ >
+ {{ $t("editor.extractPrompt") }}
</el-button>
</div>
- <el-input v-model="currentFramePrompt" type="textarea" :rows="8"
- :placeholder="$t('editor.promptPlaceholder')" />
+ <el-input
+ v-model="currentFramePrompt"
+ type="textarea"
+ :rows="8"
+ :placeholder="$t('editor.promptPlaceholder')"
+ />
</div>
<!-- 生成控制 -->
<div class="generation-controls">
- <el-button type="success" :icon="MagicStick" :loading="generatingImage"
- :disabled="!currentFramePrompt" @click="generateFrameImage">
- {{ generatingImage ? $t('editor.generating') : $t('editor.generateImage') }}
+ <el-button
+ type="success"
+ :icon="MagicStick"
+ :loading="generatingImage"
+ :disabled="!currentFramePrompt"
+ @click="generateFrameImage"
+ >
+ {{
+ generatingImage
+ ? $t("editor.generating")
+ : $t("editor.generateImage")
+ }}
</el-button>
- <el-button :icon="Upload" @click="uploadImage">{{ $t('editor.uploadImage') }}</el-button>
+ <el-button :icon="Upload" @click="uploadImage">{{
+ $t("editor.uploadImage")
+ }}</el-button>
</div>
<!-- 生成结果 -->
- <div class="generation-result" v-if="generatedImages.length > 0">
- <div class="section-label">{{ $t('editor.generationResult') }} ({{ generatedImages.length }})</div>
+ <div
+ class="generation-result"
+ v-if="generatedImages.length > 0"
+ >
+ <div class="section-label">
+ {{ $t("editor.generationResult") }} ({{
+ generatedImages.length
+ }})
+ </div>
<div class="image-grid">
- <div v-for="img in generatedImages" :key="img.id" class="image-item">
- <el-image v-if="img.image_url" :src="img.image_url"
- :preview-src-list="generatedImages.filter(i => i.image_url).map(i => i.image_url!)"
- :initial-index="generatedImages.filter(i => i.image_url).findIndex(i => i.id === img.id)"
- fit="cover" preview-teleported />
+ <div
+ v-for="img in generatedImages"
+ :key="img.id"
+ class="image-item"
+ >
+ <el-image
+ v-if="img.image_url"
+ :src="img.image_url"
+ :preview-src-list="
+ generatedImages
+ .filter((i) => i.image_url)
+ .map((i) => i.image_url!)
+ "
+ :initial-index="
+ generatedImages
+ .filter((i) => i.image_url)
+ .findIndex((i) => i.id === img.id)
+ "
+ fit="cover"
+ preview-teleported
+ />
<div v-else class="image-placeholder">
<el-icon :size="32">
<Picture />
@@ -309,8 +558,14 @@
<p>生成中...</p>
</div>
<div class="image-info">
- <el-tag :type="getStatusType(img.status)" size="small">{{ getStatusText(img.status) }}</el-tag>
- <span v-if="img.frame_type" class="frame-type-tag">{{ getFrameTypeText(img.frame_type) }}</span>
+ <el-tag
+ :type="getStatusType(img.status)"
+ size="small"
+ >{{ getStatusText(img.status) }}</el-tag
+ >
+ <span v-if="img.frame_type" class="frame-type-tag">{{
+ getFrameTypeText(img.frame_type)
+ }}</span>
</div>
</div>
</div>
@@ -326,25 +581,54 @@
<div class="video-generation-section">
<!-- 生成提示词展示 -->
<div class="video-prompt-box">
- {{ currentStoryboard.video_prompt || '暂无提示词' }}
+ {{ currentStoryboard.video_prompt || "暂无提示词" }}
</div>
<!-- 视频参数设置 -->
<div class="video-params-section">
<div class="param-row">
- <span class="param-label">{{ $t('video.model') }}</span>
- <el-select v-model="selectedVideoModel" :placeholder="$t('video.selectVideoModel')" size="default"
- style="flex: 1;">
- <el-option v-for="model in videoModelCapabilities" :key="model.id" :label="model.name"
- :value="model.id">
- <div style="display: flex; justify-content: space-between; align-items: center;">
+ <span class="param-label">{{ $t("video.model") }}</span>
+ <el-select
+ v-model="selectedVideoModel"
+ :placeholder="$t('video.selectVideoModel')"
+ size="default"
+ style="flex: 1"
+ >
+ <el-option
+ v-for="model in videoModelCapabilities"
+ :key="model.id"
+ :label="model.name"
+ :value="model.id"
+ >
+ <div
+ style="
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ "
+ >
<span>{{ model.name }}</span>
<div class="model-tags">
- <el-tag v-if="model.supportMultipleImages" size="small" type="success"
- style="margin-left: 4px;">多图</el-tag>
- <el-tag v-if="model.supportFirstLastFrame" size="small" type="primary"
- style="margin-left: 4px;">首尾帧</el-tag>
- <el-tag size="small" type="info" style="margin-left: 4px;">最多{{ model.maxImages }}张</el-tag>
+ <el-tag
+ v-if="model.supportMultipleImages"
+ size="small"
+ type="success"
+ style="margin-left: 4px"
+ >多图</el-tag
+ >
+ <el-tag
+ v-if="model.supportFirstLastFrame"
+ size="small"
+ type="primary"
+ style="margin-left: 4px"
+ >首尾帧</el-tag
+ >
+ <el-tag
+ size="small"
+ type="info"
+ style="margin-left: 4px"
+ >最多{{ model.maxImages }}张</el-tag
+ >
</div>
</div>
</el-option>
@@ -352,34 +636,80 @@
</div>
<!-- 参考图模式选择 -->
- <div v-if="selectedVideoModel && availableReferenceModes.length > 0" class="param-row">
+ <div
+ v-if="
+ selectedVideoModel && availableReferenceModes.length > 0
+ "
+ class="param-row"
+ >
<span class="param-label">参考图</span>
- <el-select v-model="selectedReferenceMode" placeholder="请选择参考图模式" size="default" style="flex: 1;">
- <el-option v-for="mode in availableReferenceModes" :key="mode.value" :label="mode.label"
- :value="mode.value">
- <div style="display: flex; justify-content: space-between; align-items: center;">
+ <el-select
+ v-model="selectedReferenceMode"
+ placeholder="请选择参考图模式"
+ size="default"
+ style="flex: 1"
+ >
+ <el-option
+ v-for="mode in availableReferenceModes"
+ :key="mode.value"
+ :label="mode.label"
+ :value="mode.value"
+ >
+ <div
+ style="
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ "
+ >
<span>{{ mode.label }}</span>
- <span v-if="mode.description" class="mode-description">{{ mode.description }}</span>
+ <span
+ v-if="mode.description"
+ class="mode-description"
+ >{{ mode.description }}</span
+ >
</div>
</el-option>
</el-select>
</div>
<div class="param-row">
- <span class="param-label">{{ $t('professionalEditor.duration') }}</span>
- <div style="flex: 1; display: flex; align-items: center;">
- <el-slider v-model="videoDuration" :min="4" :max="10" :step="1" show-stops style="flex: 1;" />
- <span style="margin-left: 10px; min-width: 40px;">{{ videoDuration }}{{
- $t('professionalEditor.seconds') }}</span>
+ <span class="param-label">{{
+ $t("professionalEditor.duration")
+ }}</span>
+ <div style="flex: 1; display: flex; align-items: center">
+ <el-slider
+ v-model="videoDuration"
+ :min="4"
+ :max="10"
+ :step="1"
+ show-stops
+ style="flex: 1"
+ />
+ <span style="margin-left: 10px; min-width: 40px"
+ >{{ videoDuration
+ }}{{ $t("professionalEditor.seconds") }}</span
+ >
</div>
</div>
</div>
<!-- 选择参考图片 -->
- <div v-if="selectedReferenceMode && selectedReferenceMode !== 'none'" class="reference-images-section"
- style="margin-top: 0;">
- <div class="frame-type-buttons" style="text-align: center; margin-bottom: 8px;">
- <el-radio-group v-model="selectedVideoFrameType" size="default">
+ <div
+ v-if="
+ selectedReferenceMode && selectedReferenceMode !== 'none'
+ "
+ class="reference-images-section"
+ style="margin-top: 0"
+ >
+ <div
+ class="frame-type-buttons"
+ style="text-align: center; margin-bottom: 8px"
+ >
+ <el-radio-group
+ v-model="selectedVideoFrameType"
+ size="default"
+ >
<el-radio-button label="first">首帧</el-radio-button>
<el-radio-button label="last">尾帧</el-radio-button>
<el-radio-button label="panel">分镜板</el-radio-button>
@@ -390,45 +720,134 @@
<div class="frame-type-content">
<!-- 首帧 -->
- <div v-show="selectedVideoFrameType === 'first'" class="image-scroll-container"
- style="max-height: 280px; overflow-y: auto; overflow-x: hidden;">
-
+ <div
+ v-show="selectedVideoFrameType === 'first'"
+ class="image-scroll-container"
+ style="
+ max-height: 280px;
+ overflow-y: auto;
+ overflow-x: hidden;
+ "
+ >
<!-- 上一镜头尾帧推荐(紧凑版) -->
- <div v-if="previousStoryboardLastFrames.length > 0" class="previous-frame-section">
- <div style="display: flex; align-items: center; gap: 6px; margin-bottom: 6px;">
+ <div
+ v-if="previousStoryboardLastFrames.length > 0"
+ class="previous-frame-section"
+ >
+ <div
+ style="
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin-bottom: 6px;
+ "
+ >
<el-tag size="small" type="primary">
- 上一镜头 #{{ previousStoryboard?.storyboard_number }} 尾帧
+ 上一镜头 #{{
+ previousStoryboard?.storyboard_number
+ }}
+ 尾帧
</el-tag>
<span class="hint-text">点击添加为首帧参考</span>
</div>
- <div style="display: flex; gap: 8px; flex-wrap: wrap;">
- <div v-for="img in previousStoryboardLastFrames" :key="'prev-' + img.id"
+ <div style="display: flex; gap: 8px; flex-wrap: wrap">
+ <div
+ v-for="img in previousStoryboardLastFrames"
+ :key="'prev-' + img.id"
class="reference-item"
- :class="{ selected: selectedImagesForVideo.includes(img.id) }"
- style="position: relative; border: 2px solid #1890ff; border-radius: 4px; overflow: hidden; cursor: pointer;"
- @click="selectPreviousLastFrame(img)">
- <el-image :src="img.image_url" fit="cover"
- style="width: 60px; height: 40px; display: block; pointer-events: none;" />
- <div v-if="selectedImagesForVideo.includes(img.id)"
- style="position: absolute; top: 0; right: 0; background: #52c41a; color: #fff; font-size: 10px; padding: 1px 4px;">
+ :class="{
+ selected: selectedImagesForVideo.includes(img.id),
+ }"
+ style="
+ position: relative;
+ border: 2px solid #1890ff;
+ border-radius: 4px;
+ overflow: hidden;
+ cursor: pointer;
+ "
+ @click="selectPreviousLastFrame(img)"
+ >
+ <el-image
+ :src="img.image_url"
+ fit="cover"
+ style="
+ width: 60px;
+ height: 40px;
+ display: block;
+ pointer-events: none;
+ "
+ />
+ <div
+ v-if="selectedImagesForVideo.includes(img.id)"
+ style="
+ position: absolute;
+ top: 0;
+ right: 0;
+ background: #52c41a;
+ color: #fff;
+ font-size: 10px;
+ padding: 1px 4px;
+ "
+ >
✓
</div>
</div>
</div>
</div>
-
+
<!-- 当前镜头首帧列表 -->
- <div class="reference-grid"
- style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 600px;">
+ <div
+ class="reference-grid"
+ style="
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 12px;
+ max-width: 600px;
+ "
+ >
<div
- v-for="img in videoReferenceImages.filter(i => i.status === 'completed' && i.image_url && i.frame_type === 'first')"
- :key="img.id" class="reference-item"
- :class="{ selected: selectedImagesForVideo.includes(img.id) }" style="position: relative;"
- @click="handleImageSelect(img.id)">
- <el-image :src="img.image_url" fit="cover"
- style="max-width: 120px; width: 100%; display: block; pointer-events: none;" />
- <div class="preview-icon" @click.stop="previewImage(img.image_url)"
- style="position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; background: rgba(0,0,0,0.6); border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10;">
+ v-for="img in videoReferenceImages.filter(
+ (i) =>
+ i.status === 'completed' &&
+ i.image_url &&
+ i.frame_type === 'first',
+ )"
+ :key="img.id"
+ class="reference-item"
+ :class="{
+ selected: selectedImagesForVideo.includes(img.id),
+ }"
+ style="position: relative"
+ @click="handleImageSelect(img.id)"
+ >
+ <el-image
+ :src="img.image_url"
+ fit="cover"
+ style="
+ max-width: 120px;
+ width: 100%;
+ display: block;
+ pointer-events: none;
+ "
+ />
+ <div
+ class="preview-icon"
+ @click.stop="previewImage(img.image_url)"
+ style="
+ position: absolute;
+ top: 4px;
+ right: 4px;
+ width: 24px;
+ height: 24px;
+ background: rgba(0, 0, 0, 0.6);
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ z-index: 10;
+ "
+ >
<el-icon :size="14" color="#fff">
<ZoomIn />
</el-icon>
@@ -436,24 +855,81 @@
</div>
</div>
<el-empty
- v-if="!videoReferenceImages.some(i => i.status === 'completed' && i.image_url && i.frame_type === 'first') && previousStoryboardLastFrames.length === 0"
- description="暂无首帧图片" size="small" />
+ v-if="
+ !videoReferenceImages.some(
+ (i) =>
+ i.status === 'completed' &&
+ i.image_url &&
+ i.frame_type === 'first',
+ ) && previousStoryboardLastFrames.length === 0
+ "
+ description="暂无首帧图片"
+ size="small"
+ />
</div>
<!-- 关键帧 -->
- <div v-show="selectedVideoFrameType === 'key'" class="image-scroll-container"
- style="max-height: 280px; overflow-y: auto; overflow-x: hidden;">
- <div class="reference-grid"
- style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 600px;">
+ <div
+ v-show="selectedVideoFrameType === 'key'"
+ class="image-scroll-container"
+ style="
+ max-height: 280px;
+ overflow-y: auto;
+ overflow-x: hidden;
+ "
+ >
+ <div
+ class="reference-grid"
+ style="
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 12px;
+ max-width: 600px;
+ "
+ >
<div
- v-for="img in videoReferenceImages.filter(i => i.status === 'completed' && i.image_url && i.frame_type === 'key')"
- :key="img.id" class="reference-item"
- :class="{ selected: selectedImagesForVideo.includes(img.id) }" style="position: relative;"
- @click="handleImageSelect(img.id)">
- <el-image :src="img.image_url" fit="cover"
- style="max-width: 120px; width: 100%; display: block; pointer-events: none;" />
- <div class="preview-icon" @click.stop="previewImage(img.image_url)"
- style="position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; background: rgba(0,0,0,0.6); border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10;">
+ v-for="img in videoReferenceImages.filter(
+ (i) =>
+ i.status === 'completed' &&
+ i.image_url &&
+ i.frame_type === 'key',
+ )"
+ :key="img.id"
+ class="reference-item"
+ :class="{
+ selected: selectedImagesForVideo.includes(img.id),
+ }"
+ style="position: relative"
+ @click="handleImageSelect(img.id)"
+ >
+ <el-image
+ :src="img.image_url"
+ fit="cover"
+ style="
+ max-width: 120px;
+ width: 100%;
+ display: block;
+ pointer-events: none;
+ "
+ />
+ <div
+ class="preview-icon"
+ @click.stop="previewImage(img.image_url)"
+ style="
+ position: absolute;
+ top: 4px;
+ right: 4px;
+ width: 24px;
+ height: 24px;
+ background: rgba(0, 0, 0, 0.6);
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ z-index: 10;
+ "
+ >
<el-icon :size="14" color="#fff">
<ZoomIn />
</el-icon>
@@ -461,24 +937,81 @@
</div>
</div>
<el-empty
- v-if="!videoReferenceImages.some(i => i.status === 'completed' && i.image_url && i.frame_type === 'key')"
- description="暂无关键帧图片" size="small" />
+ v-if="
+ !videoReferenceImages.some(
+ (i) =>
+ i.status === 'completed' &&
+ i.image_url &&
+ i.frame_type === 'key',
+ )
+ "
+ description="暂无关键帧图片"
+ size="small"
+ />
</div>
<!-- 尾帧 -->
- <div v-show="selectedVideoFrameType === 'last'" class="image-scroll-container"
- style="max-height: 280px; overflow-y: auto; overflow-x: hidden;">
- <div class="reference-grid"
- style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 600px;">
+ <div
+ v-show="selectedVideoFrameType === 'last'"
+ class="image-scroll-container"
+ style="
+ max-height: 280px;
+ overflow-y: auto;
+ overflow-x: hidden;
+ "
+ >
+ <div
+ class="reference-grid"
+ style="
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 12px;
+ max-width: 600px;
+ "
+ >
<div
- v-for="img in videoReferenceImages.filter(i => i.status === 'completed' && i.image_url && i.frame_type === 'last')"
- :key="img.id" class="reference-item"
- :class="{ selected: selectedImagesForVideo.includes(img.id) }" style="position: relative;"
- @click="handleImageSelect(img.id)">
- <el-image :src="img.image_url" fit="cover"
- style="max-width: 120px; width: 100%; display: block; pointer-events: none;" />
- <div class="preview-icon" @click.stop="previewImage(img.image_url)"
- style="position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; background: rgba(0,0,0,0.6); border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10;">
+ v-for="img in videoReferenceImages.filter(
+ (i) =>
+ i.status === 'completed' &&
+ i.image_url &&
+ i.frame_type === 'last',
+ )"
+ :key="img.id"
+ class="reference-item"
+ :class="{
+ selected: selectedImagesForVideo.includes(img.id),
+ }"
+ style="position: relative"
+ @click="handleImageSelect(img.id)"
+ >
+ <el-image
+ :src="img.image_url"
+ fit="cover"
+ style="
+ max-width: 120px;
+ width: 100%;
+ display: block;
+ pointer-events: none;
+ "
+ />
+ <div
+ class="preview-icon"
+ @click.stop="previewImage(img.image_url)"
+ style="
+ position: absolute;
+ top: 4px;
+ right: 4px;
+ width: 24px;
+ height: 24px;
+ background: rgba(0, 0, 0, 0.6);
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ z-index: 10;
+ "
+ >
<el-icon :size="14" color="#fff">
<ZoomIn />
</el-icon>
@@ -486,24 +1019,81 @@
</div>
</div>
<el-empty
- v-if="!videoReferenceImages.some(i => i.status === 'completed' && i.image_url && i.frame_type === 'last')"
- description="暂无尾帧图片" size="small" />
+ v-if="
+ !videoReferenceImages.some(
+ (i) =>
+ i.status === 'completed' &&
+ i.image_url &&
+ i.frame_type === 'last',
+ )
+ "
+ description="暂无尾帧图片"
+ size="small"
+ />
</div>
<!-- 分镜板 -->
- <div v-show="selectedVideoFrameType === 'panel'" class="image-scroll-container"
- style="max-height: 280px; overflow-y: auto; overflow-x: hidden;">
- <div class="reference-grid"
- style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 600px;">
+ <div
+ v-show="selectedVideoFrameType === 'panel'"
+ class="image-scroll-container"
+ style="
+ max-height: 280px;
+ overflow-y: auto;
+ overflow-x: hidden;
+ "
+ >
+ <div
+ class="reference-grid"
+ style="
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 12px;
+ max-width: 600px;
+ "
+ >
<div
- v-for="img in videoReferenceImages.filter(i => i.status === 'completed' && i.image_url && i.frame_type === 'panel')"
- :key="img.id" class="reference-item"
- :class="{ selected: selectedImagesForVideo.includes(img.id) }" style="position: relative;"
- @click="handleImageSelect(img.id)">
- <el-image :src="img.image_url" fit="cover"
- style="max-width: 120px; width: 100%; display: block; pointer-events: none;" />
- <div class="preview-icon" @click.stop="previewImage(img.image_url)"
- style="position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; background: rgba(0,0,0,0.6); border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10;">
+ v-for="img in videoReferenceImages.filter(
+ (i) =>
+ i.status === 'completed' &&
+ i.image_url &&
+ i.frame_type === 'panel',
+ )"
+ :key="img.id"
+ class="reference-item"
+ :class="{
+ selected: selectedImagesForVideo.includes(img.id),
+ }"
+ style="position: relative"
+ @click="handleImageSelect(img.id)"
+ >
+ <el-image
+ :src="img.image_url"
+ fit="cover"
+ style="
+ max-width: 120px;
+ width: 100%;
+ display: block;
+ pointer-events: none;
+ "
+ />
+ <div
+ class="preview-icon"
+ @click.stop="previewImage(img.image_url)"
+ style="
+ position: absolute;
+ top: 4px;
+ right: 4px;
+ width: 24px;
+ height: 24px;
+ background: rgba(0, 0, 0, 0.6);
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ z-index: 10;
+ "
+ >
<el-icon :size="14" color="#fff">
<ZoomIn />
</el-icon>
@@ -511,24 +1101,81 @@
</div>
</div>
<el-empty
- v-if="!videoReferenceImages.some(i => i.status === 'completed' && i.image_url && i.frame_type === 'panel')"
- description="暂无分镜板图片" size="small" />
+ v-if="
+ !videoReferenceImages.some(
+ (i) =>
+ i.status === 'completed' &&
+ i.image_url &&
+ i.frame_type === 'panel',
+ )
+ "
+ description="暂无分镜板图片"
+ size="small"
+ />
</div>
<!-- 动作序列 -->
- <div v-show="selectedVideoFrameType === 'action'" class="image-scroll-container"
- style="max-height: 280px; overflow-y: auto; overflow-x: hidden;">
- <div class="reference-grid"
- style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 600px;">
+ <div
+ v-show="selectedVideoFrameType === 'action'"
+ class="image-scroll-container"
+ style="
+ max-height: 280px;
+ overflow-y: auto;
+ overflow-x: hidden;
+ "
+ >
+ <div
+ class="reference-grid"
+ style="
+ display: grid;
+ grid-template-columns: repeat(4, 1fr);
+ gap: 12px;
+ max-width: 600px;
+ "
+ >
<div
- v-for="img in videoReferenceImages.filter(i => i.status === 'completed' && i.image_url && i.frame_type === 'action')"
- :key="img.id" class="reference-item"
- :class="{ selected: selectedImagesForVideo.includes(img.id) }" style="position: relative;"
- @click="handleImageSelect(img.id)">
- <el-image :src="img.image_url" fit="cover"
- style="max-width: 120px; width: 100%; display: block; pointer-events: none;" />
- <div class="preview-icon" @click.stop="previewImage(img.image_url)"
- style="position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; background: rgba(0,0,0,0.6); border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 10;">
+ v-for="img in videoReferenceImages.filter(
+ (i) =>
+ i.status === 'completed' &&
+ i.image_url &&
+ i.frame_type === 'action',
+ )"
+ :key="img.id"
+ class="reference-item"
+ :class="{
+ selected: selectedImagesForVideo.includes(img.id),
+ }"
+ style="position: relative"
+ @click="handleImageSelect(img.id)"
+ >
+ <el-image
+ :src="img.image_url"
+ fit="cover"
+ style="
+ max-width: 120px;
+ width: 100%;
+ display: block;
+ pointer-events: none;
+ "
+ />
+ <div
+ class="preview-icon"
+ @click.stop="previewImage(img.image_url)"
+ style="
+ position: absolute;
+ top: 4px;
+ right: 4px;
+ width: 24px;
+ height: 24px;
+ background: rgba(0, 0, 0, 0.6);
+ border-radius: 4px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ z-index: 10;
+ "
+ >
<el-icon :size="14" color="#fff">
<ZoomIn />
</el-icon>
@@ -536,32 +1183,64 @@
</div>
</div>
<el-empty
- v-if="!videoReferenceImages.some(i => i.status === 'completed' && i.image_url && i.frame_type === 'action')"
- description="暂无动作序列图片" size="small" />
+ v-if="
+ !videoReferenceImages.some(
+ (i) =>
+ i.status === 'completed' &&
+ i.image_url &&
+ i.frame_type === 'action',
+ )
+ "
+ description="暂无动作序列图片"
+ size="small"
+ />
</div>
</div>
</div>
<!-- 参考图片设置 -->
- <div v-if="selectedReferenceMode && selectedReferenceMode !== 'none'" class="reference-config-section"
- style="margin-top: 24px;">
+ <div
+ v-if="
+ selectedReferenceMode && selectedReferenceMode !== 'none'
+ "
+ class="reference-config-section"
+ style="margin-top: 24px"
+ >
<!-- 图片框配置区 -->
- <div class="image-slots-container" style="margin-top: 16px; margin-bottom: 24px;">
+ <div
+ class="image-slots-container"
+ style="margin-top: 16px; margin-bottom: 24px"
+ >
<!-- 单图模式 -->
- <div v-if="selectedReferenceMode === 'single'" style="text-align: center;">
+ <div
+ v-if="selectedReferenceMode === 'single'"
+ style="text-align: center"
+ >
<div class="reference-mode-title">单图参考</div>
- <div style="display: inline-block;">
- <div class="image-slot"
- @click="selectedImagesForVideo.length > 0 && removeSelectedImage(selectedImagesForVideo[0])">
- <img v-if="selectedImageObjects[0]" :src="selectedImageObjects[0].image_url" alt=""
- style="width: 100%; height: 100%; object-fit: cover;" />
+ <div style="display: inline-block">
+ <div
+ class="image-slot"
+ @click="
+ selectedImagesForVideo.length > 0 &&
+ removeSelectedImage(selectedImagesForVideo[0])
+ "
+ >
+ <img
+ v-if="selectedImageObjects[0]"
+ :src="selectedImageObjects[0].image_url"
+ alt=""
+ style="width: 100%; height: 100%; object-fit: cover"
+ />
<div v-else class="image-slot-placeholder">
<el-icon :size="32" color="#c0c4cc">
<Plus />
</el-icon>
<div class="slot-hint">点击上方选择图片</div>
</div>
- <div v-if="selectedImageObjects[0]" class="image-slot-remove">
+ <div
+ v-if="selectedImageObjects[0]"
+ class="image-slot-remove"
+ >
<el-icon :size="16" color="#fff">
<Close />
</el-icon>
@@ -571,22 +1250,48 @@
</div>
<!-- 首尾帧模式 -->
- <div v-else-if="selectedReferenceMode === 'first_last'" style="text-align: center;">
+ <div
+ v-else-if="selectedReferenceMode === 'first_last'"
+ style="text-align: center"
+ >
<div class="reference-mode-title">首尾帧</div>
- <div style="display: flex; gap: 20px; justify-content: center; align-items: center;">
+ <div
+ style="
+ display: flex;
+ gap: 20px;
+ justify-content: center;
+ align-items: center;
+ "
+ >
<div>
<div class="frame-label">首帧</div>
- <div class="image-slot"
- @click="firstFrameSlotImage && removeSelectedImage(firstFrameSlotImage.id)">
- <img v-if="firstFrameSlotImage" :src="firstFrameSlotImage.image_url" alt=""
- style="width: 100%; height: 100%; object-fit: cover;" />
+ <div
+ class="image-slot"
+ @click="
+ firstFrameSlotImage &&
+ removeSelectedImage(firstFrameSlotImage.id)
+ "
+ >
+ <img
+ v-if="firstFrameSlotImage"
+ :src="firstFrameSlotImage.image_url"
+ alt=""
+ style="
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ "
+ />
<div v-else class="image-slot-placeholder">
<el-icon :size="32" color="#c0c4cc">
<Plus />
</el-icon>
<div class="slot-hint">选择首帧</div>
</div>
- <div v-if="firstFrameSlotImage" class="image-slot-remove">
+ <div
+ v-if="firstFrameSlotImage"
+ class="image-slot-remove"
+ >
<el-icon :size="16" color="#fff">
<Close />
</el-icon>
@@ -598,17 +1303,33 @@
</el-icon>
<div>
<div class="frame-label">尾帧</div>
- <div class="image-slot"
- @click="lastFrameSlotImage && removeSelectedImage(lastFrameSlotImage.id)">
- <img v-if="lastFrameSlotImage" :src="lastFrameSlotImage.image_url" alt=""
- style="width: 100%; height: 100%; object-fit: cover;" />
+ <div
+ class="image-slot"
+ @click="
+ lastFrameSlotImage &&
+ removeSelectedImage(lastFrameSlotImage.id)
+ "
+ >
+ <img
+ v-if="lastFrameSlotImage"
+ :src="lastFrameSlotImage.image_url"
+ alt=""
+ style="
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ "
+ />
<div v-else class="image-slot-placeholder">
<el-icon :size="32" color="#c0c4cc">
<Plus />
</el-icon>
<div class="slot-hint">选择尾帧</div>
</div>
- <div v-if="lastFrameSlotImage" class="image-slot-remove">
+ <div
+ v-if="lastFrameSlotImage"
+ class="image-slot-remove"
+ >
<el-icon :size="16" color="#fff">
<Close />
</el-icon>
@@ -619,24 +1340,76 @@
</div>
<!-- 多图模式 -->
- <div v-else-if="selectedReferenceMode === 'multiple'" style="text-align: center;">
- <div style="margin-bottom: 12px; font-size: 13px; color: #606266; font-weight: 500;">
- 多图参考 ({{ selectedImagesForVideo.length }}/{{ currentModelCapability?.maxImages || 6 }})
+ <div
+ v-else-if="selectedReferenceMode === 'multiple'"
+ style="text-align: center"
+ >
+ <div
+ style="
+ margin-bottom: 12px;
+ font-size: 13px;
+ color: #606266;
+ font-weight: 500;
+ "
+ >
+ 多图参考 ({{ selectedImagesForVideo.length }}/{{
+ currentModelCapability?.maxImages || 6
+ }})
</div>
- <div style="display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;">
- <div v-for="index in (currentModelCapability?.maxImages || 6)" :key="index"
+ <div
+ style="
+ display: flex;
+ gap: 12px;
+ justify-content: center;
+ flex-wrap: wrap;
+ "
+ >
+ <div
+ v-for="index in currentModelCapability?.maxImages ||
+ 6"
+ :key="index"
class="image-slot image-slot-small"
- style="position: relative; width: 80px; height: 52px; border: 2px dashed #dcdfe6; border-radius: 8px; overflow: hidden; cursor: pointer; background: #fff;"
- @click="selectedImageObjects[index - 1] && removeSelectedImage(selectedImageObjects[index - 1].id)">
- <img v-if="selectedImageObjects[index - 1]" :src="selectedImageObjects[index - 1].image_url"
- alt="" style="width: 100%; height: 100%; object-fit: cover;" />
+ style="
+ position: relative;
+ width: 80px;
+ height: 52px;
+ border: 2px dashed #dcdfe6;
+ border-radius: 8px;
+ overflow: hidden;
+ cursor: pointer;
+ background: #fff;
+ "
+ @click="
+ selectedImageObjects[index - 1] &&
+ removeSelectedImage(
+ selectedImageObjects[index - 1].id,
+ )
+ "
+ >
+ <img
+ v-if="selectedImageObjects[index - 1]"
+ :src="selectedImageObjects[index - 1].image_url"
+ alt=""
+ style="width: 100%; height: 100%; object-fit: cover"
+ />
<div v-else class="image-slot-placeholder">
<el-icon :size="20" color="#c0c4cc">
<Plus />
</el-icon>
- <div style="margin-top: 4px; font-size: 10px; color: #909399;">{{ index }}</div>
+ <div
+ style="
+ margin-top: 4px;
+ font-size: 10px;
+ color: #909399;
+ "
+ >
+ {{ index }}
+ </div>
</div>
- <div v-if="selectedImageObjects[index - 1]" class="image-slot-remove">
+ <div
+ v-if="selectedImageObjects[index - 1]"
+ class="image-slot-remove"
+ >
<el-icon :size="14" color="#fff">
<Close />
</el-icon>
@@ -648,57 +1421,206 @@
</div>
<!-- 生成控制 -->
- <div class="generation-controls" style="margin-top: 32px; text-align: center;">
- <el-button type="primary" :icon="VideoCamera" :loading="generatingVideo"
- :disabled="!selectedVideoModel || (selectedReferenceMode !== 'none' && selectedImagesForVideo.length === 0)"
- @click="generateVideo">
- {{ generatingVideo ? '生成中...' : '生成视频' }}
+ <div
+ class="generation-controls"
+ style="margin-top: 32px; text-align: center"
+ >
+ <el-button
+ type="primary"
+ :icon="VideoCamera"
+ :loading="generatingVideo"
+ :disabled="
+ !selectedVideoModel ||
+ (selectedReferenceMode !== 'none' &&
+ selectedImagesForVideo.length === 0)
+ "
+ @click="generateVideo"
+ >
+ {{ generatingVideo ? "生成中..." : "生成视频" }}
</el-button>
</div>
<!-- 生成的视频列表 -->
- <div class="generation-result" v-if="generatedVideos.length > 0" style="margin-top: 24px;">
- <div class="section-label"
- style="font-size: 13px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 6px;">
+ <div
+ class="generation-result"
+ v-if="generatedVideos.length > 0"
+ style="margin-top: 24px"
+ >
+ <div
+ class="section-label"
+ style="
+ font-size: 13px;
+ font-weight: 600;
+ margin-bottom: 12px;
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ "
+ >
<span></span>
生成结果 ({{ generatedVideos.length }})
</div>
- <div class="image-grid"
- style="display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;">
- <div v-for="video in generatedVideos" :key="video.id" class="image-item video-item"
- style="position: relative; border-radius: 8px; overflow: hidden; background: #fff; border: 1px solid #e8e8e8; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06); cursor: pointer; transition: all 0.2s ease;">
- <div class="video-thumbnail" v-if="video.video_url"
- style="position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; cursor: pointer;"
- @mouseenter="(e) => e.currentTarget.querySelector('.play-overlay').style.opacity = '1'"
- @mouseleave="(e) => e.currentTarget.querySelector('.play-overlay').style.opacity = '0'"
- @click="playVideo(video)">
- <video :src="video.video_url" preload="metadata"
- style="width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;" />
- <div class="play-overlay"
- style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.3); opacity: 0; transition: opacity 0.2s;">
- <el-icon :size="32" color="#fff" style="filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));">
+ <div
+ class="image-grid"
+ style="
+ display: grid;
+ grid-template-columns: repeat(
+ auto-fill,
+ minmax(140px, 1fr)
+ );
+ gap: 10px;
+ "
+ >
+ <div
+ v-for="video in generatedVideos"
+ :key="video.id"
+ class="image-item video-item"
+ style="
+ position: relative;
+ border-radius: 8px;
+ overflow: hidden;
+ background: #fff;
+ border: 1px solid #e8e8e8;
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
+ cursor: pointer;
+ transition: all 0.2s ease;
+ "
+ >
+ <div
+ class="video-thumbnail"
+ v-if="video.video_url"
+ style="
+ position: relative;
+ width: 100%;
+ aspect-ratio: 16/9;
+ overflow: hidden;
+ cursor: pointer;
+ "
+ @mouseenter="
+ (e) =>
+ (e.currentTarget.querySelector(
+ '.play-overlay',
+ ).style.opacity = '1')
+ "
+ @mouseleave="
+ (e) =>
+ (e.currentTarget.querySelector(
+ '.play-overlay',
+ ).style.opacity = '0')
+ "
+ @click="playVideo(video)"
+ >
+ <video
+ :src="video.video_url"
+ preload="metadata"
+ style="
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+ display: block;
+ pointer-events: none;
+ "
+ />
+ <div
+ class="play-overlay"
+ style="
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: rgba(0, 0, 0, 0.3);
+ opacity: 0;
+ transition: opacity 0.2s;
+ "
+ >
+ <el-icon
+ :size="32"
+ color="#fff"
+ style="
+ filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
+ "
+ >
<VideoPlay />
</el-icon>
</div>
</div>
- <div v-else class="image-placeholder"
- style="width: 100%; aspect-ratio: 16/9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf0 100%); color: #909399;">
+ <div
+ v-else
+ class="image-placeholder"
+ style="
+ width: 100%;
+ aspect-ratio: 16/9;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 8px;
+ background: linear-gradient(
+ 135deg,
+ #f5f7fa 0%,
+ #e8ecf0 100%
+ );
+ color: #909399;
+ "
+ >
<el-icon :size="32">
<VideoCamera />
</el-icon>
- <p style="margin: 0; font-size: 11px;">生成中...</p>
+ <p style="margin: 0; font-size: 11px">生成中...</p>
</div>
- <div class="image-info"
- style="position: absolute; bottom: 0; left: 0; right: 0; padding: 6px 8px; background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.2) 70%, transparent); display: flex; justify-content: space-between; align-items: center; gap: 4px;">
- <div style="display: flex; align-items: center; gap: 4px;">
- <el-tag :type="getStatusType(video.status)" size="small"
- style="font-size: 10px; height: 20px; padding: 0 6px;">{{ getStatusText(video.status)
- }}</el-tag>
+ <div
+ class="image-info"
+ style="
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ padding: 6px 8px;
+ background: linear-gradient(
+ to top,
+ rgba(0, 0, 0, 0.75),
+ rgba(0, 0, 0, 0.2) 70%,
+ transparent
+ );
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: 4px;
+ "
+ >
+ <div
+ style="display: flex; align-items: center; gap: 4px"
+ >
+ <el-tag
+ :type="getStatusType(video.status)"
+ size="small"
+ style="
+ font-size: 10px;
+ height: 20px;
+ padding: 0 6px;
+ "
+ >{{ getStatusText(video.status) }}</el-tag
+ >
</div>
- <div style="display: flex; gap: 4px;">
- <el-button v-if="video.status === 'completed' && video.video_url" type="success" size="small"
- :loading="addingToAssets.has(video.id)" @click.stop="addVideoToAssets(video)">
- {{ addingToAssets.has(video.id) ? '添加中...' : '添加到素材库' }}
+ <div style="display: flex; gap: 4px">
+ <el-button
+ v-if="
+ video.status === 'completed' && video.video_url
+ "
+ type="success"
+ size="small"
+ :loading="addingToAssets.has(video.id)"
+ @click.stop="addVideoToAssets(video)"
+ >
+ {{
+ addingToAssets.has(video.id)
+ ? "添加中..."
+ : "添加到素材库"
+ }}
</el-button>
</div>
</div>
@@ -721,17 +1643,29 @@
<el-tab-pane :label="$t('video.videoMerge')" name="merges">
<div class="tab-content">
<div class="merges-list" v-loading="loadingMerges">
- <el-empty v-if="videoMerges.length === 0" :description="$t('video.noMergeRecords')" :image-size="120">
+ <el-empty
+ v-if="videoMerges.length === 0"
+ :description="$t('video.noMergeRecords')"
+ :image-size="120"
+ >
<template #description>
- <div style="color: #909399; font-size: 14px; margin-top: 12px;">
- <p style="margin: 0;">{{ $t('video.noMergeYet') }}</p>
- <p style="margin: 8px 0 0 0; font-size: 12px;">{{ $t('video.mergeInstructions') }}</p>
+ <div
+ style="color: #909399; font-size: 14px; margin-top: 12px"
+ >
+ <p style="margin: 0">{{ $t("video.noMergeYet") }}</p>
+ <p style="margin: 8px 0 0 0; font-size: 12px">
+ {{ $t("video.mergeInstructions") }}
+ </p>
</div>
</template>
</el-empty>
<div v-else class="merge-items">
- <div v-for="merge in videoMerges" :key="merge.id" class="merge-item"
- :class="'merge-status-' + merge.status">
+ <div
+ v-for="merge in videoMerges"
+ :key="merge.id"
+ class="merge-item"
+ :class="'merge-status-' + merge.status"
+ >
<!-- 状态指示条 -->
<div class="status-indicator"></div>
@@ -742,18 +1676,38 @@
<div class="title-section">
<el-icon :size="20" class="title-icon">
<VideoCamera v-if="merge.status === 'completed'" />
- <Loading v-else-if="merge.status === 'processing'" class="rotating" />
- <WarningFilled v-else-if="merge.status === 'failed'" />
+ <Loading
+ v-else-if="merge.status === 'processing'"
+ class="rotating"
+ />
+ <WarningFilled
+ v-else-if="merge.status === 'failed'"
+ />
<Clock v-else />
</el-icon>
<h3 class="merge-title">{{ merge.title }}</h3>
</div>
<el-tag
- :type="merge.status === 'completed' ? 'success' : merge.status === 'failed' ? 'danger' : 'warning'"
- effect="dark" size="large" round>
- {{ merge.status === 'pending' ? '等待中' : merge.status === 'processing' ? '合成中' : merge.status
- === 'completed' ?
- '已完成' : '失败' }}
+ :type="
+ merge.status === 'completed'
+ ? 'success'
+ : merge.status === 'failed'
+ ? 'danger'
+ : 'warning'
+ "
+ effect="dark"
+ size="large"
+ round
+ >
+ {{
+ merge.status === "pending"
+ ? "等待中"
+ : merge.status === "processing"
+ ? "合成中"
+ : merge.status === "completed"
+ ? "已完成"
+ : "失败"
+ }}
</el-tag>
</div>
@@ -766,10 +1720,17 @@
</el-icon>
</div>
<div class="detail-content">
- <div class="detail-label">{{ $t('professionalEditor.videoDuration') }}</div>
- <div class="detail-value">{{ merge.duration ? `${merge.duration}
- ${$t('professionalEditor.seconds')}` : '-'
- }}</div>
+ <div class="detail-label">
+ {{ $t("professionalEditor.videoDuration") }}
+ </div>
+ <div class="detail-value">
+ {{
+ merge.duration
+ ? `${merge.duration}
+ ${$t("professionalEditor.seconds")}`
+ : "-"
+ }}
+ </div>
</div>
</div>
<div class="detail-item">
@@ -780,7 +1741,9 @@
</div>
<div class="detail-content">
<div class="detail-label">创建时间</div>
- <div class="detail-value">{{ formatDateTime(merge.created_at) }}</div>
+ <div class="detail-value">
+ {{ formatDateTime(merge.created_at) }}
+ </div>
</div>
</div>
<div class="detail-item" v-if="merge.completed_at">
@@ -791,33 +1754,58 @@
</div>
<div class="detail-content">
<div class="detail-label">完成时间</div>
- <div class="detail-value">{{ formatDateTime(merge.completed_at) }}</div>
+ <div class="detail-value">
+ {{ formatDateTime(merge.completed_at) }}
+ </div>
</div>
</div>
</div>
<!-- 错误提示 -->
- <div class="merge-error" v-if="merge.status === 'failed' && merge.error_msg">
+ <div
+ class="merge-error"
+ v-if="merge.status === 'failed' && merge.error_msg"
+ >
<el-alert type="error" :closable="false" show-icon>
<template #title>
- <div style="font-size: 13px; line-height: 1.5;">{{ merge.error_msg }}</div>
+ <div style="font-size: 13px; line-height: 1.5">
+ {{ merge.error_msg }}
+ </div>
</template>
</el-alert>
</div>
<!-- 操作按钮 -->
<div class="merge-actions">
- <template v-if="merge.status === 'completed' && merge.merged_url">
- <el-button type="primary" :icon="VideoCamera"
- @click="downloadVideo(merge.merged_url, merge.title)" round>
+ <template
+ v-if="
+ merge.status === 'completed' && merge.merged_url
+ "
+ >
+ <el-button
+ type="primary"
+ :icon="VideoCamera"
+ @click="
+ downloadVideo(merge.merged_url, merge.title)
+ "
+ round
+ >
下载视频
</el-button>
- <el-button :icon="View" @click="previewMergedVideo(merge.merged_url)" round>
+ <el-button
+ :icon="View"
+ @click="previewMergedVideo(merge.merged_url)"
+ round
+ >
在线预览
</el-button>
</template>
- <el-button type="danger" :icon="Delete"
- @click="deleteMerge(merge.id)" round>
+ <el-button
+ type="danger"
+ :icon="Delete"
+ @click="deleteMerge(merge.id)"
+ round
+ >
删除
</el-button>
</div>
@@ -832,35 +1820,61 @@
</div>
<!-- 角色选择器对话框 -->
- <el-dialog v-model="showCharacterImagePreview" :title="previewCharacter?.name" width="600px">
+ <el-dialog
+ v-model="showCharacterImagePreview"
+ :title="previewCharacter?.name"
+ width="600px"
+ >
<div class="character-image-preview" v-if="previewCharacter">
- <img v-if="previewCharacter.image_url" :src="previewCharacter.image_url" :alt="previewCharacter.name" />
+ <img
+ v-if="previewCharacter.image_url"
+ :src="previewCharacter.image_url"
+ :alt="previewCharacter.name"
+ />
<el-empty v-else description="暂无图片" />
</div>
<!-- ... -->
</el-dialog>
<!-- 场景大图预览对话框 -->
- <el-dialog v-model="showSceneImagePreview"
- :title="currentStoryboard?.background ? `${currentStoryboard.background.location} · ${currentStoryboard.background.time}` : '场景预览'"
- width="800px">
- <div class="scene-image-preview" v-if="currentStoryboard?.background?.image_url">
+ <el-dialog
+ v-model="showSceneImagePreview"
+ :title="
+ currentStoryboard?.background
+ ? `${currentStoryboard.background.location} · ${currentStoryboard.background.time}`
+ : '场景预览'
+ "
+ width="800px"
+ >
+ <div
+ class="scene-image-preview"
+ v-if="currentStoryboard?.background?.image_url"
+ >
<img :src="currentStoryboard.background.image_url" alt="场景" />
</div>
</el-dialog>
<!-- 角色选择对话框 -->
- <el-dialog v-model="showCharacterSelector" title="添加角色到镜头" width="800px">
+ <el-dialog
+ v-model="showCharacterSelector"
+ title="添加角色到镜头"
+ width="800px"
+ >
<div class="character-selector-grid">
- <div v-for="char in availableCharacters" :key="char.id" class="character-card"
- :class="{ selected: isCharacterInCurrentShot(char.id) }" @click="toggleCharacterInShot(char.id)">
+ <div
+ v-for="char in availableCharacters"
+ :key="char.id"
+ class="character-card"
+ :class="{ selected: isCharacterInCurrentShot(char.id) }"
+ @click="toggleCharacterInShot(char.id)"
+ >
<div class="character-avatar-large">
<img v-if="char.image_url" :src="char.image_url" :alt="char.name" />
- <span v-else>{{ char.name?.[0] || '?' }}</span>
+ <span v-else>{{ char.name?.[0] || "?" }}</span>
</div>
<div class="character-info">
<div class="character-name">{{ char.name }}</div>
- <div class="character-role">{{ char.role || '角色' }}</div>
+ <div class="character-role">{{ char.role || "角色" }}</div>
</div>
<div class="character-check" v-if="isCharacterInCurrentShot(char.id)">
<el-icon color="#409eff" :size="24">
@@ -878,17 +1892,28 @@
</el-dialog>
<!-- 道具选择对话框 -->
- <el-dialog v-model="showPropSelector" :title="$t('editor.addPropToShot')" width="800px">
+ <el-dialog
+ v-model="showPropSelector"
+ :title="$t('editor.addPropToShot')"
+ width="800px"
+ >
<div class="character-selector-grid">
- <div v-for="prop in availableProps" :key="prop.id" class="character-card"
- :class="{ selected: isPropInCurrentShot(prop.id) }" @click="togglePropInShot(prop.id)">
+ <div
+ v-for="prop in availableProps"
+ :key="prop.id"
+ class="character-card"
+ :class="{ selected: isPropInCurrentShot(prop.id) }"
+ @click="togglePropInShot(prop.id)"
+ >
<div class="character-avatar-large">
<img v-if="prop.image_url" :src="prop.image_url" :alt="prop.name" />
<el-icon v-else :size="32"><Box /></el-icon>
</div>
<div class="character-info">
<div class="character-name">{{ prop.name }}</div>
- <div class="character-role">{{ prop.type || $t('editor.props') }}</div>
+ <div class="character-role">
+ {{ prop.type || $t("editor.props") }}
+ </div>
</div>
<div class="character-check" v-if="isPropInCurrentShot(prop.id)">
<el-icon color="#409eff" :size="24">
@@ -901,17 +1926,28 @@
</div>
</div>
<template #footer>
- <el-button @click="showPropSelector = false">{{ $t('common.close') }}</el-button>
+ <el-button @click="showPropSelector = false">{{
+ $t("common.close")
+ }}</el-button>
</template>
</el-dialog>
<!-- 场景选择对话框 -->
<el-dialog v-model="showSceneSelector" title="选择场景背景" width="800px">
<div class="scene-selector-grid">
- <div v-for="scene in availableScenes" :key="scene.id" class="scene-card"
- :class="{ selected: currentStoryboard?.scene_id === scene.id }" @click="selectScene(scene.id)">
+ <div
+ v-for="scene in availableScenes"
+ :key="scene.id"
+ class="scene-card"
+ :class="{ selected: currentStoryboard?.scene_id === scene.id }"
+ @click="selectScene(scene.id)"
+ >
<div class="scene-image">
- <img v-if="scene.image_url" :src="scene.image_url" :alt="scene.location" />
+ <img
+ v-if="scene.image_url"
+ :src="scene.image_url"
+ :alt="scene.location"
+ />
<el-icon v-else :size="48" color="#ccc">
<Picture />
</el-icon>
@@ -928,31 +1964,70 @@
</el-dialog>
<!-- 视频预览对话框 -->
- <el-dialog v-model="showVideoPreview" title="视频预览" width="800px" :close-on-click-modal="true" destroy-on-close>
+ <el-dialog
+ v-model="showVideoPreview"
+ title="视频预览"
+ width="800px"
+ :close-on-click-modal="true"
+ destroy-on-close
+ >
<div class="video-preview-container" v-if="previewVideo">
- <video v-if="previewVideo.video_url" :src="previewVideo.video_url" controls autoplay
- style="width: 100%; max-height: 70vh; display: block; background: #000; border-radius: 8px;" />
- <div v-else style="text-align: center; padding: 40px;">
+ <video
+ v-if="previewVideo.video_url"
+ :src="previewVideo.video_url"
+ controls
+ autoplay
+ style="
+ width: 100%;
+ max-height: 70vh;
+ display: block;
+ background: #000;
+ border-radius: 8px;
+ "
+ />
+ <div v-else style="text-align: center; padding: 40px">
<el-icon :size="48" color="#ccc">
<VideoCamera />
</el-icon>
- <p style="margin-top: 16px; color: #909399;">视频生成中...</p>
+ <p style="margin-top: 16px; color: #909399">视频生成中...</p>
</div>
<div class="video-meta">
- <div style="display: flex; justify-content: space-between; align-items: center;">
+ <div
+ style="
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ "
+ >
<div>
- <el-tag :type="getStatusType(previewVideo.status)" size="small">{{ getStatusText(previewVideo.status)
- }}</el-tag>
- <span v-if="previewVideo.duration" style="margin-left: 12px; color: #606266; font-size: 14px;">{{
- $t('professionalEditor.duration') }}: {{ previewVideo.duration }}{{ $t('professionalEditor.seconds')
- }}</span>
+ <el-tag :type="getStatusType(previewVideo.status)" size="small">{{
+ getStatusText(previewVideo.status)
+ }}</el-tag>
+ <span
+ v-if="previewVideo.duration"
+ style="margin-left: 12px; color: #606266; font-size: 14px"
+ >{{ $t("professionalEditor.duration") }}:
+ {{ previewVideo.duration
+ }}{{ $t("professionalEditor.seconds") }}</span
+ >
</div>
- <el-button v-if="previewVideo.video_url" size="small"
- @click="window.open(previewVideo.video_url, '_blank')">
- {{ $t('professionalEditor.downloadVideo') }}
+ <el-button
+ v-if="previewVideo.video_url"
+ size="small"
+ @click="window.open(previewVideo.video_url, '_blank')"
+ >
+ {{ $t("professionalEditor.downloadVideo") }}
</el-button>
</div>
- <div v-if="previewVideo.prompt" style="margin-top: 12px; font-size: 12px; color: #606266; line-height: 1.6;">
+ <div
+ v-if="previewVideo.prompt"
+ style="
+ margin-top: 12px;
+ font-size: 12px;
+ color: #606266;
+ line-height: 1.6;
+ "
+ >
<strong>提示词:</strong>{{ previewVideo.prompt }}
</div>
</div>
@@ -962,290 +2037,339 @@
</template>
<script setup lang="ts">
-import { ref, computed, watch, onMounted, onBeforeUnmount, nextTick } from 'vue'
-import { useRoute, useRouter } from 'vue-router'
-import { useI18n } from 'vue-i18n'
-import { ElMessage, ElMessageBox } from 'element-plus'
import {
- ArrowLeft, Plus, Picture, VideoPlay, VideoPause, View, Setting,
- Upload, MagicStick, VideoCamera, ZoomIn, ZoomOut, Top, Bottom, Check, Close, Right,
- Timer, Calendar, Clock, Loading, WarningFilled, Delete, Connection, Box
-} from '@element-plus/icons-vue'
-import { dramaAPI } from '@/api/drama'
-import { propAPI } from '@/api/prop'
-import { generateFramePrompt, type FrameType } from '@/api/frame'
-import { imageAPI } from '@/api/image'
-import { videoAPI } from '@/api/video'
-import { aiAPI } from '@/api/ai'
-import { assetAPI } from '@/api/asset'
-import { videoMergeAPI } from '@/api/videoMerge'
-import { taskAPI } from '@/api/task'
-import type { ImageGeneration } from '@/types/image'
-import type { VideoGeneration } from '@/types/video'
-import type { AIServiceConfig } from '@/types/ai'
-import type { Asset } from '@/types/asset'
-import type { VideoMerge } from '@/api/videoMerge'
-import VideoTimelineEditor from '@/components/editor/VideoTimelineEditor.vue'
-import type { Drama, Episode, Storyboard } from '@/types/drama'
-import { AppHeader } from '@/components/common'
-
-const route = useRoute()
-const router = useRouter()
-const { t: $t } = useI18n()
-
-const dramaId = Number(route.params.dramaId)
-const episodeNumber = Number(route.params.episodeNumber)
-const episodeId = ref<number>(0)
-
-const drama = ref<Drama | null>(null)
-const episode = ref<Episode | null>(null)
-const storyboards = ref<Storyboard[]>([])
-const characters = ref<any[]>([])
-const availableScenes = ref<any[]>([])
-const props = ref<any[]>([])
-const showPropSelector = ref(false)
-
-const currentStoryboardId = ref<number | null>(null)
-const activeTab = ref('shot')
-const showSceneSelector = ref(false)
-const showCharacterSelector = ref(false)
-const showCharacterImagePreview = ref(false)
-const previewCharacter = ref<any>(null)
-const showSceneImagePreview = ref(false)
-const showSettings = ref(false)
-const showVideoPreview = ref(false)
-const previewVideo = ref<VideoGeneration | null>(null)
-const addingToAssets = ref<Set<number>>(new Set())
-
-const currentPlayState = ref<'playing' | 'paused'>('paused')
-const currentTime = ref(0)
+ ref,
+ computed,
+ watch,
+ onMounted,
+ onBeforeUnmount,
+ nextTick,
+} from "vue";
+import { useRoute, useRouter } from "vue-router";
+import { useI18n } from "vue-i18n";
+import { ElMessage, ElMessageBox } from "element-plus";
+import {
+ ArrowLeft,
+ Plus,
+ Picture,
+ VideoPlay,
+ VideoPause,
+ View,
+ Setting,
+ Upload,
+ MagicStick,
+ VideoCamera,
+ ZoomIn,
+ ZoomOut,
+ Top,
+ Bottom,
+ Check,
+ Close,
+ Right,
+ Timer,
+ Calendar,
+ Clock,
+ Loading,
+ WarningFilled,
+ Delete,
+ Connection,
+ Box,
+} from "@element-plus/icons-vue";
+import { dramaAPI } from "@/api/drama";
+import { propAPI } from "@/api/prop";
+import { generateFramePrompt, type FrameType } from "@/api/frame";
+import { imageAPI } from "@/api/image";
+import { videoAPI } from "@/api/video";
+import { aiAPI } from "@/api/ai";
+import { assetAPI } from "@/api/asset";
+import { videoMergeAPI } from "@/api/videoMerge";
+import { taskAPI } from "@/api/task";
+import type { ImageGeneration } from "@/types/image";
+import type { VideoGeneration } from "@/types/video";
+import type { AIServiceConfig } from "@/types/ai";
+import type { Asset } from "@/types/asset";
+import type { VideoMerge } from "@/api/videoMerge";
+import VideoTimelineEditor from "@/components/editor/VideoTimelineEditor.vue";
+import type { Drama, Episode, Storyboard } from "@/types/drama";
+import { AppHeader } from "@/components/common";
+
+const route = useRoute();
+const router = useRouter();
+const { t: $t } = useI18n();
+
+const dramaId = Number(route.params.dramaId);
+const episodeNumber = Number(route.params.episodeNumber);
+const episodeId = ref<number>(0);
+
+const drama = ref<Drama | null>(null);
+const episode = ref<Episode | null>(null);
+const storyboards = ref<Storyboard[]>([]);
+const characters = ref<any[]>([]);
+const availableScenes = ref<any[]>([]);
+const props = ref<any[]>([]);
+const showPropSelector = ref(false);
+
+const currentStoryboardId = ref<number | null>(null);
+const activeTab = ref("shot");
+const showSceneSelector = ref(false);
+const showCharacterSelector = ref(false);
+const showCharacterImagePreview = ref(false);
+const previewCharacter = ref<any>(null);
+const showSceneImagePreview = ref(false);
+const showSettings = ref(false);
+const showVideoPreview = ref(false);
+const previewVideo = ref<VideoGeneration | null>(null);
+const addingToAssets = ref<Set<number>>(new Set());
+
+const currentPlayState = ref<"playing" | "paused">("paused");
+const currentTime = ref(0);
const totalDuration = computed(() => {
- if (!Array.isArray(storyboards.value)) return 0
- return storyboards.value.reduce((sum, s) => sum + (s.duration || 0), 0)
-})
+ if (!Array.isArray(storyboards.value)) return 0;
+ return storyboards.value.reduce((sum, s) => sum + (s.duration || 0), 0);
+});
-const selectedCharacters = ref<number[]>([])
-const narrativeTab = ref('shot-prompt')
+const selectedCharacters = ref<number[]>([]);
+const narrativeTab = ref("shot-prompt");
// 图片生成相关状态
-const selectedFrameType = ref<FrameType>('first')
-const panelCount = ref(3)
-const generatingPromptStates = ref<Record<number, boolean>>({}) // 按镜头ID记录生成状态
+const selectedFrameType = ref<FrameType>("first");
+const panelCount = ref(3);
+const generatingPromptStates = ref<Record<string, boolean>>({}); // 按 "镜头ID_帧类型" 记录生成状态
const framePrompts = ref<Record<string, string>>({
- key: '',
- first: '',
- last: '',
- panel: ''
-})
-const currentFramePrompt = ref('')
-const generatingImage = ref(false)
-const generatedImages = ref<ImageGeneration[]>([])
-const isSwitchingFrameType = ref(false) // 标志位:是否正在切换帧类型
-const loadingImages = ref(false)
-let pollingTimer: any = null
-let pollingFrameType: FrameType | null = null // 记录正在轮询的帧类型
+ key: "",
+ first: "",
+ last: "",
+ panel: "",
+});
+const currentFramePrompt = ref("");
+const generatingImage = ref(false);
+const generatedImages = ref<ImageGeneration[]>([]);
+const isSwitchingFrameType = ref(false); // 标志位:是否正在切换帧类型
+const loadingImages = ref(false);
+let pollingTimer: any = null;
+let pollingFrameType: FrameType | null = null; // 记录正在轮询的帧类型
// 视频生成相关状态
-const videoDuration = ref(5) // 默认5秒,会根据镜头duration自动更新
-const selectedVideoFrameType = ref<FrameType>('first')
-const selectedImagesForVideo = ref<number[]>([])
-const selectedLastImageForVideo = ref<number | null>(null)
-const generatingVideo = ref(false)
-const generatedVideos = ref<VideoGeneration[]>([])
-const videoAssets = ref<Asset[]>([])
-const loadingVideos = ref(false)
-const timelineEditorRef = ref<InstanceType<typeof VideoTimelineEditor> | null>(null)
-const videoReferenceImages = ref<ImageGeneration[]>([])
-const selectedVideoModel = ref<string>('')
-const selectedReferenceMode = ref<string>('') // 参考图模式:single, first_last, multiple, none
-const previewImageUrl = ref<string>('') // 预览大图的URL
-const videoModelCapabilities = ref<VideoModelCapability[]>([])
-let videoPollingTimer: any = null
-let mergePollingTimer: any = null // 视频合成列表轮询定时器
+const videoDuration = ref(5); // 默认5秒,会根据镜头duration自动更新
+const selectedVideoFrameType = ref<FrameType>("first");
+const selectedImagesForVideo = ref<number[]>([]);
+const selectedLastImageForVideo = ref<number | null>(null);
+const generatingVideo = ref(false);
+const generatedVideos = ref<VideoGeneration[]>([]);
+const videoAssets = ref<Asset[]>([]);
+const loadingVideos = ref(false);
+const timelineEditorRef = ref<InstanceType<typeof VideoTimelineEditor> | null>(
+ null,
+);
+const videoReferenceImages = ref<ImageGeneration[]>([]);
+const selectedVideoModel = ref<string>("");
+const selectedReferenceMode = ref<string>(""); // 参考图模式:single, first_last, multiple, none
+const previewImageUrl = ref<string>(""); // 预览大图的URL
+const videoModelCapabilities = ref<VideoModelCapability[]>([]);
+let videoPollingTimer: any = null;
+let mergePollingTimer: any = null; // 视频合成列表轮询定时器
// 视频合成列表
-const videoMerges = ref<VideoMerge[]>([])
-const loadingMerges = ref(false)
+const videoMerges = ref<VideoMerge[]>([]);
+const loadingMerges = ref(false);
// 视频模型能力配置
interface VideoModelCapability {
- id: string
- name: string
- supportMultipleImages: boolean // 支持多张图片
- supportFirstLastFrame: boolean // 支持首尾帧
- supportSingleImage: boolean // 支持单图
- supportTextOnly: boolean // 支持纯文本
- maxImages: number // 最多支持几张图片
+ id: string;
+ name: string;
+ supportMultipleImages: boolean; // 支持多张图片
+ supportFirstLastFrame: boolean; // 支持首尾帧
+ supportSingleImage: boolean; // 支持单图
+ supportTextOnly: boolean; // 支持纯文本
+ maxImages: number; // 最多支持几张图片
}
-
// 模型能力默认配置(作为后备)
-const defaultModelCapabilities: Record<string, Omit<VideoModelCapability, 'id' | 'name'>> = {
- 'kling': {
+const defaultModelCapabilities: Record<
+ string,
+ Omit<VideoModelCapability, "id" | "name">
+> = {
+ kling: {
supportSingleImage: true,
supportMultipleImages: false,
supportFirstLastFrame: false,
supportTextOnly: true,
- maxImages: 1
+ maxImages: 1,
},
- 'runway': {
+ runway: {
supportSingleImage: true,
supportMultipleImages: false,
supportFirstLastFrame: true,
supportTextOnly: true,
- maxImages: 2
+ maxImages: 2,
},
- 'pika': {
+ pika: {
supportSingleImage: true,
supportMultipleImages: true,
supportFirstLastFrame: false,
supportTextOnly: true,
- maxImages: 6
+ maxImages: 6,
},
- 'doubao-seedance-1-5-pro-251215': {
+ "doubao-seedance-1-5-pro-251215": {
supportSingleImage: true,
supportMultipleImages: false,
supportFirstLastFrame: true,
supportTextOnly: true,
- maxImages: 2
+ maxImages: 2,
},
- 'doubao-seedance-1-0-lite-i2v-250428': {
+ "doubao-seedance-1-0-lite-i2v-250428": {
supportSingleImage: true,
supportMultipleImages: true,
supportFirstLastFrame: true,
supportTextOnly: false,
- maxImages: 6
+ maxImages: 6,
},
- 'doubao-seedance-1-0-lite-t2v-250428': {
+ "doubao-seedance-1-0-lite-t2v-250428": {
supportSingleImage: false,
supportMultipleImages: false,
supportFirstLastFrame: false,
supportTextOnly: true,
- maxImages: 0
+ maxImages: 0,
},
- 'doubao-seedance-1-0-pro-250528': {
+ "doubao-seedance-1-0-pro-250528": {
supportSingleImage: true,
supportMultipleImages: false,
supportFirstLastFrame: true,
supportTextOnly: true,
- maxImages: 2
+ maxImages: 2,
},
- 'doubao-seedance-1-0-pro-fast-251015': {
+ "doubao-seedance-1-0-pro-fast-251015": {
supportSingleImage: true,
supportMultipleImages: false,
supportFirstLastFrame: false,
supportTextOnly: true,
- maxImages: 1
+ maxImages: 1,
},
- 'sora-2': {
+ "sora-2": {
supportSingleImage: true,
supportMultipleImages: false,
supportFirstLastFrame: false,
supportTextOnly: true,
- maxImages: 1
+ maxImages: 1,
},
- 'sora-2-pro': {
+ "sora-2-pro": {
supportSingleImage: true,
supportMultipleImages: false,
supportFirstLastFrame: true,
supportTextOnly: true,
- maxImages: 2
+ maxImages: 2,
},
- 'MiniMax-Hailuo-2.3': {
+ "MiniMax-Hailuo-2.3": {
supportSingleImage: true,
supportMultipleImages: false,
supportFirstLastFrame: false,
supportTextOnly: true,
- maxImages: 1
+ maxImages: 1,
},
- 'MiniMax-Hailuo-2.3-Fast': {
+ "MiniMax-Hailuo-2.3-Fast": {
supportSingleImage: true,
supportMultipleImages: false,
supportFirstLastFrame: false,
supportTextOnly: true,
- maxImages: 1
+ maxImages: 1,
},
- 'MiniMax-Hailuo-02': {
+ "MiniMax-Hailuo-02": {
supportSingleImage: true,
supportMultipleImages: false,
supportFirstLastFrame: false,
supportTextOnly: true,
- maxImages: 1
- }
-}
+ maxImages: 1,
+ },
+};
// 从模型名称提取provider
const extractProviderFromModel = (modelName: string): string => {
- if (modelName.startsWith('doubao-') || modelName.startsWith('seedance')) {
- return 'doubao'
+ if (modelName.startsWith("doubao-") || modelName.startsWith("seedance")) {
+ return "doubao";
}
- if (modelName.startsWith('runway')) {
- return 'runway'
+ if (modelName.startsWith("runway")) {
+ return "runway";
}
- if (modelName.startsWith('pika')) {
- return 'pika'
+ if (modelName.startsWith("pika")) {
+ return "pika";
}
- if (modelName.startsWith('MiniMax-') || modelName.toLowerCase().startsWith('minimax') || modelName.startsWith('hailuo')) {
- return 'minimax'
+ if (
+ modelName.startsWith("MiniMax-") ||
+ modelName.toLowerCase().startsWith("minimax") ||
+ modelName.startsWith("hailuo")
+ ) {
+ return "minimax";
}
- if (modelName.startsWith('sora')) {
- return 'openai'
+ if (modelName.startsWith("sora")) {
+ return "openai";
}
- if (modelName.startsWith('kling')) {
- return 'kling'
+ if (modelName.startsWith("kling")) {
+ return "kling";
}
// 默认返回doubao
- return 'doubao'
-}
+ return "doubao";
+};
// 加载视频AI配置
const loadVideoModels = async () => {
try {
- const configs = await aiAPI.list('video')
+ const configs = await aiAPI.list("video");
// 只显示启用的配置
- const activeConfigs = configs.filter(c => c.is_active)
+ const activeConfigs = configs.filter((c) => c.is_active);
// 展开模型列表并去重
- const allModels = activeConfigs.flatMap(config => {
- const models = Array.isArray(config.model) ? config.model : [config.model]
- return models.map(modelName => ({
- modelName,
- configName: config.name,
- priority: config.priority || 0
- }))
- }).sort((a, b) => b.priority - a.priority)
+ const allModels = activeConfigs
+ .flatMap((config) => {
+ const models = Array.isArray(config.model)
+ ? config.model
+ : [config.model];
+ return models.map((modelName) => ({
+ modelName,
+ configName: config.name,
+ priority: config.priority || 0,
+ }));
+ })
+ .sort((a, b) => b.priority - a.priority);
// 按模型名称去重
- const modelMap = new Map<string, { configName: string, priority: number }>()
- allModels.forEach(model => {
+ const modelMap = new Map<
+ string,
+ { configName: string; priority: number }
+ >();
+ allModels.forEach((model) => {
if (!modelMap.has(model.modelName)) {
- modelMap.set(model.modelName, { configName: model.configName, priority: model.priority })
+ modelMap.set(model.modelName, {
+ configName: model.configName,
+ priority: model.priority,
+ });
}
- })
+ });
// 构建模型能力列表
- videoModelCapabilities.value = Array.from(modelMap.keys()).map(modelName => {
- const capability = defaultModelCapabilities[modelName] || {
- supportSingleImage: true,
- supportMultipleImages: false,
- supportFirstLastFrame: false,
- supportTextOnly: true,
- maxImages: 1
- }
-
- return {
- id: modelName,
- name: modelName,
- ...capability
- }
- })
+ videoModelCapabilities.value = Array.from(modelMap.keys()).map(
+ (modelName) => {
+ const capability = defaultModelCapabilities[modelName] || {
+ supportSingleImage: true,
+ supportMultipleImages: false,
+ supportFirstLastFrame: false,
+ supportTextOnly: true,
+ maxImages: 1,
+ };
+
+ return {
+ id: modelName,
+ name: modelName,
+ ...capability,
+ };
+ },
+ );
} catch (error: any) {
- console.error('加载视频模型配置失败:', error)
- ElMessage.error('加载视频模型失败')
+ console.error("加载视频模型配置失败:", error);
+ ElMessage.error("加载视频模型失败");
}
-}
+};
// 加载视频素材库
const loadVideoAssets = async () => {
@@ -1253,923 +2377,1035 @@ const loadVideoAssets = async () => {
const result = await assetAPI.listAssets({
drama_id: dramaId.toString(),
episode_id: episodeId.value,
- type: 'video',
+ type: "video",
page: 1,
- page_size: 100
- })
+ page_size: 100,
+ });
// 检查数据结构并正确赋值
- videoAssets.value = result.items || []
+ videoAssets.value = result.items || [];
} catch (error: any) {
- console.error('加载视频素材库失败:', error)
+ console.error("加载视频素材库失败:", error);
}
-}
+};
// 当前模型能力
const currentModelCapability = computed(() => {
- return videoModelCapabilities.value.find(m => m.id === selectedVideoModel.value)
-})
+ return videoModelCapabilities.value.find(
+ (m) => m.id === selectedVideoModel.value,
+ );
+});
// 当前模型支持的参考图模式
const availableReferenceModes = computed(() => {
- const capability = currentModelCapability.value
- if (!capability) return []
+ const capability = currentModelCapability.value;
+ if (!capability) return [];
- const modes: Array<{ value: string, label: string, description?: string }> = []
+ const modes: Array<{ value: string; label: string; description?: string }> =
+ [];
if (capability.supportTextOnly) {
- modes.push({ value: 'none', label: '纯文本', description: '不使用参考图' })
+ modes.push({ value: "none", label: "纯文本", description: "不使用参考图" });
}
if (capability.supportSingleImage) {
- modes.push({ value: 'single', label: '单图', description: '使用单张参考图' })
+ modes.push({
+ value: "single",
+ label: "单图",
+ description: "使用单张参考图",
+ });
}
if (capability.supportFirstLastFrame) {
- modes.push({ value: 'first_last', label: '首尾帧', description: '使用首帧和尾帧' })
+ modes.push({
+ value: "first_last",
+ label: "首尾帧",
+ description: "使用首帧和尾帧",
+ });
}
if (capability.supportMultipleImages) {
- modes.push({ value: 'multiple', label: '多图', description: `最多${capability.maxImages}张` })
+ modes.push({
+ value: "multiple",
+ label: "多图",
+ description: `最多${capability.maxImages}张`,
+ });
}
- return modes
-})
+ return modes;
+});
// 帧提示词存储key生成函数
-const getPromptStorageKey = (storyboardId: number | undefined, frameType: FrameType) => {
- if (!storyboardId) return null
- return `frame_prompt_${storyboardId}_${frameType}`
-}
+const getPromptStorageKey = (
+ storyboardId: number | undefined,
+ frameType: FrameType,
+) => {
+ if (!storyboardId) return null;
+ return `frame_prompt_${storyboardId}_${frameType}`;
+};
const isCharacterSelected = (charId: number) => {
- return selectedCharacters.value.includes(charId)
-}
+ return selectedCharacters.value.includes(charId);
+};
const toggleCharacter = (charId: number) => {
- const index = selectedCharacters.value.indexOf(charId)
+ const index = selectedCharacters.value.indexOf(charId);
if (index > -1) {
- selectedCharacters.value.splice(index, 1)
+ selectedCharacters.value.splice(index, 1);
} else {
- selectedCharacters.value.push(charId)
+ selectedCharacters.value.push(charId);
}
-}
+};
const currentStoryboard = computed(() => {
- if (!currentStoryboardId.value) return null
- return storyboards.value.find(s => String(s.id) === String(currentStoryboardId.value)) || null
-})
+ if (!currentStoryboardId.value) return null;
+ return (
+ storyboards.value.find(
+ (s) => String(s.id) === String(currentStoryboardId.value),
+ ) || null
+ );
+});
// 获取上一个镜头
const previousStoryboard = computed(() => {
- if (!currentStoryboardId.value || storyboards.value.length < 2) return null
- const currentIndex = storyboards.value.findIndex(s => String(s.id) === String(currentStoryboardId.value))
- if (currentIndex <= 0) return null
- return storyboards.value[currentIndex - 1]
-})
+ if (!currentStoryboardId.value || storyboards.value.length < 2) return null;
+ const currentIndex = storyboards.value.findIndex(
+ (s) => String(s.id) === String(currentStoryboardId.value),
+ );
+ if (currentIndex <= 0) return null;
+ return storyboards.value[currentIndex - 1];
+});
// 上一个镜头的尾帧图片列表(支持多个)
-const previousStoryboardLastFrames = ref<any[]>([])
+const previousStoryboardLastFrames = ref<any[]>([]);
// 加载上一个镜头的尾帧
const loadPreviousStoryboardLastFrame = async () => {
if (!previousStoryboard.value) {
- previousStoryboardLastFrames.value = []
- return
+ previousStoryboardLastFrames.value = [];
+ return;
}
try {
const result = await imageAPI.listImages({
storyboard_id: previousStoryboard.value.id,
- frame_type: 'last',
+ frame_type: "last",
page: 1,
- page_size: 10
- })
- const images = result.items || []
- previousStoryboardLastFrames.value = images.filter((img: any) => img.status === 'completed' && img.image_url)
+ page_size: 10,
+ });
+ const images = result.items || [];
+ previousStoryboardLastFrames.value = images.filter(
+ (img: any) => img.status === "completed" && img.image_url,
+ );
} catch (error) {
- console.error('加载上一镜头尾帧失败:', error)
- previousStoryboardLastFrames.value = []
+ console.error("加载上一镜头尾帧失败:", error);
+ previousStoryboardLastFrames.value = [];
}
-}
+};
// 选择上一镜头尾帧作为首帧参考
const selectPreviousLastFrame = (img: any) => {
// 检查是否已选中,已选中则取消
- const currentIndex = selectedImagesForVideo.value.indexOf(img.id)
+ const currentIndex = selectedImagesForVideo.value.indexOf(img.id);
if (currentIndex > -1) {
- selectedImagesForVideo.value.splice(currentIndex, 1)
- ElMessage.success('已取消首帧参考')
- return
+ selectedImagesForVideo.value.splice(currentIndex, 1);
+ ElMessage.success("已取消首帧参考");
+ return;
}
// 参考handleImageSelect的逻辑,根据模式处理
- if (!selectedReferenceMode.value || selectedReferenceMode.value === 'single') {
+ if (
+ !selectedReferenceMode.value ||
+ selectedReferenceMode.value === "single"
+ ) {
// 单图模式或未选模式:直接替换
- selectedImagesForVideo.value = [img.id]
- } else if (selectedReferenceMode.value === 'first_last') {
+ selectedImagesForVideo.value = [img.id];
+ } else if (selectedReferenceMode.value === "first_last") {
// 首尾帧模式:作为首帧参考
- selectedImagesForVideo.value = [img.id]
- } else if (selectedReferenceMode.value === 'multiple') {
+ selectedImagesForVideo.value = [img.id];
+ } else if (selectedReferenceMode.value === "multiple") {
// 多图模式:添加到列表
- const capability = currentModelCapability.value
- if (capability && selectedImagesForVideo.value.length >= capability.maxImages) {
- ElMessage.warning(`最多只能选择${capability.maxImages}张图片`)
- return
+ const capability = currentModelCapability.value;
+ if (
+ capability &&
+ selectedImagesForVideo.value.length >= capability.maxImages
+ ) {
+ ElMessage.warning(`最多只能选择${capability.maxImages}张图片`);
+ return;
}
- selectedImagesForVideo.value.push(img.id)
+ selectedImagesForVideo.value.push(img.id);
}
- ElMessage.success('已添加为首帧参考')
-}
+ ElMessage.success("已添加为首帧参考");
+};
// 监听帧类型切换,从存储中加载或清空
watch(selectedFrameType, (newType) => {
// 切换帧类型时,停止之前的轮询,避免旧结果覆盖新帧类型
- stopPolling()
+ stopPolling();
if (!currentStoryboard.value) {
- currentFramePrompt.value = ''
- generatedImages.value = []
- return
+ currentFramePrompt.value = "";
+ generatedImages.value = [];
+ return;
}
// 设置切换标志,防止watch(currentFramePrompt)错误保存
- isSwitchingFrameType.value = true
+ isSwitchingFrameType.value = true;
// 从 framePrompts 对象中加载该帧类型的提示词
- currentFramePrompt.value = framePrompts.value[newType] || ''
+ currentFramePrompt.value = framePrompts.value[newType] || "";
// 从 sessionStorage 中加载该帧类型之前的提示词(如果framePrompts中没有)
if (!currentFramePrompt.value) {
- const storageKey = `frame_prompt_${currentStoryboard.value.id}_${newType}`
- const stored = sessionStorage.getItem(storageKey)
+ const storageKey = `frame_prompt_${currentStoryboard.value.id}_${newType}`;
+ const stored = sessionStorage.getItem(storageKey);
if (stored) {
- currentFramePrompt.value = stored
- framePrompts.value[newType] = stored
+ currentFramePrompt.value = stored;
+ framePrompts.value[newType] = stored;
}
}
// 重新加载该帧类型的图片
- loadStoryboardImages(currentStoryboard.value.id, newType)
+ loadStoryboardImages(currentStoryboard.value.id, newType);
// 重置切换标志
setTimeout(() => {
- isSwitchingFrameType.value = false
- }, 0)
-})
+ isSwitchingFrameType.value = false;
+ }, 0);
+});
// 监听当前分镜切换,重置提示词
watch(currentStoryboard, async (newStoryboard) => {
if (!newStoryboard) {
- currentFramePrompt.value = ''
- generatedImages.value = []
- generatedVideos.value = []
- videoReferenceImages.value = []
- previousStoryboardLastFrames.value = []
- return
+ currentFramePrompt.value = "";
+ generatedImages.value = [];
+ generatedVideos.value = [];
+ videoReferenceImages.value = [];
+ previousStoryboardLastFrames.value = [];
+ return;
}
// 设置切换标志
- isSwitchingFrameType.value = true
+ isSwitchingFrameType.value = true;
// 加载当前帧类型的提示词
- const storageKey = getPromptStorageKey(newStoryboard.id, selectedFrameType.value)
+ const storageKey = getPromptStorageKey(
+ newStoryboard.id,
+ selectedFrameType.value,
+ );
if (storageKey) {
- const stored = sessionStorage.getItem(storageKey)
- currentFramePrompt.value = stored || ''
+ const stored = sessionStorage.getItem(storageKey);
+ currentFramePrompt.value = stored || "";
} else {
- currentFramePrompt.value = ''
+ currentFramePrompt.value = "";
}
// 重置切换标志
setTimeout(() => {
- isSwitchingFrameType.value = false
- }, 0)
+ isSwitchingFrameType.value = false;
+ }, 0);
// 加载该分镜的图片列表(根据当前选择的帧类型)
- await loadStoryboardImages(newStoryboard.id, selectedFrameType.value)
+ await loadStoryboardImages(newStoryboard.id, selectedFrameType.value);
// 加载视频参考图片(所有帧类型)
- await loadVideoReferenceImages(newStoryboard.id)
+ await loadVideoReferenceImages(newStoryboard.id);
// 加载该分镜的视频列表
- await loadStoryboardVideos(newStoryboard.id)
+ await loadStoryboardVideos(newStoryboard.id);
// 加载上一镜头的尾帧
- await loadPreviousStoryboardLastFrame()
-})
+ await loadPreviousStoryboardLastFrame();
+});
// 监听提示词变化,自动保存到sessionStorage
watch(currentFramePrompt, (newPrompt) => {
// 如果正在切换帧类型或分镜,不要保存(避免错误保存到新帧类型)
- if (isSwitchingFrameType.value) return
- if (!currentStoryboard.value) return
+ if (isSwitchingFrameType.value) return;
+ if (!currentStoryboard.value) return;
- const storageKey = getPromptStorageKey(currentStoryboard.value.id, selectedFrameType.value)
+ const storageKey = getPromptStorageKey(
+ currentStoryboard.value.id,
+ selectedFrameType.value,
+ );
if (storageKey) {
if (newPrompt) {
- sessionStorage.setItem(storageKey, newPrompt)
+ sessionStorage.setItem(storageKey, newPrompt);
} else {
- sessionStorage.removeItem(storageKey)
+ sessionStorage.removeItem(storageKey);
}
}
-})
+});
// 监听视频模型切换,清空已选图片和参考图模式
watch(selectedVideoModel, () => {
- selectedImagesForVideo.value = []
- selectedLastImageForVideo.value = null
- selectedReferenceMode.value = ''
-})
+ selectedImagesForVideo.value = [];
+ selectedLastImageForVideo.value = null;
+ selectedReferenceMode.value = "";
+});
// 监听镜头切换,自动更新视频时长
watch(currentStoryboard, (newStoryboard) => {
if (newStoryboard?.duration) {
// 如果镜头有duration字段,使用镜头的时长
- videoDuration.value = Math.round(newStoryboard.duration)
+ videoDuration.value = Math.round(newStoryboard.duration);
} else {
// 否则使用默认值5秒
- videoDuration.value = 5
+ videoDuration.value = 5;
}
-})
+});
// 监听参考图模式切换,清空已选图片
watch(selectedReferenceMode, () => {
- selectedImagesForVideo.value = []
- selectedLastImageForVideo.value = null
-})
+ selectedImagesForVideo.value = [];
+ selectedLastImageForVideo.value = null;
+});
// 当前分镜的角色列表
const currentStoryboardCharacters = computed(() => {
- if (!currentStoryboard.value?.characters) return []
+ if (!currentStoryboard.value?.characters) return [];
// currentStoryboard.characters 是角色对象数组
- if (Array.isArray(currentStoryboard.value.characters) && currentStoryboard.value.characters.length > 0) {
- const firstItem = currentStoryboard.value.characters[0]
+ if (
+ Array.isArray(currentStoryboard.value.characters) &&
+ currentStoryboard.value.characters.length > 0
+ ) {
+ const firstItem = currentStoryboard.value.characters[0];
// 如果是对象数组(包含id和name),直接返回
- if (typeof firstItem === 'object' && firstItem.id) {
- return currentStoryboard.value.characters
+ if (typeof firstItem === "object" && firstItem.id) {
+ return currentStoryboard.value.characters;
}
// 如果是ID数组,从characters中查找匹配的角色
- if (typeof firstItem === 'number') {
- return characters.value.filter(c => currentStoryboard.value.characters.includes(c.id))
+ if (typeof firstItem === "number") {
+ return characters.value.filter((c) =>
+ currentStoryboard.value.characters.includes(c.id),
+ );
}
}
- return []
-})
+ return [];
+});
// 可选择的角色列表
const availableCharacters = computed(() => {
- return characters.value || []
-})
-
-
+ return characters.value || [];
+});
// 可选择的道具列表
const availableProps = computed(() => {
- return props.value || []
-})
+ return props.value || [];
+});
// 当前分镜的道具列表
const currentStoryboardProps = computed(() => {
- if (!currentStoryboard.value?.props) return []
- return currentStoryboard.value.props
-})
+ if (!currentStoryboard.value?.props) return [];
+ return currentStoryboard.value.props;
+});
// 检查道具是否在当前镜头中
const isPropInCurrentShot = (propId: number) => {
- if (!currentStoryboard.value?.props) return false
- return currentStoryboard.value.props.some((p: any) => p.id === propId)
-}
+ if (!currentStoryboard.value?.props) return false;
+ return currentStoryboard.value.props.some((p: any) => p.id === propId);
+};
// 切换道具在镜头中的状态
const togglePropInShot = async (propId: number) => {
- if (!currentStoryboard.value) return
-
- let newProps = [...(currentStoryboard.value.props || [])]
+ if (!currentStoryboard.value) return;
+
+ let newProps = [...(currentStoryboard.value.props || [])];
if (isPropInCurrentShot(propId)) {
- newProps = newProps.filter((p: any) => p.id !== propId)
+ newProps = newProps.filter((p: any) => p.id !== propId);
} else {
- const prop = props.value.find(p => p.id === propId)
+ const prop = props.value.find((p) => p.id === propId);
if (prop) {
- newProps.push(prop)
+ newProps.push(prop);
}
}
-
+
// 乐观更新
- currentStoryboard.value.props = newProps
-
+ currentStoryboard.value.props = newProps;
+
try {
- const propIds = newProps.map((p: any) => p.id)
- await propAPI.associateWithStoryboard(Number(currentStoryboard.value.id), propIds)
+ const propIds = newProps.map((p: any) => p.id);
+ await propAPI.associateWithStoryboard(
+ Number(currentStoryboard.value.id),
+ propIds,
+ );
} catch (error) {
- ElMessage.error($t('editor.updatePropFailed'))
+ ElMessage.error($t("editor.updatePropFailed"));
}
-}
+};
// 检查角色是否已在当前镜头中
const isCharacterInCurrentShot = (charId: number) => {
- if (!currentStoryboard.value?.characters) return false
+ if (!currentStoryboard.value?.characters) return false;
- if (Array.isArray(currentStoryboard.value.characters) && currentStoryboard.value.characters.length > 0) {
- const firstItem = currentStoryboard.value.characters[0]
- if (typeof firstItem === 'object' && firstItem.id) {
- return currentStoryboard.value.characters.some(c => c.id === charId)
+ if (
+ Array.isArray(currentStoryboard.value.characters) &&
+ currentStoryboard.value.characters.length > 0
+ ) {
+ const firstItem = currentStoryboard.value.characters[0];
+ if (typeof firstItem === "object" && firstItem.id) {
+ return currentStoryboard.value.characters.some((c) => c.id === charId);
}
- if (typeof firstItem === 'number') {
- return currentStoryboard.value.characters.includes(charId)
+ if (typeof firstItem === "number") {
+ return currentStoryboard.value.characters.includes(charId);
}
}
- return false
-}
+ return false;
+};
// 切换角色在镜头中的状态
const showCharacterImage = (char: any) => {
- previewCharacter.value = char
- showCharacterImagePreview.value = true
-}
+ previewCharacter.value = char;
+ showCharacterImagePreview.value = true;
+};
// 展示场景大图
const showSceneImage = () => {
if (currentStoryboard.value?.background?.image_url) {
- showSceneImagePreview.value = true
+ showSceneImagePreview.value = true;
}
-}
+};
// 保存分镜字段
const saveStoryboardField = async (fieldName: string) => {
- if (!currentStoryboard.value) return
+ if (!currentStoryboard.value) return;
try {
- const updateData: any = {}
- updateData[fieldName] = currentStoryboard.value[fieldName]
+ const updateData: any = {};
+ updateData[fieldName] = currentStoryboard.value[fieldName];
- await dramaAPI.updateStoryboard(currentStoryboard.value.id.toString(), updateData)
+ await dramaAPI.updateStoryboard(
+ currentStoryboard.value.id.toString(),
+ updateData,
+ );
} catch (error: any) {
- ElMessage.error('保存失败: ' + (error.message || '未知错误'))
+ ElMessage.error("保存失败: " + (error.message || "未知错误"));
}
-}
+};
// 提取帧提示词
// 提取帧提示词
const extractFramePrompt = async () => {
- if (!currentStoryboard.value) return
+ if (!currentStoryboard.value) return;
- const storyboardId = currentStoryboard.value.id
+ const storyboardId = currentStoryboard.value.id;
// 记录点击时的帧类型,后续任务完成时用于判断是否需要更新当前显示
- const targetFrameType = selectedFrameType.value
-
- if (targetFrameType === 'panel') {
+ const targetFrameType = selectedFrameType.value;
+
+ if (targetFrameType === "panel") {
// 如果是分镜板模式,还需要捕获当前的panelCount
// 注意:这里简单起见使用当前的panelCount,理想情况下应该传递参数或锁定UI
}
// 设置当前镜头的生成状态为true
- generatingPromptStates.value[storyboardId] = true
+ const stateKey = `${storyboardId}_${targetFrameType}`;
+ generatingPromptStates.value[stateKey] = true;
try {
- const params: any = { frame_type: targetFrameType }
- if (targetFrameType === 'panel') {
- params.panel_count = panelCount.value
+ const params: any = { frame_type: targetFrameType };
+ if (targetFrameType === "panel") {
+ params.panel_count = panelCount.value;
}
- const { task_id } = await generateFramePrompt(storyboardId, params)
+ const { task_id } = await generateFramePrompt(storyboardId, params);
// 轮询任务状态(独立函数,不依赖组件当前状态)
const pollTask = async () => {
while (true) {
- const task = await taskAPI.getStatus(task_id)
- if (task.status === 'completed') {
- let result = task.result
- if (typeof result === 'string') {
+ const task = await taskAPI.getStatus(task_id);
+ if (task.status === "completed") {
+ let result = task.result;
+ if (typeof result === "string") {
try {
- result = JSON.parse(result)
+ result = JSON.parse(result);
} catch (e) {
- console.error('Failed to parse task result', e)
- throw new Error('解析任务结果失败')
+ console.error("Failed to parse task result", e);
+ throw new Error("解析任务结果失败");
}
}
- return result.response
- } else if (task.status === 'failed') {
- throw new Error(task.message || task.error || '生成失败')
+ return result.response;
+ } else if (task.status === "failed") {
+ throw new Error(task.message || task.error || "生成失败");
}
// 等待1秒后继续轮询
- await new Promise(resolve => setTimeout(resolve, 1000))
+ await new Promise((resolve) => setTimeout(resolve, 1000));
}
- }
+ };
- const result = await pollTask()
+ const result = await pollTask();
// 根据返回结果构建提示词字符串
- let extractedPrompt = ''
+ let extractedPrompt = "";
if (result.single_frame) {
- extractedPrompt = result.single_frame.prompt
+ extractedPrompt = result.single_frame.prompt;
} else if (result.multi_frame && result.multi_frame.frames) {
// 多帧情况,将所有帧的prompt合并
extractedPrompt = result.multi_frame.frames
- .map((frame: any, index: number) => `${frame.description}: ${frame.prompt}`)
- .join('\n\n')
+ .map(
+ (frame: any, index: number) =>
+ `${frame.description}: ${frame.prompt}`,
+ )
+ .join("\n\n");
}
// 更新存储(这一步必须做,无论用户是否还在当前页面)
// 更新 session storage
- const storageKey = getPromptStorageKey(storyboardId, targetFrameType)
+ const storageKey = getPromptStorageKey(storyboardId, targetFrameType);
if (storageKey) {
- sessionStorage.setItem(storageKey, extractedPrompt)
+ sessionStorage.setItem(storageKey, extractedPrompt);
}
-
+
// 如果任务完成时,用户当前的选中状态正好是该镜头+该类型,则立即更新显示
- if (currentStoryboard.value && currentStoryboard.value.id === storyboardId && selectedFrameType.value === targetFrameType) {
- currentFramePrompt.value = extractedPrompt
- framePrompts.value[targetFrameType] = extractedPrompt
+ if (
+ currentStoryboard.value &&
+ currentStoryboard.value.id === storyboardId &&
+ selectedFrameType.value === targetFrameType
+ ) {
+ currentFramePrompt.value = extractedPrompt;
+ framePrompts.value[targetFrameType] = extractedPrompt;
}
// 更新内存缓存(稍微复杂点,framePrompts 是响应式的且绑定当前镜头,这里只做sessionStorage持久化即可,
// 因为切换镜头时会重新读取sessionStorage。
// 但为了确保如果用户没切走也能看到,上面已经更新了 currentFramePrompt
-
- ElMessage.success(`${getFrameTypeLabel(targetFrameType)}提示词提取成功`)
+
+ ElMessage.success(`${getFrameTypeLabel(targetFrameType)}提示词提取成功`);
} catch (error: any) {
- ElMessage.error('提取失败: ' + (error.message || '未知错误'))
+ ElMessage.error("提取失败: " + (error.message || "未知错误"));
} finally {
// 清除该镜头的生成状态
- if (generatingPromptStates.value[storyboardId]) {
- generatingPromptStates.value[storyboardId] = false
+ const stateKey = `${storyboardId}_${targetFrameType}`;
+ if (generatingPromptStates.value[stateKey]) {
+ generatingPromptStates.value[stateKey] = false;
}
}
-}
+};
+
+// 检查是否正在生成提示词
+const isGeneratingPrompt = (
+ storyboardId: number | undefined,
+ frameType: string,
+) => {
+ if (!storyboardId) return false;
+ return !!generatingPromptStates.value[`${storyboardId}_${frameType}`];
+};
// 获取帧类型的中文标签
const getFrameTypeLabel = (frameType: string): string => {
const labels: Record<string, string> = {
- key: '关键帧',
- first: '首帧',
- last: '尾帧',
- panel: '分镜版'
- }
- return labels[frameType] || frameType
-}
+ key: "关键帧",
+ first: "首帧",
+ last: "尾帧",
+ panel: "分镜版",
+ };
+ return labels[frameType] || frameType;
+};
// 加载分镜的图片列表
-const loadStoryboardImages = async (storyboardId: number, frameType?: string) => {
- loadingImages.value = true
+const loadStoryboardImages = async (
+ storyboardId: number,
+ frameType?: string,
+) => {
+ loadingImages.value = true;
try {
const params: any = {
storyboard_id: storyboardId,
page: 1,
- page_size: 50
- }
+ page_size: 50,
+ };
// 如果指定了帧类型,添加过滤
if (frameType) {
- params.frame_type = frameType
+ params.frame_type = frameType;
}
- const result = await imageAPI.listImages(params)
- generatedImages.value = result.items || []
+ const result = await imageAPI.listImages(params);
+ generatedImages.value = result.items || [];
// 如果有进行中的任务,启动轮询
const hasPendingOrProcessing = generatedImages.value.some(
- img => img.status === 'pending' || img.status === 'processing'
- )
+ (img) => img.status === "pending" || img.status === "processing",
+ );
if (hasPendingOrProcessing) {
- startPolling()
+ startPolling();
}
} catch (error: any) {
- console.error('加载图片列表失败:', error)
+ console.error("加载图片列表失败:", error);
} finally {
- loadingImages.value = false
+ loadingImages.value = false;
}
-}
+};
// 启动状态轮询
const startPolling = () => {
- if (pollingTimer) return
+ if (pollingTimer) return;
// 记录开始轮询时的帧类型
- pollingFrameType = selectedFrameType.value
+ pollingFrameType = selectedFrameType.value;
pollingTimer = setInterval(async () => {
if (!currentStoryboard.value) {
- stopPolling()
- return
+ stopPolling();
+ return;
}
// 如果帧类型已切换,停止轮询(防止更新到错误的帧类型)
if (selectedFrameType.value !== pollingFrameType) {
- stopPolling()
- return
+ stopPolling();
+ return;
}
try {
const params: any = {
storyboard_id: currentStoryboard.value.id,
page: 1,
- page_size: 50
- }
+ page_size: 50,
+ };
// 使用轮询开始时记录的帧类型
if (pollingFrameType) {
- params.frame_type = pollingFrameType
+ params.frame_type = pollingFrameType;
}
- const result = await imageAPI.listImages(params)
+ const result = await imageAPI.listImages(params);
// 再次检查帧类型是否仍然匹配,避免竞态条件
if (selectedFrameType.value === pollingFrameType) {
- generatedImages.value = result.items || []
+ generatedImages.value = result.items || [];
}
// 如果没有进行中的任务,停止轮询并刷新视频参考图片
const hasPendingOrProcessing = (result.items || []).some(
- (img: any) => img.status === 'pending' || img.status === 'processing'
- )
+ (img: any) => img.status === "pending" || img.status === "processing",
+ );
if (!hasPendingOrProcessing) {
- stopPolling()
+ stopPolling();
// 刷新视频参考图片列表
if (currentStoryboard.value) {
- loadVideoReferenceImages(currentStoryboard.value.id)
+ loadVideoReferenceImages(currentStoryboard.value.id);
}
}
} catch (error) {
- console.error('轮询图片状态失败:', error)
+ console.error("轮询图片状态失败:", error);
}
- }, 3000) // 每3秒轮询一次
-}
+ }, 3000); // 每3秒轮询一次
+};
// 停止轮询
const stopPolling = () => {
if (pollingTimer) {
- clearInterval(pollingTimer)
- pollingTimer = null
+ clearInterval(pollingTimer);
+ pollingTimer = null;
}
- pollingFrameType = null
-}
+ pollingFrameType = null;
+};
// 生成图片
const generateFrameImage = async () => {
- if (!currentStoryboard.value || !currentFramePrompt.value) return
+ if (!currentStoryboard.value || !currentFramePrompt.value) return;
- generatingImage.value = true
+ generatingImage.value = true;
try {
// 收集参考图片URL
- const referenceImages: string[] = []
+ const referenceImages: string[] = [];
// 1. 添加场景图片(从background字段获取)
if (currentStoryboard.value.background?.image_url) {
- referenceImages.push(currentStoryboard.value.background.image_url)
+ referenceImages.push(currentStoryboard.value.background.image_url);
}
// 2. 添加当前镜头登场的角色图片
- const storyboardCharacters = currentStoryboardCharacters.value
+ const storyboardCharacters = currentStoryboardCharacters.value;
if (storyboardCharacters && storyboardCharacters.length > 0) {
storyboardCharacters.forEach((char: any) => {
if (char.image_url) {
- referenceImages.push(char.image_url)
+ referenceImages.push(char.image_url);
}
- })
+ });
}
const result = await imageAPI.generateImage({
drama_id: dramaId.toString(),
prompt: currentFramePrompt.value,
storyboard_id: currentStoryboard.value.id,
- image_type: 'storyboard',
+ image_type: "storyboard",
frame_type: selectedFrameType.value,
- reference_images: referenceImages.length > 0 ? referenceImages : undefined
- })
+ reference_images:
+ referenceImages.length > 0 ? referenceImages : undefined,
+ });
- generatedImages.value.unshift(result)
+ generatedImages.value.unshift(result);
// 提示信息
- const refMsg = referenceImages.length > 0
- ? ` (已添加${referenceImages.length}张参考图)`
- : ''
- ElMessage.success(`图片生成任务已提交${refMsg}`)
+ const refMsg =
+ referenceImages.length > 0
+ ? ` (已添加${referenceImages.length}张参考图)`
+ : "";
+ ElMessage.success(`图片生成任务已提交${refMsg}`);
// 启动轮询
- startPolling()
+ startPolling();
} catch (error: any) {
- ElMessage.error('生成失败: ' + (error.message || '未知错误'))
+ ElMessage.error("生成失败: " + (error.message || "未知错误"));
} finally {
- generatingImage.value = false
+ generatingImage.value = false;
}
-}
+};
// 获取状态标签类型
const getStatusType = (status: string) => {
const statusMap: Record<string, any> = {
- pending: 'info',
- processing: 'warning',
- completed: 'success',
- failed: 'danger'
- }
- return statusMap[status] || 'info'
-}
+ pending: "info",
+ processing: "warning",
+ completed: "success",
+ failed: "danger",
+ };
+ return statusMap[status] || "info";
+};
// 播放视频
const playVideo = (video: VideoGeneration) => {
- previewVideo.value = video
- showVideoPreview.value = true
-}
+ previewVideo.value = video;
+ showVideoPreview.value = true;
+};
// 添加视频到素材库
const addVideoToAssets = async (video: VideoGeneration) => {
- if (video.status !== 'completed' || !video.video_url) {
- ElMessage.warning('只能添加已完成的视频到素材库')
- return
+ if (video.status !== "completed" || !video.video_url) {
+ ElMessage.warning("只能添加已完成的视频到素材库");
+ return;
}
- addingToAssets.value.add(video.id)
+ addingToAssets.value.add(video.id);
try {
// 检查该镜头是否已存在素材
- let isReplacing = false
+ let isReplacing = false;
if (video.storyboard_id) {
const existingAsset = videoAssets.value.find(
- (asset: any) => asset.storyboard_id === video.storyboard_id
- )
+ (asset: any) => asset.storyboard_id === video.storyboard_id,
+ );
if (existingAsset) {
- isReplacing = true
+ isReplacing = true;
// 自动替换:先删除旧素材
try {
- await assetAPI.deleteAsset(existingAsset.id)
+ await assetAPI.deleteAsset(existingAsset.id);
} catch (error) {
- console.error('删除旧素材失败:', error)
+ console.error("删除旧素材失败:", error);
}
}
}
// 添加新素材
- await assetAPI.importFromVideo(video.id)
- ElMessage.success('已添加到素材库')
+ await assetAPI.importFromVideo(video.id);
+ ElMessage.success("已添加到素材库");
// 重新加载素材库列表
- await loadVideoAssets()
+ await loadVideoAssets();
// 如果是替换操作,更新时间线中使用该分镜的所有视频片段
if (isReplacing && video.storyboard_id && video.video_url) {
- console.log('=== 视频替换,准备更新时间线 ===')
- console.log('timelineEditorRef.value:', timelineEditorRef.value)
- console.log('video.storyboard_id:', video.storyboard_id)
- console.log('video.video_url:', video.video_url)
+ console.log("=== 视频替换,准备更新时间线 ===");
+ console.log("timelineEditorRef.value:", timelineEditorRef.value);
+ console.log("video.storyboard_id:", video.storyboard_id);
+ console.log("video.video_url:", video.video_url);
if (timelineEditorRef.value) {
timelineEditorRef.value.updateClipsByStoryboardId(
video.storyboard_id,
- video.video_url
- )
+ video.video_url,
+ );
} else {
- console.warn('⚠️ timelineEditorRef.value 为空,无法更新时间线')
+ console.warn("⚠️ timelineEditorRef.value 为空,无法更新时间线");
}
}
} catch (error: any) {
- ElMessage.error(error.message || '添加失败')
+ ElMessage.error(error.message || "添加失败");
} finally {
- addingToAssets.value.delete(video.id)
+ addingToAssets.value.delete(video.id);
}
-}
+};
// 获取状态中文文本
const getStatusText = (status: string) => {
const statusTextMap: Record<string, string> = {
- pending: '等待中',
- processing: '生成中',
- completed: '已完成',
- failed: '失败'
- }
- return statusTextMap[status] || status
-}
+ pending: "等待中",
+ processing: "生成中",
+ completed: "已完成",
+ failed: "失败",
+ };
+ return statusTextMap[status] || status;
+};
// 获取帧类型中文文本
const getFrameTypeText = (frameType?: string) => {
- if (!frameType) return ''
+ if (!frameType) return "";
const frameTypeMap: Record<string, string> = {
- first: '首帧',
- key: '关键帧',
- last: '尾帧',
- panel: '分镜板',
- action: '动作序列'
- }
- return frameTypeMap[frameType] || frameType
-}
+ first: "首帧",
+ key: "关键帧",
+ last: "尾帧",
+ panel: "分镜板",
+ action: "动作序列",
+ };
+ return frameTypeMap[frameType] || frameType;
+};
// 获取分镜缩略图
const getStoryboardThumbnail = (storyboard: any) => {
// 优先使用composed_image
if (storyboard.composed_image) {
- return storyboard.composed_image
+ return storyboard.composed_image;
}
// 如果没有composed_image,从image_url字段获取
if (storyboard.image_url) {
- return storyboard.image_url
+ return storyboard.image_url;
}
- return null
-}
+ return null;
+};
// 处理图片选择(根据模型能力)
const handleImageSelect = (imageId: number) => {
if (!selectedReferenceMode.value) {
- ElMessage.warning('请先选择参考图模式')
- return
+ ElMessage.warning("请先选择参考图模式");
+ return;
}
if (!currentModelCapability.value) {
- ElMessage.warning('请先选择视频生成模型')
- return
+ ElMessage.warning("请先选择视频生成模型");
+ return;
}
- const capability = currentModelCapability.value
- const currentIndex = selectedImagesForVideo.value.indexOf(imageId)
+ const capability = currentModelCapability.value;
+ const currentIndex = selectedImagesForVideo.value.indexOf(imageId);
// 已选中,则取消选择
if (currentIndex > -1) {
- selectedImagesForVideo.value.splice(currentIndex, 1)
- return
+ selectedImagesForVideo.value.splice(currentIndex, 1);
+ return;
}
// 获取当前点击的图片对象
- const clickedImage = videoReferenceImages.value.find(img => img.id === imageId)
- if (!clickedImage) return
+ const clickedImage = videoReferenceImages.value.find(
+ (img) => img.id === imageId,
+ );
+ if (!clickedImage) return;
// 根据选择的参考图模式处理
switch (selectedReferenceMode.value) {
- case 'single':
+ case "single":
// 单图模式:只能选1张,直接替换
- selectedImagesForVideo.value = [imageId]
- break
+ selectedImagesForVideo.value = [imageId];
+ break;
- case 'first_last':
+ case "first_last":
// 首尾帧模式:根据图片类型分别处理
- const frameType = clickedImage.frame_type
+ const frameType = clickedImage.frame_type;
- if (frameType === 'first' || frameType === 'panel' || frameType === 'key') {
+ if (
+ frameType === "first" ||
+ frameType === "panel" ||
+ frameType === "key"
+ ) {
// 首帧:直接替换
- selectedImagesForVideo.value = [imageId]
- } else if (frameType === 'last') {
+ selectedImagesForVideo.value = [imageId];
+ } else if (frameType === "last") {
// 尾帧:设置到单独的变量
- selectedLastImageForVideo.value = imageId
+ selectedLastImageForVideo.value = imageId;
} else {
- ElMessage.warning('首尾帧模式下,请选择首帧或尾帧类型的图片')
+ ElMessage.warning("首尾帧模式下,请选择首帧或尾帧类型的图片");
}
- break
+ break;
- case 'multiple':
+ case "multiple":
// 多图模式:检查是否超出最大数量
if (selectedImagesForVideo.value.length >= capability.maxImages) {
- ElMessage.warning(`最多只能选择${capability.maxImages}张图片`)
- return
+ ElMessage.warning(`最多只能选择${capability.maxImages}张图片`);
+ return;
}
- selectedImagesForVideo.value.push(imageId)
- break
+ selectedImagesForVideo.value.push(imageId);
+ break;
default:
- ElMessage.warning('未知的参考图模式')
+ ElMessage.warning("未知的参考图模式");
}
-}
+};
// 预览图片
const previewImage = (url: string) => {
// 使用Element Plus的图片预览
- const viewer = document.createElement('div')
+ const viewer = document.createElement("div");
viewer.innerHTML = `
<div style="position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center;" onclick="this.remove()">
<img src="${url}" style="max-width: 90vw; max-height: 90vh; object-fit: contain;" onclick="event.stopPropagation();" />
</div>
- `
- document.body.appendChild(viewer)
-}
+ `;
+ document.body.appendChild(viewer);
+};
// 获取已选图片对象列表
const selectedImageObjects = computed(() => {
return selectedImagesForVideo.value
- .map(id => videoReferenceImages.value.find(img => img.id === id))
- .filter(img => img && img.image_url)
-})
+ .map((id) => videoReferenceImages.value.find((img) => img.id === id))
+ .filter((img) => img && img.image_url);
+});
// 首尾帧模式:获取首帧图片
const firstFrameSlotImage = computed(() => {
- if (selectedImagesForVideo.value.length === 0) return null
- const firstImageId = selectedImagesForVideo.value[0]
+ if (selectedImagesForVideo.value.length === 0) return null;
+ const firstImageId = selectedImagesForVideo.value[0];
// 同时搜索当前镜头图片和上一镜头尾帧
- return videoReferenceImages.value.find(img => img.id === firstImageId)
- || previousStoryboardLastFrames.value.find(img => img.id === firstImageId)
-})
+ return (
+ videoReferenceImages.value.find((img) => img.id === firstImageId) ||
+ previousStoryboardLastFrames.value.find((img) => img.id === firstImageId)
+ );
+});
// 首尾帧模式:获取尾帧图片
const lastFrameSlotImage = computed(() => {
- if (!selectedLastImageForVideo.value) return null
+ if (!selectedLastImageForVideo.value) return null;
// 同时搜索当前镜头图片和上一镜头尾帧
- return videoReferenceImages.value.find(img => img.id === selectedLastImageForVideo.value)
- || previousStoryboardLastFrames.value.find(img => img.id === selectedLastImageForVideo.value)
-})
+ return (
+ videoReferenceImages.value.find(
+ (img) => img.id === selectedLastImageForVideo.value,
+ ) ||
+ previousStoryboardLastFrames.value.find(
+ (img) => img.id === selectedLastImageForVideo.value,
+ )
+ );
+});
// 移除已选择的图片
const removeSelectedImage = (imageId: number) => {
// 检查是否是尾帧
if (selectedLastImageForVideo.value === imageId) {
- selectedLastImageForVideo.value = null
- return
+ selectedLastImageForVideo.value = null;
+ return;
}
// 检查是否是首帧或其他图片
- const index = selectedImagesForVideo.value.indexOf(imageId)
+ const index = selectedImagesForVideo.value.indexOf(imageId);
if (index > -1) {
- selectedImagesForVideo.value.splice(index, 1)
+ selectedImagesForVideo.value.splice(index, 1);
}
-}
+};
// 生成视频
const generateVideo = async () => {
if (!selectedVideoModel.value) {
- ElMessage.warning('请先选择视频生成模型')
- return
+ ElMessage.warning("请先选择视频生成模型");
+ return;
}
if (!currentStoryboard.value) {
- ElMessage.warning('请先选择分镜')
- return
+ ElMessage.warning("请先选择分镜");
+ return;
}
// 检查参考图模式
- if (selectedReferenceMode.value !== 'none' && selectedImagesForVideo.value.length === 0) {
- ElMessage.warning('请选择参考图片')
- return
+ if (
+ selectedReferenceMode.value !== "none" &&
+ selectedImagesForVideo.value.length === 0
+ ) {
+ ElMessage.warning("请选择参考图片");
+ return;
}
// 获取第一张选中的图片(仅在需要图片的模式下)
- let selectedImage = null
- if (selectedReferenceMode.value !== 'none' && selectedImagesForVideo.value.length > 0) {
+ let selectedImage = null;
+ if (
+ selectedReferenceMode.value !== "none" &&
+ selectedImagesForVideo.value.length > 0
+ ) {
// 同时搜索当前镜头图片和上一镜头尾帧
- selectedImage = videoReferenceImages.value.find(img => img.id === selectedImagesForVideo.value[0])
- || previousStoryboardLastFrames.value.find(img => img.id === selectedImagesForVideo.value[0])
+ selectedImage =
+ videoReferenceImages.value.find(
+ (img) => img.id === selectedImagesForVideo.value[0],
+ ) ||
+ previousStoryboardLastFrames.value.find(
+ (img) => img.id === selectedImagesForVideo.value[0],
+ );
if (!selectedImage || !selectedImage.image_url) {
- ElMessage.error('请选择有效的参考图片')
- return
+ ElMessage.error("请选择有效的参考图片");
+ return;
}
}
- generatingVideo.value = true
+ generatingVideo.value = true;
try {
// 从模型名称提取正确的provider
- const provider = extractProviderFromModel(selectedVideoModel.value)
+ const provider = extractProviderFromModel(selectedVideoModel.value);
// 构建请求参数
const requestParams: any = {
drama_id: dramaId.toString(),
storyboard_id: currentStoryboard.value.id,
- prompt: currentStoryboard.value.video_prompt || currentStoryboard.value.action || currentStoryboard.value.description || '',
+ prompt:
+ currentStoryboard.value.video_prompt ||
+ currentStoryboard.value.action ||
+ currentStoryboard.value.description ||
+ "",
duration: videoDuration.value,
provider: provider,
model: selectedVideoModel.value,
- reference_mode: selectedReferenceMode.value
- }
+ reference_mode: selectedReferenceMode.value,
+ };
// 根据参考图模式设置参数
switch (selectedReferenceMode.value) {
- case 'single':
+ case "single":
// 单图模式
- requestParams.image_url = selectedImage.image_url
- requestParams.image_gen_id = selectedImage.id
- break
+ requestParams.image_url = selectedImage.image_url;
+ requestParams.image_gen_id = selectedImage.id;
+ break;
- case 'first_last':
+ case "first_last":
// 首尾帧模式(同时搜索当前镜头图片和上一镜头尾帧)
- const firstImage = videoReferenceImages.value.find(img => img.id === selectedImagesForVideo.value[0])
- || previousStoryboardLastFrames.value.find(img => img.id === selectedImagesForVideo.value[0])
- const lastImage = videoReferenceImages.value.find(img => img.id === selectedLastImageForVideo.value)
- || previousStoryboardLastFrames.value.find(img => img.id === selectedLastImageForVideo.value)
+ const firstImage =
+ videoReferenceImages.value.find(
+ (img) => img.id === selectedImagesForVideo.value[0],
+ ) ||
+ previousStoryboardLastFrames.value.find(
+ (img) => img.id === selectedImagesForVideo.value[0],
+ );
+ const lastImage =
+ videoReferenceImages.value.find(
+ (img) => img.id === selectedLastImageForVideo.value,
+ ) ||
+ previousStoryboardLastFrames.value.find(
+ (img) => img.id === selectedLastImageForVideo.value,
+ );
if (firstImage?.image_url) {
- requestParams.first_frame_url = firstImage.image_url
+ requestParams.first_frame_url = firstImage.image_url;
}
if (lastImage?.image_url) {
- requestParams.last_frame_url = lastImage.image_url
+ requestParams.last_frame_url = lastImage.image_url;
}
- break
+ break;
- case 'multiple':
+ case "multiple":
// 多图模式
const selectedImages = selectedImagesForVideo.value
- .map(id => videoReferenceImages.value.find(img => img.id === id))
- .filter(img => img?.image_url)
- .map(img => img!.image_url)
- requestParams.reference_image_urls = selectedImages
- break
+ .map((id) => videoReferenceImages.value.find((img) => img.id === id))
+ .filter((img) => img?.image_url)
+ .map((img) => img!.image_url);
+ requestParams.reference_image_urls = selectedImages;
+ break;
- case 'none':
+ case "none":
// 无参考图模式
- break
+ break;
}
- const result = await videoAPI.generateVideo(requestParams)
+ const result = await videoAPI.generateVideo(requestParams);
- generatedVideos.value.unshift(result)
- ElMessage.success('视频生成任务已提交')
+ generatedVideos.value.unshift(result);
+ ElMessage.success("视频生成任务已提交");
// 启动视频轮询
- startVideoPolling()
+ startVideoPolling();
} catch (error: any) {
- ElMessage.error('生成失败: ' + (error.message || '未知错误'))
+ ElMessage.error("生成失败: " + (error.message || "未知错误"));
} finally {
- generatingVideo.value = false
+ generatingVideo.value = false;
}
-}
+};
// 加载分镜的视频参考图片(所有帧类型)
const loadVideoReferenceImages = async (storyboardId: number) => {
@@ -2177,586 +3413,594 @@ const loadVideoReferenceImages = async (storyboardId: number) => {
const result = await imageAPI.listImages({
storyboard_id: storyboardId,
page: 1,
- page_size: 100
- })
- videoReferenceImages.value = result.items || []
+ page_size: 100,
+ });
+ videoReferenceImages.value = result.items || [];
} catch (error: any) {
- console.error('加载视频参考图片失败:', error)
+ console.error("加载视频参考图片失败:", error);
}
-}
+};
// 加载分镜的视频列表
const loadStoryboardVideos = async (storyboardId: number) => {
- loadingVideos.value = true
+ loadingVideos.value = true;
try {
const result = await videoAPI.listVideos({
storyboard_id: storyboardId.toString(),
page: 1,
- page_size: 50
- })
- generatedVideos.value = result.items || []
+ page_size: 50,
+ });
+ generatedVideos.value = result.items || [];
// 如果有进行中的任务,启动轮询
const hasPendingOrProcessing = generatedVideos.value.some(
- v => v.status === 'pending' || v.status === 'processing'
- )
+ (v) => v.status === "pending" || v.status === "processing",
+ );
if (hasPendingOrProcessing) {
- startVideoPolling()
+ startVideoPolling();
}
} catch (error: any) {
- console.error('加载视频列表失败:', error)
+ console.error("加载视频列表失败:", error);
} finally {
- loadingVideos.value = false
+ loadingVideos.value = false;
}
-}
+};
// 启动视频状态轮询
const startVideoPolling = () => {
- if (videoPollingTimer) return
+ if (videoPollingTimer) return;
videoPollingTimer = setInterval(async () => {
if (!currentStoryboard.value) {
- stopVideoPolling()
- return
+ stopVideoPolling();
+ return;
}
try {
const result = await videoAPI.listVideos({
storyboard_id: currentStoryboard.value.id.toString(),
page: 1,
- page_size: 50
- })
- generatedVideos.value = result.items || []
+ page_size: 50,
+ });
+ generatedVideos.value = result.items || [];
// 如果没有进行中的任务,停止轮询
const hasPendingOrProcessing = generatedVideos.value.some(
- v => v.status === 'pending' || v.status === 'processing'
- )
+ (v) => v.status === "pending" || v.status === "processing",
+ );
if (!hasPendingOrProcessing) {
- stopVideoPolling()
+ stopVideoPolling();
}
} catch (error) {
- console.error('轮询视频状态失败:', error)
+ console.error("轮询视频状态失败:", error);
}
- }, 5000) // 每5秒轮询一次
-}
+ }, 5000); // 每5秒轮询一次
+};
// 停止视频轮询
const stopVideoPolling = () => {
if (videoPollingTimer) {
- clearInterval(videoPollingTimer)
- videoPollingTimer = null
+ clearInterval(videoPollingTimer);
+ videoPollingTimer = null;
}
-}
+};
const toggleCharacterInShot = async (charId: number) => {
- if (!currentStoryboard.value) return
+ if (!currentStoryboard.value) return;
// 初始化characters数组
if (!currentStoryboard.value.characters) {
- currentStoryboard.value.characters = []
+ currentStoryboard.value.characters = [];
}
- const char = characters.value.find(c => c.id === charId)
- if (!char) return
+ const char = characters.value.find((c) => c.id === charId);
+ if (!char) return;
// 检查是否已存在
- const existIndex = currentStoryboard.value.characters.findIndex(c =>
- typeof c === 'object' ? c.id === charId : c === charId
- )
+ const existIndex = currentStoryboard.value.characters.findIndex((c) =>
+ typeof c === "object" ? c.id === charId : c === charId,
+ );
if (existIndex > -1) {
// 移除角色
- currentStoryboard.value.characters.splice(existIndex, 1)
+ currentStoryboard.value.characters.splice(existIndex, 1);
} else {
// 添加角色(作为对象)
- currentStoryboard.value.characters.push(char)
+ currentStoryboard.value.characters.push(char);
}
// 保存到后端
try {
- const characterIds = currentStoryboard.value.characters.map(c =>
- typeof c === 'object' ? c.id : c
- )
+ const characterIds = currentStoryboard.value.characters.map((c) =>
+ typeof c === "object" ? c.id : c,
+ );
await dramaAPI.updateStoryboard(currentStoryboard.value.id.toString(), {
- character_ids: characterIds
- })
+ character_ids: characterIds,
+ });
if (existIndex > -1) {
- ElMessage.success(`已移除角色: ${char.name}`)
+ ElMessage.success(`已移除角色: ${char.name}`);
} else {
- ElMessage.success(`已添加角色: ${char.name}`)
+ ElMessage.success(`已添加角色: ${char.name}`);
}
} catch (error: any) {
- ElMessage.error('保存失败: ' + (error.message || '未知错误'))
+ ElMessage.error("保存失败: " + (error.message || "未知错误"));
// 回滚操作
if (existIndex > -1) {
- currentStoryboard.value.characters.push(char)
+ currentStoryboard.value.characters.push(char);
} else {
- currentStoryboard.value.characters.splice(currentStoryboard.value.characters.length - 1, 1)
+ currentStoryboard.value.characters.splice(
+ currentStoryboard.value.characters.length - 1,
+ 1,
+ );
}
}
-}
+};
const removeCharacterFromShot = async (charId: number) => {
- if (!currentStoryboard.value) return
+ if (!currentStoryboard.value) return;
// 初始化characters数组
if (!currentStoryboard.value.characters) {
- currentStoryboard.value.characters = []
+ currentStoryboard.value.characters = [];
}
- const char = characters.value.find(c => c.id === charId)
- if (!char) return
+ const char = characters.value.find((c) => c.id === charId);
+ if (!char) return;
// 检查是否已存在
- const existIndex = currentStoryboard.value.characters.findIndex(c =>
- typeof c === 'object' ? c.id === charId : c === charId
- )
+ const existIndex = currentStoryboard.value.characters.findIndex((c) =>
+ typeof c === "object" ? c.id === charId : c === charId,
+ );
if (existIndex > -1) {
// 移除角色
- currentStoryboard.value.characters.splice(existIndex, 1)
+ currentStoryboard.value.characters.splice(existIndex, 1);
}
// 保存到后端
try {
- const characterIds = currentStoryboard.value.characters.map(c =>
- typeof c === 'object' ? c.id : c
- )
+ const characterIds = currentStoryboard.value.characters.map((c) =>
+ typeof c === "object" ? c.id : c,
+ );
await dramaAPI.updateStoryboard(currentStoryboard.value.id.toString(), {
- character_ids: characterIds
- })
+ character_ids: characterIds,
+ });
- ElMessage.success(`已移除角色: ${char.name}`)
+ ElMessage.success(`已移除角色: ${char.name}`);
} catch (error: any) {
- ElMessage.error('保存失败: ' + (error.message || '未知错误'))
+ ElMessage.error("保存失败: " + (error.message || "未知错误"));
// 回滚操作
- currentStoryboard.value.characters.push(char)
+ currentStoryboard.value.characters.push(char);
}
-}
+};
const loadData = async () => {
try {
// 加载剧集信息
- const dramaRes = await dramaAPI.get(dramaId.toString())
- drama.value = dramaRes
+ const dramaRes = await dramaAPI.get(dramaId.toString());
+ drama.value = dramaRes;
// 找到当前章节
- const ep = dramaRes.episodes?.find(e => e.episode_number === episodeNumber)
+ const ep = dramaRes.episodes?.find(
+ (e) => e.episode_number === episodeNumber,
+ );
if (!ep) {
- ElMessage.error('章节不存在')
- router.back()
- return
+ ElMessage.error("章节不存在");
+ router.back();
+ return;
}
- episode.value = ep
- episodeId.value = ep.id
+ episode.value = ep;
+ episodeId.value = ep.id;
// 加载分镜列表
- const storyboardsRes = await dramaAPI.getStoryboards(ep.id.toString())
+ const storyboardsRes = await dramaAPI.getStoryboards(ep.id.toString());
// API返回格式: {storyboards: [...], total: number}
- storyboards.value = storyboardsRes?.storyboards || []
+ storyboards.value = storyboardsRes?.storyboards || [];
// 默认选中第一个分镜
if (storyboards.value.length > 0 && !currentStoryboardId.value) {
- currentStoryboardId.value = storyboards.value[0].id
+ currentStoryboardId.value = storyboards.value[0].id;
}
// 加载角色列表
- characters.value = dramaRes.characters || []
+ characters.value = dramaRes.characters || [];
// 加载可用场景列表
- availableScenes.value = dramaRes.scenes || []
+ availableScenes.value = dramaRes.scenes || [];
// 加载道具列表
- props.value = dramaRes.props || []
+ props.value = dramaRes.props || [];
// 加载视频素材库
- await loadVideoAssets()
-
+ await loadVideoAssets();
} catch (error: any) {
- ElMessage.error('加载数据失败: ' + (error.message || '未知错误'))
+ ElMessage.error("加载数据失败: " + (error.message || "未知错误"));
}
-}
+};
const selectScene = async (sceneId: number) => {
- if (!currentStoryboard.value) return
+ if (!currentStoryboard.value) return;
try {
// TODO: 调用API更新分镜的scene_id
await dramaAPI.updateScene(currentStoryboard.value.id.toString(), {
- scene_id: sceneId
- })
+ scene_id: sceneId,
+ });
// 重新加载数据
- await loadData()
- showSceneSelector.value = false
- ElMessage.success('场景关联成功')
+ await loadData();
+ showSceneSelector.value = false;
+ ElMessage.success("场景关联成功");
} catch (error: any) {
- ElMessage.error(error.message || '场景关联失败')
+ ElMessage.error(error.message || "场景关联失败");
}
-}
+};
const selectStoryboard = (id: number) => {
- currentStoryboardId.value = id
-}
+ currentStoryboardId.value = id;
+};
const handleTimelineSelect = (sceneId: number) => {
- selectStoryboard(sceneId)
-}
-
-
+ selectStoryboard(sceneId);
+};
const togglePlay = () => {
- if (currentPlayState.value === 'playing') {
- currentPlayState.value = 'paused'
+ if (currentPlayState.value === "playing") {
+ currentPlayState.value = "paused";
} else {
- currentPlayState.value = 'playing'
+ currentPlayState.value = "playing";
}
-}
+};
const formatTime = (seconds: number) => {
- const mins = Math.floor(seconds / 60)
- const secs = Math.floor(seconds % 60)
- return `${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`
-}
+ const mins = Math.floor(seconds / 60);
+ const secs = Math.floor(seconds % 60);
+ return `${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}`;
+};
const zoomIn = () => {
- ElMessage.info('时间线缩放功能开发中')
-}
+ ElMessage.info("时间线缩放功能开发中");
+};
const zoomOut = () => {
- ElMessage.info('时间线缩放功能开发中')
-}
+ ElMessage.info("时间线缩放功能开发中");
+};
const generateImage = async () => {
- if (!currentStoryboard.value) return
+ if (!currentStoryboard.value) return;
try {
- ElMessage.info('图片生成功能开发中')
+ ElMessage.info("图片生成功能开发中");
} catch (error: any) {
- ElMessage.error(error.message || '生成失败')
+ ElMessage.error(error.message || "生成失败");
}
-}
+};
const uploadImage = () => {
if (!currentStoryboard.value) {
- ElMessage.warning('请先选择镜头')
- return
+ ElMessage.warning("请先选择镜头");
+ return;
}
// 创建隐藏的文件输入
- const input = document.createElement('input')
- input.type = 'file'
- input.accept = 'image/*'
+ const input = document.createElement("input");
+ input.type = "file";
+ input.accept = "image/*";
input.onchange = async (e: Event) => {
- const target = e.target as HTMLInputElement
- const file = target.files?.[0]
- if (!file) return
+ const target = e.target as HTMLInputElement;
+ const file = target.files?.[0];
+ if (!file) return;
// 验证文件大小 (10MB)
if (file.size > 10 * 1024 * 1024) {
- ElMessage.error('图片大小不能超过 10MB')
- return
+ ElMessage.error("图片大小不能超过 10MB");
+ return;
}
try {
// 创建 FormData
- const formData = new FormData()
- formData.append('file', file)
+ const formData = new FormData();
+ formData.append("file", file);
// 上传到服务器
- const response = await fetch('/api/v1/upload/image', {
- method: 'POST',
- body: formData
- })
+ const response = await fetch("/api/v1/upload/image", {
+ method: "POST",
+ body: formData,
+ });
if (!response.ok) {
- throw new Error('上传失败')
+ throw new Error("上传失败");
}
- const result = await response.json()
- const imageUrl = result.data?.url
+ const result = await response.json();
+ const imageUrl = result.data?.url;
if (imageUrl && currentStoryboard.value) {
// 创建图片生成记录(关联到当前镜头和帧类型)
await imageAPI.uploadImage({
storyboard_id: currentStoryboard.value.id,
drama_id: parseInt(dramaId),
- frame_type: selectedFrameType.value || 'first',
+ frame_type: selectedFrameType.value || "first",
image_url: imageUrl,
- prompt: currentFramePrompt.value || '用户上传图片'
- })
+ prompt: currentFramePrompt.value || "用户上传图片",
+ });
// 刷新图片列表
- await loadStoryboardImages(currentStoryboard.value.id, selectedFrameType.value)
+ await loadStoryboardImages(
+ currentStoryboard.value.id,
+ selectedFrameType.value,
+ );
- ElMessage.success('图片上传成功')
+ ElMessage.success("图片上传成功");
}
} catch (error: any) {
- console.error('上传图片失败:', error)
- ElMessage.error(error.message || '上传失败')
+ console.error("上传图片失败:", error);
+ ElMessage.error(error.message || "上传失败");
}
- }
- input.click()
-}
+ };
+ input.click();
+};
const goBack = () => {
router.replace({
- name: 'EpisodeWorkflowNew',
- params: { id: dramaId, episodeNumber }
- })
-}
-
-
+ name: "EpisodeWorkflowNew",
+ params: { id: dramaId, episodeNumber },
+ });
+};
const handleAddStoryboard = async () => {
- if (!episodeId.value) return
+ if (!episodeId.value) return;
try {
- const nextShotNumber = storyboards.value.length > 0
- ? Math.max(...storyboards.value.map(s => s.storyboard_number)) + 1
- : 1
+ const nextShotNumber =
+ storyboards.value.length > 0
+ ? Math.max(...storyboards.value.map((s) => s.storyboard_number)) + 1
+ : 1;
await dramaAPI.createStoryboard({
episode_id: parseInt(episodeId.value),
storyboard_number: nextShotNumber,
title: `镜头 ${nextShotNumber}`,
- description: '新镜头描述',
- action: '动作描述',
- dialogue: '',
+ description: "新镜头描述",
+ action: "动作描述",
+ dialogue: "",
duration: 5,
- scene_id: storyboards.value.length > 0 ? storyboards.value[storyboards.value.length - 1].scene_id : undefined
- })
+ scene_id:
+ storyboards.value.length > 0
+ ? storyboards.value[storyboards.value.length - 1].scene_id
+ : undefined,
+ });
+
+ ElMessage.success("添加分镜成功");
+ await loadData(); // Refresh list
- ElMessage.success('添加分镜成功')
- await loadData() // Refresh list
-
// Select the new storyboard (the last one)
if (storyboards.value.length > 0) {
- selectStoryboard(storyboards.value[storyboards.value.length - 1].id)
+ selectStoryboard(storyboards.value[storyboards.value.length - 1].id);
}
} catch (error: any) {
- console.error('添加分镜失败:', error)
- ElMessage.error(error.message || '添加分镜失败')
+ console.error("添加分镜失败:", error);
+ ElMessage.error(error.message || "添加分镜失败");
}
-}
+};
const handleDeleteStoryboard = async (storyboard: any) => {
try {
await ElMessageBox.confirm(
`确定要删除镜头 ${storyboard.storyboard_number} 吗?此操作不可恢复。`,
- '删除确认',
+ "删除确认",
{
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }
- )
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ },
+ );
+
+ await dramaAPI.deleteStoryboard(storyboard.id);
+ ElMessage.success("删除分镜成功");
- await dramaAPI.deleteStoryboard(storyboard.id)
- ElMessage.success('删除分镜成功')
-
// If deleted current storyboard, clear selection or select another
if (currentStoryboardId.value === storyboard.id) {
- currentStoryboardId.value = undefined
- currentStoryboard.value = undefined
+ currentStoryboardId.value = undefined;
+ currentStoryboard.value = undefined;
}
-
- await loadData()
+
+ await loadData();
} catch (error: any) {
- if (error !== 'cancel') {
- console.error('删除分镜失败:', error)
- ElMessage.error(error.message || '删除分镜失败')
+ if (error !== "cancel") {
+ console.error("删除分镜失败:", error);
+ ElMessage.error(error.message || "删除分镜失败");
}
}
-}
+};
// 加载视频合成列表
const loadVideoMerges = async () => {
- if (!episodeId.value) return
+ if (!episodeId.value) return;
try {
- loadingMerges.value = true
+ loadingMerges.value = true;
const result = await videoMergeAPI.listMerges({
episode_id: episodeId.value.toString(),
page: 1,
- page_size: 20
- })
- videoMerges.value = result.merges
+ page_size: 20,
+ });
+ videoMerges.value = result.merges;
// 检查是否有进行中的任务
const hasProcessingTasks = result.merges.some(
- (merge: any) => merge.status === 'pending' || merge.status === 'processing'
- )
+ (merge: any) =>
+ merge.status === "pending" || merge.status === "processing",
+ );
if (hasProcessingTasks) {
- startMergePolling()
+ startMergePolling();
} else {
- stopMergePolling()
+ stopMergePolling();
}
} catch (error: any) {
- console.error('加载视频合成列表失败:', error)
- ElMessage.error('加载视频合成列表失败')
+ console.error("加载视频合成列表失败:", error);
+ ElMessage.error("加载视频合成列表失败");
} finally {
- loadingMerges.value = false
+ loadingMerges.value = false;
}
-}
+};
// 启动视频合成列表轮询
const startMergePolling = () => {
- if (mergePollingTimer) return
+ if (mergePollingTimer) return;
mergePollingTimer = setInterval(async () => {
if (!episodeId.value) {
- stopMergePolling()
- return
+ stopMergePolling();
+ return;
}
try {
const result = await videoMergeAPI.listMerges({
episode_id: episodeId.value.toString(),
page: 1,
- page_size: 20
- })
- videoMerges.value = result.merges
+ page_size: 20,
+ });
+ videoMerges.value = result.merges;
// 检查是否还有进行中的任务
const hasProcessingTasks = result.merges.some(
- (merge: any) => merge.status === 'pending' || merge.status === 'processing'
- )
+ (merge: any) =>
+ merge.status === "pending" || merge.status === "processing",
+ );
if (!hasProcessingTasks) {
- stopMergePolling()
+ stopMergePolling();
}
- } catch (error) {
- }
- }, 3000) // 每3秒轮询一次
-}
+ } catch (error) {}
+ }, 3000); // 每3秒轮询一次
+};
// 停止视频合成列表轮询
const stopMergePolling = () => {
if (mergePollingTimer) {
- clearInterval(mergePollingTimer)
- mergePollingTimer = null
+ clearInterval(mergePollingTimer);
+ mergePollingTimer = null;
}
-}
+};
// 处理视频合成完成事件
const handleMergeCompleted = async (mergeId: number) => {
// 刷新视频合成列表
- await loadVideoMerges()
+ await loadVideoMerges();
// 切换到视频合成标签页
- activeTab.value = 'merges'
-}
+ activeTab.value = "merges";
+};
// 下载视频
const downloadVideo = async (url: string, title: string) => {
try {
const loadingMsg = ElMessage.info({
- message: '正在准备下载...',
- duration: 0
- })
+ message: "正在准备下载...",
+ duration: 0,
+ });
// 使用fetch获取视频blob
- const response = await fetch(url)
+ const response = await fetch(url);
if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`)
+ throw new Error(`HTTP error! status: ${response.status}`);
}
- const blob = await response.blob()
- const blobUrl = window.URL.createObjectURL(blob)
+ const blob = await response.blob();
+ const blobUrl = window.URL.createObjectURL(blob);
// 创建下载链接
- const link = document.createElement('a')
- link.href = blobUrl
- link.download = `${title}.mp4`
- link.style.display = 'none'
- document.body.appendChild(link)
- link.click()
+ const link = document.createElement("a");
+ link.href = blobUrl;
+ link.download = `${title}.mp4`;
+ link.style.display = "none";
+ document.body.appendChild(link);
+ link.click();
// 清理
setTimeout(() => {
- document.body.removeChild(link)
- window.URL.revokeObjectURL(blobUrl)
- }, 100)
+ document.body.removeChild(link);
+ window.URL.revokeObjectURL(blobUrl);
+ }, 100);
- loadingMsg.close()
- ElMessage.success('视频下载已开始')
+ loadingMsg.close();
+ ElMessage.success("视频下载已开始");
} catch (error) {
- console.error('下载视频失败:', error)
- ElMessage.error('视频下载失败,请稍后重试')
+ console.error("下载视频失败:", error);
+ ElMessage.error("视频下载失败,请稍后重试");
}
-}
+};
// 预览合成视频
const previewMergedVideo = (url: string) => {
- window.open(url, '_blank')
-}
+ window.open(url, "_blank");
+};
// 删除视频合成记录
const deleteMerge = async (mergeId: number) => {
try {
await ElMessageBox.confirm(
- '确定要删除此合成记录吗?此操作不可恢复。',
- '删除确认',
+ "确定要删除此合成记录吗?此操作不可恢复。",
+ "删除确认",
{
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }
- )
-
- await videoMergeAPI.deleteMerge(mergeId)
- ElMessage.success('删除成功')
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning",
+ },
+ );
+
+ await videoMergeAPI.deleteMerge(mergeId);
+ ElMessage.success("删除成功");
// 刷新列表
- await loadVideoMerges()
+ await loadVideoMerges();
} catch (error: any) {
- if (error !== 'cancel') {
- console.error('删除失败:', error)
- ElMessage.error(error.response?.data?.message || '删除失败')
+ if (error !== "cancel") {
+ console.error("删除失败:", error);
+ ElMessage.error(error.response?.data?.message || "删除失败");
}
}
-}
+};
// 格式化日期时间
const formatDateTime = (dateStr: string) => {
- const date = new Date(dateStr)
- const now = new Date()
- const diff = now.getTime() - date.getTime()
- const minutes = Math.floor(diff / 60000)
- const hours = Math.floor(diff / 3600000)
- const days = Math.floor(diff / 86400000)
-
- if (minutes < 1) return '刚刚'
- if (minutes < 60) return `${minutes}分钟前`
- if (hours < 24) return `${hours}小时前`
- if (days < 7) return `${days}天前`
+ const date = new Date(dateStr);
+ const now = new Date();
+ const diff = now.getTime() - date.getTime();
+ const minutes = Math.floor(diff / 60000);
+ const hours = Math.floor(diff / 3600000);
+ const days = Math.floor(diff / 86400000);
+
+ if (minutes < 1) return "刚刚";
+ if (minutes < 60) return `${minutes}分钟前`;
+ if (hours < 24) return `${hours}小时前`;
+ if (days < 7) return `${days}天前`;
// 超过7天显示完整日期
- const month = String(date.getMonth() + 1).padStart(2, '0')
- const day = String(date.getDate()).padStart(2, '0')
- const hour = String(date.getHours()).padStart(2, '0')
- const minute = String(date.getMinutes()).padStart(2, '0')
- return `${month}-${day} ${hour}:${minute}`
-}
+ const month = String(date.getMonth() + 1).padStart(2, "0");
+ const day = String(date.getDate()).padStart(2, "0");
+ const hour = String(date.getHours()).padStart(2, "0");
+ const minute = String(date.getMinutes()).padStart(2, "0");
+ return `${month}-${day} ${hour}:${minute}`;
+};
onMounted(async () => {
- await loadData()
- await loadVideoModels()
- await loadVideoMerges()
-})
+ await loadData();
+ await loadVideoModels();
+ await loadVideoMerges();
+});
// 组件卸载时停止轮询
onBeforeUnmount(() => {
- stopPolling()
- stopVideoPolling()
- stopMergePolling()
-})
+ stopPolling();
+ stopVideoPolling();
+ stopMergePolling();
+});
</script>
<style scoped lang="scss">
@@ -3063,7 +4307,6 @@ onBeforeUnmount(() => {
// 脉冲动画
@keyframes pulse {
-
0%,
100% {
opacity: 1;
@@ -3618,7 +4861,6 @@ onBeforeUnmount(() => {
border-left: 3px solid var(--accent);
.shot-content {
-
.shot-number,
.shot-title {
color: var(--accent) !important;
@@ -3801,7 +5043,7 @@ onBeforeUnmount(() => {
}
:deep(.el-textarea__inner) {
- font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
+ font-family: "Monaco", "Menlo", "Consolas", monospace;
font-size: 12px;
line-height: 1.6;
}
@@ -3824,10 +5066,14 @@ onBeforeUnmount(() => {
gap: 6px;
&::before {
- content: '';
+ content: "";
width: 3px;
height: 14px;
- background: linear-gradient(to bottom, var(--accent), var(--accent-hover));
+ background: linear-gradient(
+ to bottom,
+ var(--accent),
+ var(--accent-hover)
+ );
border-radius: 2px;
}
}
@@ -3874,14 +5120,16 @@ onBeforeUnmount(() => {
overflow: hidden;
&::before {
- content: '';
+ content: "";
position: absolute;
width: 200%;
height: 200%;
- background: linear-gradient(45deg,
- transparent 30%,
- rgba(255, 255, 255, 0.3) 50%,
- transparent 70%);
+ background: linear-gradient(
+ 45deg,
+ transparent 30%,
+ rgba(255, 255, 255, 0.3) 50%,
+ transparent 70%
+ );
animation: shimmer 2s infinite;
top: -50%;
left: -50%;
@@ -3908,7 +5156,12 @@ onBeforeUnmount(() => {
left: 0;
right: 0;
padding: 6px 8px;
- background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.2) 70%, transparent);
+ background: linear-gradient(
+ to top,
+ rgba(0, 0, 0, 0.75),
+ rgba(0, 0, 0, 0.2) 70%,
+ transparent
+ );
display: flex;
justify-content: space-between;
align-items: center;
@@ -3948,8 +5201,6 @@ onBeforeUnmount(() => {
}
}
-
-
.panel-count-label {
margin-left: 5px;
font-size: 12px;
@@ -3965,9 +5216,6 @@ onBeforeUnmount(() => {
font-size: 12px;
color: var(--text-muted);
}
-
-
-
}
// 视频生成样式
@@ -4038,14 +5286,16 @@ onBeforeUnmount(() => {
overflow: hidden;
&::before {
- content: '';
+ content: "";
position: absolute;
width: 200%;
height: 200%;
- background: linear-gradient(45deg,
- transparent 30%,
- rgba(255, 255, 255, 0.3) 50%,
- transparent 70%);
+ background: linear-gradient(
+ 45deg,
+ transparent 30%,
+ rgba(255, 255, 255, 0.3) 50%,
+ transparent 70%
+ );
animation: shimmer 2s infinite;
top: -50%;
left: -50%;
@@ -4072,7 +5322,12 @@ onBeforeUnmount(() => {
left: 0;
right: 0;
padding: 6px 8px;
- background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.2) 70%, transparent);
+ background: linear-gradient(
+ to top,
+ rgba(0, 0, 0, 0.75),
+ rgba(0, 0, 0, 0.2) 70%,
+ transparent
+ );
display: flex;
justify-content: space-between;
align-items: center;
@@ -4247,7 +5502,6 @@ onBeforeUnmount(() => {
.reference-images-section {
margin-top: 12px;
-
.frame-type-buttons {
margin-bottom: 12px;
text-align: center;
@@ -4607,7 +5861,6 @@ onBeforeUnmount(() => {
}
@keyframes pulse {
-
0%,
100% {
opacity: 1;
@@ -4651,4 +5904,4 @@ onBeforeUnmount(() => {
max-height: 80px;
overflow-y: auto;
}
-</style>
\ No newline at end of file
+</style>