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 修改图片裁剪

jiangzijun95cbb3156035
diff --git a/application/services/prompt_i18n.go b/application/services/prompt_i18n.go
index b2f4b9a..e4f7ec3 100644
--- a/application/services/prompt_i18n.go
+++ b/application/services/prompt_i18n.go
@@ -294,40 +294,56 @@ func (p *PromptI18n) GetActionSequenceFramePrompt() string {
style := p.config.Style.DefaultStyle
imageRatio := p.config.Style.DefaultImageRatio
if p.IsEnglish() {
- return fmt.Sprintf(`You are a professional director and image generation prompt expert. Please generate prompts suitable for AI image generation based on the provided shot information, strictly following the requirements below.
+ return fmt.Sprintf(`**Role:** You are an expert in visual storytelling and image generation prompts. You need to generate a prompt describing a 3x3 grid action sequence.
-**Core Requirements:**
+**Core Logic:**
+
+1. **Wholeness:** This is a complete single image containing a 3x3 grid layout, showing 9 consecutive actions of the same subject.
+2. **Visual Anchoring:** The subject, clothing, and art style must be highly consistent across all 9 grid cells.
+3. **Action Progression:** From cell 1 to cell 9, show a complete action sequence (e.g., standing → walking → running → jumping → landing).
+4. **Prompt Engineering:** Use high-quality visual vocabulary (lighting, materials, composition, depth of field).
-1. **3x3 Grid Layout:** A total of nine tiles arranged in 3 rows and 3 columns.
-2. **Action Evolution:** Tiles 1 through 9 must demonstrate a progression of movement.
-3. **Distinct Shot Varieties:** Each tile must reflect a different action or camera angle.
-4. **Strict Character Consistency:** Maintain identical facial features, hairstyles, and outfits across all frames.
+**Important:** You need to generate **ONE** complete prompt to describe the entire 3x3 grid image, not 9 separate prompts.
* **Style Requirement:** %s
* **Aspect Ratio:** %s
-**Output Format:**
-Return a JSON object containing:
-
-* **prompt**: The complete Chinese image generation prompt (detailed description, optimized for AI image generation).
-* **description**: A simplified Chinese description (for reference)`, style, imageRatio)
+**Output Specification:**
+Must return a **JSON object** with the following structure:
+* prompt: **Complete English image generation prompt** (describing the entire 3x3 grid layout, subject characteristics, progression of 9 actions, environment, lighting details, ensuring AI can directly generate a complete image containing 9 cells).
+* description: **Simplified English description** (summarizing the core content of this action sequence).
+
+**Example Format:**
+{
+ "prompt": "3x3 grid action sequence showing a black-clad swordsman's continuous actions. Cell 1: standing ready stance, Cell 2: drawing sword, Cell 3: charging forward, Cell 4: jumping into air, Cell 5: mid-air spin, Cell 6: downward strike, Cell 7: landing pose, Cell 8: sheathing sword, Cell 9: alert standing. All cells maintain character consistency, cinematic lighting, 35mm lens, high contrast.",
+ "description": "Black-clad swordsman's complete action sequence from drawing sword to attack"
+}`, style, imageRatio)
}
- return fmt.Sprintf(`**Role:** 你是一位精通视觉叙事与图像生成提示词的专家。你能将用户描述的模糊场景,转化为具有逻辑连贯性、动作多样性的 9 组图片生成指令。
+ return fmt.Sprintf(`**Role:** 你是一位精通视觉叙事与图像生成提示词的专家。你需要生成一个描述 3x3 九宫格动作序列的提示词。
**Core Logic:**
-1. **视觉锚定:** 保持主体、服装、画风在 9 个动作中高度一致。
-2. **动作矩阵:** 按照 3x3 九宫格逻辑设计 9 个完全不同的动作(如:行走、奔跑、回眸、战斗准备、跳跃、坐下、思考、倒地、特写凝视)。
-3. **提示词工程:** 使用高质量的视觉词汇(光影、材质、构图、景深)。
+1. **整体性:** 这是一张完整的图片,包含 3x3 九宫格布局,展示同一主体的 9 个连续动作。
+2. **视觉锚定:** 所有 9 个格子中的主体、服装、画风必须高度一致。
+3. **动作演进:** 从格子 1 到格子 9,展示一个完整的动作序列(如:从站立→行走→奔跑→跳跃→落地)。
+4. **提示词工程:** 使用高质量的视觉词汇(光影、材质、构图、景深)。
+
+**重要:** 你需要生成 **一个** 完整的提示词来描述整个 3x3 九宫格图片,而不是 9 个独立的提示词。
**Aspect Ratio:**
* %s
**Output Specification:**
-必须返回一个 **JSON 对象**,其结构如下:
-* prompt: **完整的中文图片生成提示词**(包含主体+动作细节+环境+光影细节,确保 AI 能直接生成高质量图像)。
-* description: **简化的中文描述**(概括该动作的核心)。`, imageRatio)
+必须返回一个 **JSON 对象**,其结构如下:
+* prompt: **完整的中文图片生成提示词**(描述整个 3x3 九宫格的布局、主体特征、9 个动作的演进过程、环境、光影细节,确保 AI 能直接生成一张包含 9 个格子的完整图像)。
+* description: **简化的中文描述**(概括这个动作序列的核心内容)。
+
+**示例格式:**
+{
+ "prompt": "3x3 九宫格动作序列图,展示一个黑衣剑客的连续动作。格子 1:站立准备姿态,格子 2:拔剑动作,格子 3:向前冲刺,格子 4:跳跃腾空,格子 5:空中旋转,格子 6:下劈攻击,格子 7:落地姿态,格子 8:收剑动作,格子 9:警戒站立。所有格子保持角色一致性,电影级光影,35mm 镜头,高对比度。",
+ "description": "黑衣剑客从拔剑到攻击的完整动作序列"
+}`, imageRatio)
}
// GetLastFramePrompt 获取尾帧提示词
diff --git a/application/services/video_generation_service.go b/application/services/video_generation_service.go
index a0583ea..8b671ad 100644
--- a/application/services/video_generation_service.go
+++ b/application/services/video_generation_service.go
@@ -522,7 +522,8 @@ func (s *VideoGenerationService) completeVideoGeneration(videoGenID uint, videoU
"video_url": videoURL,
"local_path": localVideoPath,
}
- if duration != nil {
+ // 只有当 duration 大于 0 时才保存,避免保存无效的 0 值
+ if duration != nil && *duration > 0 {
updates["duration"] = *duration
}
if width != nil {
@@ -547,7 +548,8 @@ func (s *VideoGenerationService) completeVideoGeneration(videoGenID uint, videoU
storyboardUpdates := map[string]interface{}{
"video_url": videoURL,
}
- if duration != nil {
+ // 只有当 duration 大于 0 时才更新,避免用无效的 0 值覆盖
+ if duration != nil && *duration > 0 {
storyboardUpdates["duration"] = *duration
}
if err := s.db.Model(&models.Storyboard{}).Where("id = ?", *videoGen.StoryboardID).Updates(storyboardUpdates).Error; err != nil {
diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml
index 3c2a6f5..b2d78b3 100644
--- a/web/pnpm-lock.yaml
+++ b/web/pnpm-lock.yaml
@@ -20,6 +20,9 @@ importers:
axios:
specifier: ^1.6.0
version: 1.13.2
+ cropperjs:
+ specifier: ^2.1.0
+ version: 2.1.0
dayjs:
specifier: ^1.11.10
version: 1.11.19
@@ -102,6 +105,39 @@ packages:
'@bufbuild/[email protected]':
resolution: {integrity: sha512-uFsRXwIGyu+r6AMdz+XijIIZJYpoWeYzILt5yZ2d3mCjQrWUTVpVD9WL/jZAbvp+Ed04rOhrsk7FiTcEDseB5A==}
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-el+rfJpZxsD2q5XxDBA4fRczcrOqB65Lb7roqXOq8LKufwf4bPWA9C6DjNJJahh/TP94dsLIEy3tSkgRMDv3Aw==}
+
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-0V589dAx8uZAfvJwdINLn76gfPQEafPH94ukjJ76uX0FCUovLaAVX+VRD/MDSYn0Mza/xejzmL9Dhd1DfemvmA==}
+
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-dEnk0rO+vp553LMvsPYgfrqVFcYXeVFrgFeavBYYEhAXtO40p7kN4rmLYLMMjaN+T/Mx2BATv6kUQpALKy2HLw==}
+
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-8BklWA4C/2GGAULupIWleSnGutECvYt3vx9flodqDfZpDEozws4LgLqmmzVuQmVkRVUdLnXdtx28kjgWLtzkHg==}
+
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-mXOV8ixJvG0XtTxLebYAKDjEkFbFOQnsF02hXPZk1yQSV0J+LLhN7a2NePrtKnoTsEV19fhhX3UorMoyGGxvzg==}
+
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-mtFtBl6HIa/s9TWohXw+Z5eJoeYTqylrIcHvS7oVv0uM7IyeRwBW65Q7z+KtLfq/LW+2Sw/XDyvR+VN/DawBPw==}
+
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-zMdyqbb0lc0Vd1oj2Z1miIZvhyZG41OXMHvrNt0hNwblh0dVdrvtw48lnFDgRv+672vt2CNx7Q04GuvCQfPlgg==}
+
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-XnxlQuqHitd1FOFZ6E0yXAF5NYd/LyIvONLLHI9p1rJw747WYKUPxQaSYtFKF7IOizJu/8mMj++Zc1dZ5ZP3YQ==}
+
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-2zELddqHQNmlvkPoiYzE5nxEjPE+C8nXoTPuvV3FvLp3YjBinc7qb73Icg9UXP0o9qC4+h9q96JgGo0AyMO/Ng==}
+
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-qvzlYDn3VQgPPpsCu6Gi1XUO0v3vpXQFSjjxcVijbXeNsl/eiKrN7H9/CEiRgi5vr8kXfd7ZvgYxBjUBbH+y+w==}
+
+ '@cropper/[email protected]':
+ resolution: {integrity: sha512-wLtpZ4/UWgo+fGmG8NBWge8x5ehjfDe9ovleDfLy8kpwFaw43XXOEXQtRL1UNr0u4JZxaeO8FcXcolRWUUrlRQ==}
+
resolution: {integrity: sha512-SITSV6aIXsuVNV3f3O0f2n/cgyEDWoSqtZMYiAmcsYHydcKrOz3gUxB/iXd/Qf08+IZX4KpgNbvUdMBmWz+kcA==}
engines: {node: '>=10'}
@@ -327,36 +363,42 @@ packages:
engines: {node: '>= 10.0.0'}
cpu: [arm]
os: [linux]
+ libc: [glibc]
'@parcel/[email protected]':
resolution: {integrity: sha512-kGO8RPvVrcAotV4QcWh8kZuHr9bXi9a3bSZw7kFarYR0+fGliU7hd/zevhjw8fnvIKG3J9EO5G6sXNGCSNMYPQ==}
engines: {node: '>= 10.0.0'}
cpu: [arm]
os: [linux]
+ libc: [musl]
'@parcel/[email protected]':
resolution: {integrity: sha512-KU75aooXhqGFY2W5/p8DYYHt4hrjHZod8AhcGAmhzPn/etTa+lYCDB2b1sJy3sWJ8ahFVTdy+EbqSBvMx3iFlw==}
engines: {node: '>= 10.0.0'}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@parcel/[email protected]':
resolution: {integrity: sha512-Qx8uNiIekVutnzbVdrgSanM+cbpDD3boB1f8vMtnuG5Zau4/bdDbXyKwIn0ToqFhIuob73bcxV9NwRm04/hzHQ==}
engines: {node: '>= 10.0.0'}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@parcel/[email protected]':
resolution: {integrity: sha512-UYBQvhYmgAv61LNUn24qGQdjtycFBKSK3EXr72DbJqX9aaLbtCOO8+1SkKhD/GNiJ97ExgcHBrukcYhVjrnogA==}
engines: {node: '>= 10.0.0'}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@parcel/[email protected]':
resolution: {integrity: sha512-YoRWCVgxv8akZrMhdyVi6/TyoeeMkQ0PGGOf2E4omODrvd1wxniXP+DBynKoHryStks7l+fDAMUBRzqNHrVOpg==}
engines: {node: '>= 10.0.0'}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@parcel/[email protected]':
resolution: {integrity: sha512-iby+D/YNXWkiQNYcIhg8P5hSjzXEHaQrk2SLrWOUD7VeC4Ohu0WQvmV+HDJokZVJ2UjJ4AGXW3bx7Lls9Ln4TQ==}
@@ -414,66 +456,79 @@ packages:
resolution: {integrity: sha512-Rn3n+FUk2J5VWx+ywrG/HGPTD9jXNbicRtTM11e/uorplArnXZYsVifnPPqNNP5BsO3roI4n8332ukpY/zN7rQ==}
cpu: [arm]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-grPNWydeKtc1aEdrJDWk4opD7nFtQbMmV7769hiAaYyUKCT1faPRm2av8CX1YJsZ4TLAZcg9gTR1KvEzoLjXkg==}
cpu: [arm]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-a59mwd1k6x8tXKcUxSyISiquLwB5pX+fJW9TkWU46lCqD/GRDe9uDN31jrMmVP3feI3mhAdvcCClhV8V5MhJFQ==}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-puS1MEgWX5GsHSoiAsF0TYrpomdvkaXm0CofIMG5uVkP6IBV+ZO9xhC5YEN49nsgYo1DuuMquF9+7EDBVYu4uA==}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-r3Wv40in+lTsULSb6nnoudVbARdOwb2u5fpeoOAZjFLznp6tDU8kd+GTHmJoqZ9lt6/Sys33KdIHUaQihFcu7g==}
cpu: [loong64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-MR8c0+UxAlB22Fq4R+aQSPBayvYa3+9DrwG/i1TKQXFYEaoW3B5b/rkSRIypcZDdWjWnpcvxbNaAJDcSbJU3Lw==}
cpu: [loong64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-3KhoECe1BRlSYpMTeVrD4sh2Pw2xgt4jzNSZIIPLFEsnQn9gAnZagW9+VqDqAHgm1Xc77LzJOo2LdigS5qZ+gw==}
cpu: [ppc64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-ziR1OuZx0vdYZZ30vueNZTg73alF59DicYrPViG0NEgDVN8/Jl87zkAPu4u6VjZST2llgEUjaiNl9JM6HH1Vdw==}
cpu: [ppc64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-uW0Y12ih2XJRERZ4jAfKamTyIHVMPQnTZcQjme2HMVDAHY4amf5u414OqNYC+x+LzRdRcnIG1YodLrrtA8xsxw==}
cpu: [riscv64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-u9yZ0jUkOED1BFrqu3BwMQoixvGHGZ+JhJNkNKY/hyoEgOwlqKb62qu+7UjbPSHYjiVy8kKJHvXKv5coH4wDeg==}
cpu: [riscv64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-/0PenBCmqM4ZUd0190j7J0UsQ/1nsi735iPRakO8iPciE7BQ495Y6msPzaOmvx0/pn+eJVVlZrNrSh4WSYLxNg==}
cpu: [s390x]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@rollup/[email protected]':
resolution: {integrity: sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@rollup/[email protected]':
resolution: {integrity: sha512-eLXw0dOiqE4QmvikfQ6yjgkg/xDM+MdU9YJuP4ySTibXU0oAvnEWXt7UDJmD4UkYialMfOGFPJnIHSe/kdzPxg==}
@@ -546,24 +601,28 @@ packages:
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
'@tailwindcss/[email protected]':
resolution: {integrity: sha512-1px92582HkPQlaaCkdRcio71p8bc8i/ap5807tPRDK/uw953cauQBT8c5tVGkOwrHMfc2Yh6UuxaH4vtTjGvHg==}
engines: {node: '>= 10'}
cpu: [arm64]
os: [linux]
+ libc: [musl]
'@tailwindcss/[email protected]':
resolution: {integrity: sha512-v3gyT0ivkfBLoZGF9LyHmts0Isc8jHZyVcbzio6Wpzifg/+5ZJpDiRiUhDLkcr7f/r38SWNe7ucxmGW3j3Kb/g==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
+ libc: [glibc]
'@tailwindcss/[email protected]':
resolution: {integrity: sha512-bhJ2y2OQNlcRwwgOAGMY0xTFStt4/wyU6pvI6LSuZpRgKQwxTec0/3Scu91O8ir7qCR3AuepQKLU/kX99FouqQ==}
engines: {node: '>= 10'}
cpu: [x64]
os: [linux]
+ libc: [musl]
'@tailwindcss/[email protected]':
resolution: {integrity: sha512-LffYTvPjODiP6PT16oNeUQJzNVyJl1cjIebq/rWWBF+3eDst5JGEFSc5cWxyRCJ0Mxl+KyIkqRxk1XPEs9x8TA==}
@@ -737,6 +796,9 @@ packages:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
+ resolution: {integrity: sha512-SsSDqdVRl+mjbIBkGWlk1gCGcc+HzBqCbH5EQ+1tkAFUdxq2KUGukXF1RqhmvXrrdrX7PDwSUkWgXS7E36KvGQ==}
+
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
@@ -911,24 +973,28 @@ packages:
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-5Vh9dGeblpTxWHpOx8iauV02popZDsCYMPIgiuw97OJ5uaDsL86cnqSFs5LZkG3ghHoX5isLgWzMs+eD1YzrnA==}
engines: {node: '>= 12.0.0'}
cpu: [arm64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-Cfd46gdmj1vQ+lR6VRTTadNHu6ALuw2pKR9lYq4FnhvgBc4zWY1EtZcAc6EffShbb1MFrIPfLDXD6Xprbnni4w==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [linux]
+ libc: [glibc]
resolution: {integrity: sha512-XJaLUUFXb6/QG2lGIW6aIk6jKdtjtcffUT0NKvIqhSBY3hh9Ch+1LCeH80dR9q9LBjG3ewbDjnumefsLsP6aiA==}
engines: {node: '>= 12.0.0'}
cpu: [x64]
os: [linux]
+ libc: [musl]
resolution: {integrity: sha512-FZn+vaj7zLv//D/192WFFVA0RgHawIcHqLX9xuWiQt7P0PtdFEVaxgF9rjM/IRYHQXNnk61/H/gb2Ei+kUQ4xQ==}
@@ -1084,48 +1150,56 @@ packages:
engines: {node: '>=14.0.0'}
cpu: [arm64]
os: [linux]
+ libc: glibc
resolution: {integrity: sha512-yDRe1yifGHl6kibkDlRIJ2ZzAU03KJ1AIvsAh4dsIDgK5jx83bxZLV1ZDUv7a8KK/iV/80LZnxnu/92zp99cXQ==}
engines: {node: '>=14.0.0'}
cpu: [arm]
os: [linux]
+ libc: glibc
resolution: {integrity: sha512-NfUqZSjHwnHvpSa7nyNxbWfL5obDjNBqhHUYmqbHUcmqBpFfHIQsUPgXME9DKn1yBlBc3mWnzMxRoucdYTzd2Q==}
engines: {node: '>=14.0.0'}
cpu: [arm64]
os: [linux]
+ libc: musl
resolution: {integrity: sha512-GIO6xfAtahJAWItvsXZ3MD1HM6s8cKtV1/HL088aUpKJaw/2XjTCveiOO2AdgMpLNztmq9DZ1lx5X5JjqhS45g==}
engines: {node: '>=14.0.0'}
cpu: [arm]
os: [linux]
+ libc: musl
resolution: {integrity: sha512-qtM4dJ5gLfvyTZ3QencfNbsTEShIWImSEpkThz+Y2nsCMbcMP7/jYOA03UWgPfEOKSehQQ7EIau7ncbFNoDNPQ==}
engines: {node: '>=14.0.0'}
cpu: [riscv64]
os: [linux]
+ libc: musl
resolution: {integrity: sha512-ZAxYOdmexcnxGnzdsDjYmNe3jGj+XW3/pF/n7e7r8y+5c6D2CQRrCUdapLgaqPt1edOPQIlQEZF8q5j6ng21yw==}
engines: {node: '>=14.0.0'}
cpu: [x64]
os: [linux]
+ libc: musl
resolution: {integrity: sha512-reVwa9ZFEAOChXpDyNB3nNHHyAkPMD+FTctQKECqKiVJnIzv2EaFF6/t0wzyvPgBKeatA8jszAIeOkkOzbYVkQ==}
engines: {node: '>=14.0.0'}
cpu: [riscv64]
os: [linux]
+ libc: glibc
resolution: {integrity: sha512-bvAdZQsX3jDBv6m4emaU2OMTpN0KndzTAMgJZZrKUgiC0qxBmBqbJG06Oj/lOCoXGCxAvUOheVYpezRTF+Feog==}
engines: {node: '>=14.0.0'}
cpu: [x64]
os: [linux]
+ libc: glibc
resolution: {integrity: sha512-86tcYwohjPgSZtgeU9K4LikrKBJNf8ZW/vfsFbdzsRlvc73IykiqanufwQi5qIul0YHuu9lZtDWyWxM2dH/Rsg==}
@@ -1286,6 +1360,72 @@ snapshots:
'@bufbuild/[email protected]': {}
+ '@cropper/[email protected]':
+ dependencies:
+ '@cropper/element': 2.1.0
+ '@cropper/utils': 2.1.0
+
+ '@cropper/[email protected]':
+ dependencies:
+ '@cropper/element': 2.1.0
+ '@cropper/utils': 2.1.0
+
+ '@cropper/[email protected]':
+ dependencies:
+ '@cropper/element': 2.1.0
+ '@cropper/utils': 2.1.0
+
+ '@cropper/[email protected]':
+ dependencies:
+ '@cropper/element': 2.1.0
+ '@cropper/utils': 2.1.0
+
+ '@cropper/[email protected]':
+ dependencies:
+ '@cropper/element': 2.1.0
+ '@cropper/element-canvas': 2.1.0
+ '@cropper/utils': 2.1.0
+
+ '@cropper/[email protected]':
+ dependencies:
+ '@cropper/element': 2.1.0
+ '@cropper/element-canvas': 2.1.0
+ '@cropper/element-image': 2.1.0
+ '@cropper/utils': 2.1.0
+
+ '@cropper/[email protected]':
+ dependencies:
+ '@cropper/element': 2.1.0
+ '@cropper/element-canvas': 2.1.0
+ '@cropper/element-selection': 2.1.0
+ '@cropper/utils': 2.1.0
+
+ '@cropper/[email protected]':
+ dependencies:
+ '@cropper/element': 2.1.0
+ '@cropper/element-canvas': 2.1.0
+ '@cropper/element-image': 2.1.0
+ '@cropper/element-selection': 2.1.0
+ '@cropper/utils': 2.1.0
+
+ '@cropper/[email protected]':
+ dependencies:
+ '@cropper/utils': 2.1.0
+
+ '@cropper/[email protected]':
+ dependencies:
+ '@cropper/element': 2.1.0
+ '@cropper/element-canvas': 2.1.0
+ '@cropper/element-crosshair': 2.1.0
+ '@cropper/element-grid': 2.1.0
+ '@cropper/element-handle': 2.1.0
+ '@cropper/element-image': 2.1.0
+ '@cropper/element-selection': 2.1.0
+ '@cropper/element-shade': 2.1.0
+ '@cropper/element-viewer': 2.1.0
+
+ '@cropper/[email protected]': {}
+
'@ctrl/[email protected]': {}
@@ -1803,6 +1943,11 @@ snapshots:
dependencies:
delayed-stream: 1.0.0
+ dependencies:
+ '@cropper/elements': 2.1.0
+ '@cropper/utils': 2.1.0
+
diff --git a/web/src/components/common/ImageCropDialog.vue b/web/src/components/common/ImageCropDialog.vue
index 31375ca..e04d736 100644
--- a/web/src/components/common/ImageCropDialog.vue
+++ b/web/src/components/common/ImageCropDialog.vue
@@ -1,61 +1,21 @@
<template>
- <el-dialog
- v-model="dialogVisible"
- title="裁剪动作序列图"
- :close-on-click-modal="false"
- destroy-on-close
- class="crop-dialog"
- align-center
- >
+ <el-dialog v-model="dialogVisible" title="裁剪动作序列图" width="1200px" :close-on-click-modal="false" destroy-on-close
+ class="crop-dialog" align-center top="5vh">
<div class="crop-container">
- <!-- 顶部文件夹区域 -->
- <div class="folder-area">
- <div
- v-for="folder in folders"
- :key="folder.type"
- class="folder-item"
- :class="{ 'drag-over': dragOverFolder === folder.type }"
- @dragover.prevent="handleFolderDragOver(folder.type)"
- @dragleave="handleFolderDragLeave"
- @drop="handleFolderDrop($event, folder.type)"
- >
- <el-icon :size="20" class="folder-icon">
- <Folder />
- </el-icon>
- <span class="folder-name">{{ folder.name }}</span>
- <el-badge :value="folder.count" :hidden="folder.count === 0" />
- </div>
- </div>
-
<!-- 下方区域 -->
<div class="content-area">
<!-- 左侧裁剪区域 -->
<div class="crop-area">
<div class="crop-canvas-wrapper">
- <cropper-canvas
- ref="cropperCanvasRef"
- background
- class="cropper-canvas-element"
- >
- <cropper-image
- v-if="imageUrl"
- ref="cropperImageRef"
- :src="imageUrl"
- alt="crop"
- rotatable
- scalable
- skewable
- translatable
- />
+ <cropper-canvas ref="cropperCanvasRef" background class="cropper-canvas-element">
+ <cropper-image v-if="imageUrl" ref="cropperImageRef" :src="imageUrl" alt="crop" rotatable scalable
+ skewable translatable />
<cropper-shade hidden></cropper-shade>
<cropper-handle action="move" plain></cropper-handle>
- <cropper-selection initial-coverage="0.8" movable resizable>
+ <cropper-selection initial-coverage="0.7" movable outlined aspectRatio="1">
<cropper-grid role="grid" bordered covered></cropper-grid>
<cropper-crosshair centered></cropper-crosshair>
- <cropper-handle
- action="move"
- theme-color="rgba(255, 255, 255, 0.35)"
- ></cropper-handle>
+ <cropper-handle action="move" theme-color="rgba(255, 255, 255, 0.35)"></cropper-handle>
<cropper-handle action="n-resize"></cropper-handle>
<cropper-handle action="e-resize"></cropper-handle>
<cropper-handle action="s-resize"></cropper-handle>
@@ -75,27 +35,39 @@
</div>
</div>
+ <!-- 缩放控制区域 -->
+ <div class="zoom-control">
+ <el-button :icon="ZoomIn" circle @click="handleZoomIn" :disabled="zoomLevel >= 200" />
+ <el-slider v-model="zoomLevel" :min="50" :max="200" :step="5" vertical height="300px"
+ @change="handleZoomChange" />
+ <el-button :icon="ZoomOut" circle @click="handleZoomOut" :disabled="zoomLevel <= 50" />
+ <div class="zoom-label">{{ zoomLevel }}%</div>
+ </div>
+
<!-- 右侧预览区域 -->
<div class="preview-area">
+ <!-- 顶部文件夹区域 -->
+ <div class="folder-area">
+ <div v-for="folder in folders" :key="folder.type" class="folder-item"
+ :class="{ 'drag-over': dragOverFolder === folder.type }"
+ @dragover.prevent="handleFolderDragOver(folder.type)" @dragleave="handleFolderDragLeave"
+ @drop="handleFolderDrop($event, folder.type)">
+ <el-icon :size="20" class="folder-icon">
+ <Folder />
+ </el-icon>
+ <span class="folder-name">{{ folder.name }}</span>
+ <el-badge :value="folder.count" :hidden="folder.count === 0" />
+ </div>
+ </div>
<div class="preview-title">
已裁剪图片 ({{ croppedImages.length }})
</div>
<div class="preview-grid">
- <div
- v-for="(img, index) in croppedImages"
- :key="index"
- class="preview-item"
- draggable="true"
- @dragstart="handleImageDragStart($event, img, index)"
- @dragend="handleImageDragEnd"
- >
+ <div v-for="(img, index) in croppedImages" :key="index" class="preview-item" draggable="true"
+ @dragstart="handleImageDragStart($event, img, index)" @dragend="handleImageDragEnd">
<img :src="img.url" alt="cropped" />
<div class="preview-overlay">
- <el-icon
- :size="16"
- class="delete-icon"
- @click="removeCroppedImage(index)"
- >
+ <el-icon :size="16" class="delete-icon" @click="removeCroppedImage(index)">
<Close />
</el-icon>
</div>
@@ -119,7 +91,7 @@
<script setup lang="ts">
import { ref, computed, watch, nextTick, onMounted } from "vue";
-import { Folder, Close } from "@element-plus/icons-vue";
+import { Folder, Close, ZoomIn, ZoomOut } from "@element-plus/icons-vue";
import "cropperjs";
interface CroppedImage {
@@ -152,6 +124,8 @@ const croppedImages = ref<CroppedImage[]>([]);
const dragOverFolder = ref<string | null>(null);
const draggingImageIndex = ref<number | null>(null);
const saving = ref(false);
+const zoomLevel = ref(100);
+const previousZoomLevel = ref(100);
const folders = computed(() => [
{
@@ -230,10 +204,39 @@ const cropImage = async () => {
const resetCrop = () => {
if (cropperImageRef.value && cropperImageRef.value.$resetTransform) {
cropperImageRef.value.$resetTransform();
+ zoomLevel.value = 100;
console.log("Crop reset");
}
};
+const handleZoomIn = () => {
+ if (zoomLevel.value < 200) {
+ zoomLevel.value = Math.min(200, zoomLevel.value + 10);
+ applyZoom();
+ }
+};
+
+const handleZoomOut = () => {
+ if (zoomLevel.value > 50) {
+ zoomLevel.value = Math.max(50, zoomLevel.value - 10);
+ applyZoom();
+ }
+};
+
+const handleZoomChange = (value: number) => {
+ zoomLevel.value = value;
+ applyZoom();
+};
+
+const applyZoom = () => {
+ if (cropperImageRef.value && cropperImageRef.value.$scale) {
+ // 计算相对于上一次的缩放比例
+ const ratio = zoomLevel.value / previousZoomLevel.value;
+ cropperImageRef.value.$scale(ratio);
+ previousZoomLevel.value = zoomLevel.value;
+ }
+};
+
const removeCroppedImage = (index: number) => {
const img = croppedImages.value[index];
URL.revokeObjectURL(img.url);
@@ -311,9 +314,8 @@ const handleSave = () => {
<style scoped>
.crop-dialog :deep(.el-dialog) {
- width: 90vw;
- max-width: 1600px;
- height: 90vh;
+ width: 1200px;
+ height: 85vh;
margin: 0;
display: flex;
flex-direction: column;
@@ -336,10 +338,10 @@ const handleSave = () => {
.folder-area {
display: flex;
gap: 16px;
- padding: 16px;
+ /* padding: 16px;
background: var(--bg-secondary);
border-radius: 8px;
- border: 2px dashed var(--border-primary);
+ border: 2px dashed var(--border-primary); */
}
.folder-item {
@@ -397,6 +399,26 @@ const handleSave = () => {
min-height: 0;
}
+.zoom-control {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 12px;
+ padding: 16px 8px;
+ background: var(--bg-primary);
+ border: 1px solid var(--border-primary);
+ border-radius: 8px;
+ height: fit-content;
+ align-self: center;
+}
+
+.zoom-label {
+ font-size: 12px;
+ color: var(--text-secondary);
+ font-weight: 500;
+ margin-top: 4px;
+}
+
.crop-title,
.preview-title {
font-size: 14px;
@@ -650,7 +672,7 @@ const handleSave = () => {
.preview-area {
flex: 1;
- min-width: 400px;
+ min-width: 300px;
display: flex;
flex-direction: column;
gap: 12px;
diff --git a/web/src/views/drama/ProfessionalEditor.vue b/web/src/views/drama/ProfessionalEditor.vue
index 249d7e4..fe677d3 100644
--- a/web/src/views/drama/ProfessionalEditor.vue
+++ b/web/src/views/drama/ProfessionalEditor.vue
@@ -589,7 +589,7 @@
class="crop-icon-overlay"
@click.stop="openCropDialog(img)"
>
- <el-icon :size="24" color="#fff">
+ <el-icon :size="18" color="#fff">
<Crop />
</el-icon>
</div>
@@ -3556,6 +3556,9 @@ const startVideoPolling = () => {
}
try {
+ // 保存旧的视频列表用于对比
+ const oldVideos = [...generatedVideos.value];
+
const result = await videoAPI.listVideos({
storyboard_id: currentStoryboard.value.id.toString(),
page: 1,
@@ -3563,6 +3566,26 @@ const startVideoPolling = () => {
});
generatedVideos.value = result.items || [];
+ // 检测是否有视频从 processing 变为 completed
+ const hasNewlyCompleted = generatedVideos.value.some((newVideo) => {
+ const oldVideo = oldVideos.find((v) => v.id === newVideo.id);
+ return (
+ oldVideo &&
+ (oldVideo.status === "pending" || oldVideo.status === "processing") &&
+ newVideo.status === "completed"
+ );
+ });
+
+ // 如果有视频完成,重新加载分镜列表以更新 duration
+ if (hasNewlyCompleted && episodeId.value) {
+ try {
+ const storyboardsRes = await dramaAPI.getStoryboards(episodeId.value.toString());
+ storyboards.value = storyboardsRes?.storyboards || [];
+ } catch (error) {
+ console.error("重新加载分镜列表失败:", error);
+ }
+ }
+
// 如果没有进行中的任务,停止轮询
const hasPendingOrProcessing = generatedVideos.value.some(
(v) => v.status === "pending" || v.status === "processing",
@@ -6098,10 +6121,10 @@ onBeforeUnmount(() => {
.crop-icon-overlay {
position: absolute;
- top: 8px;
- right: 8px;
- width: 36px;
- height: 36px;
+ top: 4px;
+ right: 4px;
+ width: 28px;
+ height: 28px;
background: rgba(0, 0, 0, 0.7);
border-radius: 50%;
display: flex;