Initial TrueGrowth source import

This commit is contained in:
2026-07-07 09:36:36 +08:00
commit 3b6781d695
2283 changed files with 691996 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
## Context
现有 MV 与视频分析器脚本页都存在角色设定编辑能力,且生成流程依赖名称、描述和参考图保持人物或物品一致。素材库已能承载生成上下文资产,但视频复用需要一个更通用的“主体素材”语义,并且需要在两个工作流中保持同一套选择和回填规则。
## Goals / Non-Goals
- Goals:
- 让素材库可区分主体素材,并在脚本编辑场景优先展示
- 让用户可在素材库把图片设为主体,并填写独立于素材标题的主体名
- 让 MV 与视频分析器脚本页使用同一套主体素材选择与字段回填规则
- 让第 3 步明确反显最终会参与生成的主体参考图
- 允许普通图片作为兜底,避免历史图片资产无法复用
- Non-Goals:
- 不新增独立角色管理系统
- 不迁移或重写现有 MV/视频分析器记录结构
- 不把素材图片转存为 base64 或大文本字段
## Decisions
### 主体素材引用
脚本编辑数据继续以现有角色条目为落点,选中主体素材后只写入轻量字段:
- `name`: 来自主体素材名称;普通图片兜底时可由素材标题/文件名推导
- `description`: 来自主体素材描述;普通图片兜底时不强制覆盖
- `referenceImageUrl`: 来自素材的可访问图片 URL
实现应避免把图片二进制、base64 或完整素材对象写入脚本记录,降低高并发文件处理场景下的内存和持久化压力。
### 选择器过滤与兜底
素材库详情面板提供“设为主体”入口,点击后弹出命名表单。主体名必填,并与素材标题分离;主体提示词可选,默认可沿用已有生成提示词,保存失败不影响素材标题和原图。
脚本编辑入口默认优先展示“主体”类别素材,并允许切换/搜索普通图片素材作为兜底。普通图片被选中时,只能保证 `referenceImageUrl` 存在;名称可从标题或文件名推导,描述为空时保留用户已有输入。
### 第 3 步反显
第 3 步展示的主体图必须来自当前角色条目的 `referenceImageUrl`。若用户在脚本页选择或替换主体素材,进入第 3 步时应立即看到一致的主体参考图;若图片 URL 不可用,应显示可恢复的空态,而不是阻断页面渲染。
## Risks
- 历史图片素材元数据不完整,可能无法提供 description普通图片兜底必须保留用户手写描述。
- 不同工作流角色字段命名可能存在差异;实现时应先收敛到共享映射函数,避免 MV 与视频分析器行为分叉。

View File

@@ -0,0 +1,24 @@
# Change: 视频工作流复用素材库主体图
## Why
MV 与视频分析器脚本页已经承载角色设定编辑,但主体参考图仍依赖重新生成或手动补充。用户需要从素材库中复用既有人物、商品或道具主体资产,减少重复上传、重复生成和跨工作流主体不一致。
## What Changes
- 素材库新增或明确支持“主体”类别,用于沉淀可复用人物、商品、道具等图片资产
- 素材库详情面板支持把图片设为主体,并要求填写独立于素材标题的主体名
- MV 与视频分析器脚本页的角色编辑区域支持从素材库选择主体素材
- 选中主体素材后回填 `name``description``referenceImageUrl`
- 生成流程第 3 步反显已选主体参考图,便于用户确认主体一致性
- 普通图片素材可作为兜底被选用,只回填可推导的名称和参考图
## Impact
- Affected specs:
- `video-mv-workflow-parity`
- Affected code:
- 素材库分类与选择器过滤
- MV 脚本页主体选择表单
- 视频分析器脚本页主体选择表单
- 第 3 步主体参考图展示与生成参数组装

View File

@@ -0,0 +1,58 @@
## ADDED Requirements
### Requirement: Shared Subject Asset Category
The system SHALL support reusable subject assets in the asset library for video workflows.
#### Scenario: Filter reusable subject assets
- **GIVEN** the asset library contains subject assets and ordinary image assets
- **WHEN** the user opens a subject asset picker from a supported video workflow
- **THEN** the picker SHALL prioritize assets categorized as subjects
- **AND** it SHALL still allow ordinary image assets to be selected as a fallback
#### Scenario: Mark image as subject
- **GIVEN** the user selects an image asset in the asset library
- **WHEN** the user chooses to set it as a subject
- **THEN** the system SHALL require a subject name separate from the asset title
- **AND** it SHALL persist the subject category and lightweight subject metadata for future reuse
#### Scenario: Preserve lightweight asset references
- **WHEN** a subject asset is selected for a workflow character
- **THEN** the workflow record SHALL persist only lightweight subject fields and image URL references
- **AND** it SHALL NOT persist image binaries, base64 payloads, or full asset objects in the workflow record
### Requirement: Shared Script Page Subject Asset Selection
The system SHALL let users select asset-library subject materials from both the MV creator script page and the video analyzer script page.
#### Scenario: Select subject asset in MV creator script page
- **GIVEN** the user is editing a character on the MV creator script page
- **WHEN** the user selects a subject asset from the asset library
- **THEN** the editor SHALL populate `name`, `description`, and `referenceImageUrl` from the selected asset
- **AND** the populated values SHALL be persisted with the MV workflow record
#### Scenario: Select subject asset in video analyzer script page
- **GIVEN** the user is editing a detected character on the video analyzer script page
- **WHEN** the user selects a subject asset from the asset library
- **THEN** the editor SHALL populate `name`, `description`, and `referenceImageUrl` from the selected asset
- **AND** the populated values SHALL be persisted with the video analyzer record
#### Scenario: Use ordinary image fallback
- **GIVEN** the user is editing a character in either supported script page
- **WHEN** the user selects an ordinary image asset instead of a subject asset
- **THEN** the character editor SHALL populate `referenceImageUrl` from the image asset
- **AND** it SHALL populate `name` when a title or filename can be inferred
- **AND** it SHALL preserve any existing user-edited `description` unless the image asset explicitly provides one
### Requirement: Shared Step Three Subject Reference Preview
The system SHALL show selected subject reference images in step 3 of both MV creator and video analyzer generation flows.
#### Scenario: Reflect selected reference image in step 3
- **GIVEN** a workflow character has a `referenceImageUrl` populated from a selected asset
- **WHEN** the user reaches step 3 of the generation flow
- **THEN** the step SHALL display that character reference image with the character identity
- **AND** the displayed image SHALL match the image reference used when submitting generation
#### Scenario: Handle unavailable reference image
- **GIVEN** a workflow character has an unavailable or unreadable `referenceImageUrl`
- **WHEN** the user reaches step 3 of the generation flow
- **THEN** the step SHALL render the remaining character information without blocking the page
- **AND** it SHALL allow the user to replace or clear the reference image

View File

@@ -0,0 +1,16 @@
## 1. Implementation
- [x] 1.1 扩展素材库资产类型/分类,支持主体类别,并兼容普通图片兜底选择
- [x] 1.1.1 素材库详情面板支持把图片设为主体,并填写独立主体名
- [x] 1.2 在 MV 脚本页角色编辑区域接入素材库选择入口
- [x] 1.3 在视频分析器脚本页角色编辑区域接入相同的素材库选择入口
- [x] 1.4 选中主体素材后回填 `name``description``referenceImageUrl`,并持久化到现有角色数据
- [x] 1.5 选中普通图片兜底素材后回填 `referenceImageUrl` 和可推导名称,不覆盖用户已编辑描述
- [x] 1.6 在生成流程第 3 步反显主体参考图,并与提交生成时使用的主体引用保持一致
- [x] 1.7 增加素材类别过滤与共享选择组件测试,覆盖主体素材搜索、类别筛选和选择入口回调
## 2. Validation
- [x] 2.1 运行相关前端/单元测试
- [ ] 2.2 手动验证 MV 脚本页选择主体素材、字段回填、第 3 步反显
- [ ] 2.3 手动验证视频分析器脚本页选择主体素材、字段回填、第 3 步反显