feat(design): 添加360视频和3D模型生成功能支持

- 在Design模型中新增video_url字段用于存储360度展示视频URL
- 在DesignImage模型中新增model_3d_url字段用于存储3D模型URL
- 设计路由新增生成视频接口,调用火山引擎即梦3.0 Pro API生成展示视频
- 设计路由新增生成3D模型接口,调用腾讯混元3D服务生成.glb格式3D模型
- 新增本地文件删除工具,支持强制重新生成时清理旧文件
- 设计响应Schema中添加video_url和model_3d_url字段支持前后端数据传递
- 前端设计详情页新增360度旋转3D模型展示区,支持生成、重新生成和下载3D模型
- 实现录制3D模型展示视频功能,支持捕获model-viewer旋转画面逐帧合成WebM文件下载
- 引入@google/model-viewer库作为3D模型Web组件展示支持
- 管理后台新增即梦视频生成和腾讯混元3D模型生成配置界面,方便服务密钥管理
- 前端API增加生成视频和生成3D模型接口请求方法,超时设置为10分钟以支持长时间处理
- 优化UI交互提示,新增生成中状态显示和错误提示,提升用户体验和操作反馈
This commit is contained in:
2026-03-27 23:26:56 +08:00
parent a1f56b1f8e
commit 8f5a86418e
17 changed files with 1517 additions and 6 deletions

View File

@@ -93,6 +93,7 @@ CREATE TABLE IF NOT EXISTS `designs` (
`surface_finish` VARCHAR(50) DEFAULT NULL COMMENT '表面处理',
`usage_scene` VARCHAR(50) DEFAULT NULL COMMENT '用途场景',
`image_url` TEXT DEFAULT NULL COMMENT '设计图URL',
`video_url` TEXT DEFAULT NULL COMMENT '360度展示视频URL',
`status` VARCHAR(20) DEFAULT 'generating' COMMENT '状态',
`created_at` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
@@ -113,6 +114,7 @@ CREATE TABLE IF NOT EXISTS design_images (
model_used VARCHAR(50) DEFAULT NULL COMMENT '使用的AI模型',
prompt_used TEXT DEFAULT NULL COMMENT '实际使用的英文prompt',
sort_order INT DEFAULT 0 COMMENT '排序',
model_3d_url TEXT DEFAULT NULL COMMENT '3D模型URL(.glb)',
created_at DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
CONSTRAINT fk_design_images_design FOREIGN KEY (design_id) REFERENCES designs(id) ON DELETE CASCADE,
INDEX idx_design_images_design_id (design_id)
@@ -492,6 +494,13 @@ INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`,
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (4, 'VOLCENGINE_BASE_URL', 'https://ark.cn-beijing.volces.com/api/v3', '', 'ai', 'N', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (5, 'AI_IMAGE_MODEL', 'seedream-5.0', 'AI生图模型 (flux-dev / seedream-4.5)', 'ai', 'N', '2026-03-27 08:20:02');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (6, 'AI_IMAGE_SIZE', '1024', 'AI生图默认尺寸', 'ai', 'N', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (7, 'TENCENT_SECRET_ID', '', ' SecretId (3D模型生成)', 'ai', 'Y', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (13, 'TENCENT_SECRET_KEY', '', ' SecretKey (3D模型生成)', 'ai', 'Y', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (8, 'VOLC_ACCESS_KEY', '', ' Access Key ()', 'ai', 'Y', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (9, 'VOLC_SECRET_KEY', '', ' Secret Key ()', 'ai', 'Y', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (10, 'VIDEO_PROMPT', '360', ' ( 3.0 Pro )', 'ai', 'N', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (11, 'MODEL3D_PROMPT', '', '3D模型生成默认提示词 (3D备用)', 'ai', 'N', '2026-03-27 07:09:05');
INSERT INTO `system_configs` (`id`, `config_key`, `config_value`, `description`, `config_group`, `is_secret`, `updated_at`) VALUES (12, 'VIDEO_FRAMES', '121', ': 49=2, 121=5', 'ai', 'N', '2026-03-27 07:09:05');
SET FOREIGN_KEY_CHECKS = 1;