翻译模型

This commit is contained in:
ZLI263
2025-10-12 20:48:29 +08:00
parent 13b71ad1fc
commit 0a8a3ad297
6 changed files with 136 additions and 68 deletions

View File

@@ -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('视频合成任务已提交,请稍后查看结果')