From 0a8a3ad297c5556e1e37ee4a6a721a4e646e519d Mon Sep 17 00:00:00 2001 From: ZLI263 Date: Sun, 12 Oct 2025 20:48:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 34 ++++++++++++++ src/utils/request.js | 3 +- src/views/video/avatar-synthesis.vue | 67 +++++++++++++++------------- src/views/video/detect-template.vue | 66 ++++++++++++++++----------- src/views/video/face-detect.vue | 23 +++++----- src/views/video/video-synthesis.vue | 11 +++++ 6 files changed, 136 insertions(+), 68 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 8681ff5..ade7452 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -254,6 +254,40 @@ export const constantRoutes = [ name: 'AvatarSynthesis', component: () => import('@/views/video/avatar-synthesis'), meta: { title: '特写视频生成', icon: 'el-icon-user-solid' } + }, + { + path: 'dance-video-generation', + name: 'DanceVideoGeneration', + component: () => import('@/views/video/dance-video-generation'), + meta: { title: '舞动视频生成', icon: 'el-icon-video-camera' } + }, + { + path: 'image-video-analysis', + name: 'ImageVideoAnalysis', + component: () => import('@/views/video/image-video-analysis'), + meta: { title: '图片视频分析列表', icon: 'el-icon-picture' } + } + ] + }, + + { + path: '/text-model', + component: Layout, + redirect: '/text-model/index', + name: 'TextModelRoot', + meta: { title: '文本模型', icon: 'el-icon-document' }, + children: [ + { + path: 'index', + name: 'TextModel', + component: () => import('@/views/text-model/index'), + meta: { title: '文本模型', icon: 'el-icon-document' } + }, + { + path: 'translation', + name: 'Translation', + component: () => import('@/views/text-model/translation'), + meta: { title: '翻译模型', icon: 'el-icon-translation' } } ] }, diff --git a/src/utils/request.js b/src/utils/request.js index 248043b..f894307 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -40,9 +40,10 @@ service.interceptors.response.use( if (res.success === true) { // 后端成功响应,转换为前端期望格式,保留分页信息 + // 检查是否有data字段(标准API),如果没有则使用整个res作为data(翻译API等) return { code: 20000, - data: res.data, + data: res.data || res, // 如果没有data字段,使用整个res作为data message: res.message || 'Success', total: res.total, current: res.current, diff --git a/src/views/video/avatar-synthesis.vue b/src/views/video/avatar-synthesis.vue index a120742..241a375 100644 --- a/src/views/video/avatar-synthesis.vue +++ b/src/views/video/avatar-synthesis.vue @@ -227,6 +227,8 @@ export default { videoFps: 30, mouthMoveStrength: 1.0, pasteBack: true, + extBbox: null, // 扩展边界框 + faceBbox: null, // 人脸边界框 headMoveStrength: 0.7 }, rules: { @@ -258,6 +260,10 @@ export default { return [ { label: 'emo-v1', value: 'emo-v1' } ] + } else if (this.selectedImageModel === 'emoji' || this.selectedImageModel === 'emoji-detect-v1') { + return [ + { label: 'emoji-v1', value: 'emoji-v1' } + ] } else if (this.selectedImageModel === 'liveportrait-detect') { return [ { label: 'liveportrait', value: 'liveportrait' } @@ -298,38 +304,22 @@ export default { avatarName: item.avatarName, ownerName: item.ownerName, ownerPhone: item.ownerPhone, - modelName: item.modelName || item.model || '' // 获取模型名信息 + modelName: item.modelName || item.model || '', // 获取模型名信息 + extBbox: item.extBbox || null, // 扩展边界框 + faceBbox: item.faceBbox || null // 人脸边界框 })) console.log('Image options set:', this.imageOptions) } else if (response && response.success === false) { console.error('Face Detect API response error:', response) this.$message.error(`获取头像列表失败: ${response.message || '未知错误'}`) - // 使用模拟数据 - this.imageOptions = [ - { id: 'img-001', name: '头像1', url: 'http://example.com/images/avatar1.jpg', ownerName: '张三', ownerPhone: '13800138000', modelName: 'emo-detect-v1' }, - { id: 'img-002', name: '头像2', url: 'http://example.com/images/avatar2.jpg', ownerName: '李四', ownerPhone: '13900139000', modelName: 'liveportrait-detect' }, - { id: 'img-003', name: '头像3', url: 'http://example.com/images/avatar3.jpg', ownerName: '王五', ownerPhone: '13700137000', modelName: 'other-model' } - ] } else { console.error('Unexpected face detect response format:', response) this.$message.error('获取头像列表失败: 响应数据格式不正确') - // 使用模拟数据 - this.imageOptions = [ - { id: 'img-001', name: '头像1', url: 'http://example.com/images/avatar1.jpg', ownerName: '张三', ownerPhone: '13800138000', modelName: 'emo-detect-v1' }, - { id: 'img-002', name: '头像2', url: 'http://example.com/images/avatar2.jpg', ownerName: '李四', ownerPhone: '13900139000', modelName: 'liveportrait-detect' }, - { id: 'img-003', name: '头像3', url: 'http://example.com/images/avatar3.jpg', ownerName: '王五', ownerPhone: '13700137000', modelName: 'other-model' } - ] } }).catch(error => { this.imageLoading = false console.error('获取头像列表失败:', error) this.$message.error(`网络请求失败: ${error.message || '请检查网络连接'}`) - // 开发环境使用模拟数据 - this.imageOptions = [ - { id: 'img-001', name: '头像1', url: 'http://example.com/images/avatar1.jpg', ownerName: '张三', ownerPhone: '13800138000', modelName: 'emo-detect-v1' }, - { id: 'img-002', name: '头像2', url: 'http://example.com/images/avatar2.jpg', ownerName: '李四', ownerPhone: '13900139000', modelName: 'liveportrait-detect' }, - { id: 'img-003', name: '头像3', url: 'http://example.com/images/avatar3.jpg', ownerName: '王五', ownerPhone: '13700137000', modelName: 'other-model' } - ] }) }, @@ -368,23 +358,12 @@ export default { } else { console.error('Unexpected response format:', response) this.$message.error('获取音频列表失败: 响应数据格式不正确') - // 使用模拟数据 - this.audioOptions = [ - { id: 'audio-001', name: 'tts_20251004_185457_1368662043.mp3', url: 'http://example.com/audio/audio1.mp3' }, - { id: 'audio-002', name: 'tts_20251004_185500_1368662044.mp3', url: 'http://example.com/audio/audio2.mp3' }, - { id: 'audio-003', name: 'tts_20251004_185503_1368662045.mp3', url: 'http://example.com/audio/audio3.mp3' } - ] } }).catch(error => { this.audioLoading = false console.error('获取音频列表失败:', error) this.$message.error(`网络请求失败: ${error.message || '请检查网络连接'}`) // 开发环境使用模拟数据 - this.audioOptions = [ - { id: 'audio-001', name: 'tts_20251004_185457_1368662043.mp3', url: 'http://example.com/audio/audio1.mp3' }, - { id: 'audio-002', name: 'tts_20251004_185500_1368662044.mp3', url: 'http://example.com/audio/audio2.mp3' }, - { id: 'audio-003', name: 'tts_20251004_185503_1368662045.mp3', url: 'http://example.com/audio/audio3.mp3' } - ] }) }, @@ -403,16 +382,29 @@ export default { // 获取头像的模型名信息 this.selectedImageModel = selectedImage.modelName || '' + console.log('Selected image model:', this.selectedImageModel) + console.log('Selected image data:', selectedImage) + + // 保存边界框信息 + this.form.extBbox = selectedImage.extBbox + this.form.faceBbox = selectedImage.faceBbox // 根据模型名自动设置模型供应商 if (this.selectedImageModel === 'emo-detect-v1') { this.form.modelProvider = 'emo-v1' + this.form.model = 'emo-v1' + } else if (this.selectedImageModel === 'emoji' || this.selectedImageModel === 'emoji-detect-v1') { + this.form.modelProvider = 'emoji-v1' + this.form.model = 'emoji-v1' } else if (this.selectedImageModel === 'liveportrait-detect') { this.form.modelProvider = 'liveportrait' + this.form.model = 'liveportrait' } else { // 默认设置 this.form.modelProvider = 'dashscope' + this.form.model = 'liveportrait' } + console.log('Set model provider to:', this.form.modelProvider) } }, @@ -443,7 +435,20 @@ export default { this.$refs.form.validate((valid) => { if (valid) { this.loading = true - synthesizeVideo(this.form).then(response => { + + // 构建提交数据 + const submitData = { ...this.form } + + // 当模型为emoji-v1时,包含边界框信息 + if (this.form.modelProvider === 'emoji-v1') { + if (this.form.extBbox) { + submitData.extBbox = this.form.extBbox + } + if (this.form.faceBbox) { + submitData.faceBbox = this.form.faceBbox + } + } + synthesizeVideo(submitData).then(response => { this.loading = false if (response.code === 20000 || response.success) { this.$message.success('视频合成任务已提交,请稍后查看结果') diff --git a/src/views/video/detect-template.vue b/src/views/video/detect-template.vue index 29d2ed0..a0c6cee 100644 --- a/src/views/video/detect-template.vue +++ b/src/views/video/detect-template.vue @@ -28,10 +28,10 @@ /> - + @@ -72,8 +72,10 @@ > - - + + + + - - - - + + + + - @@ -139,12 +140,18 @@
- - {{ currentRecord.templateId }} + + {{ currentRecord.taskId }}
+ +
+ + {{ currentRecord.templateId }} +
+
@@ -153,12 +160,20 @@
+
+
{{ currentRecord.statusCode }}
+ +
+ + {{ currentRecord.processingTimeMs }}ms +
+
@@ -202,8 +217,8 @@
- - {{ currentRecord.avatarName }} + + {{ currentRecord.templateName }}
@@ -305,9 +320,9 @@ clearable />
- + @@ -346,7 +361,7 @@ export default { model: 'animate-anyone-template-gen2', ownerName: '', ownerPhone: '', - avatarName: '' + templateName: '' }, uploadLoading: false, detecting: false, @@ -360,13 +375,13 @@ export default { success: '', ownerName: '', ownerPhone: '', - avatarName: '', + templateName: '', createdAtRange: [] } } }, computed: { - ...mapGetters(['name', 'avatar', 'phone']) + ...mapGetters(['name', 'templateName', 'phone']) }, created() { // 设置默认查询参数为当前登录用户信息 @@ -426,12 +441,13 @@ export default { { id: 'weffg', requestId: 'kjklkl;', + taskId: 'task-12345', model: 'aaa', videoUrl: 'http://example.com/video/test.mp4', ownerName: 'dddd', ownerPhone: '158212583', - avatarName: 'qw222', - templateId: '3334sss', + templateName: 'qw222', + templateName: '3334sss', success: false, requestTime: '2025-10-09T14:48:38', responseTime: '2025-10-09T14:48:45', @@ -463,7 +479,7 @@ export default { success: '', ownerName: '', ownerPhone: '', - avatarName: '', + templateName: '', createdAtRange: [] } // 重置后重新设置默认用户信息 @@ -594,7 +610,7 @@ export default { model: 'animate-anyone-template-gen2', ownerName: '', ownerPhone: '', - avatarName: '' + templateName: '' } this.uploadTemplateDialogVisible = true this.$nextTick(() => { @@ -661,7 +677,7 @@ export default { const formData = new FormData() formData.append('file', file) formData.append('model', this.uploadForm.model || 'animate-anyone-template-gen2') - formData.append('avatarName', this.uploadForm.avatarName || '') + formData.append('templateName', this.uploadForm.templateName || '') formData.append('ownerName', this.uploadForm.ownerName || '') formData.append('ownerPhone', this.uploadForm.ownerPhone || '') formData.append('userId', this.$store.getters.userId || '') @@ -671,7 +687,7 @@ export default { file: file.name, type: 'template', model: this.uploadForm.model, - avatarName: this.uploadForm.avatarName, + templateName: this.uploadForm.templateName, ownerName: this.uploadForm.ownerName, ownerPhone: this.uploadForm.ownerPhone }) diff --git a/src/views/video/face-detect.vue b/src/views/video/face-detect.vue index d5e742a..b4542c0 100644 --- a/src/views/video/face-detect.vue +++ b/src/views/video/face-detect.vue @@ -83,19 +83,10 @@ > - + - - - -