feat: male voice ok

This commit is contained in:
2026-01-16 10:55:47 +01:00
parent dc23a9e8a0
commit f947cd194f
+15 -5
View File
@@ -451,7 +451,7 @@ const mergeMusicUrls = async (projectRef, newUrls) => {
let existing = []
try {
existing = sanitizeMusicUrls((await projectRef.get())?.data()?.musicUrls)
} catch (e) {}
} catch (e) { }
const final = [...new Set([...existing, ...sanitized])]
await projectRef.set(
{
@@ -486,9 +486,19 @@ exports.generateMusic = onCall(async ({ data = {} }) => {
// Normalisation input Voix (peut être array, string ou objet selon ta spec)
let voiceData = []
if (Array.isArray(voice)) voiceData = voice
else if (typeof voice === 'object' && voice !== null) voiceData = Object.values(voice).flat()
else if (typeof voice === 'string') voiceData = [voice]
if (Array.isArray(voice)) {
voiceData = voice
.map((v) => {
if (typeof v === 'object' && v !== null && v.value) return v.value
if (typeof v === 'string') return v
return ''
})
.filter(Boolean)
} else if (typeof voice === 'object' && voice !== null) {
voiceData = Object.values(voice).flat()
} else if (typeof voice === 'string') {
voiceData = [voice]
}
// 1. Construction du STYLE MUSICAL (Tags)
const optimizedStyle = buildSunoStyle({
@@ -552,7 +562,7 @@ exports.generateMusic = onCall(async ({ data = {} }) => {
console.error('❌ Erreur generateMusic:', error)
try {
await markProjectMusicFailure(data?.projectId, error)
} catch (e) {}
} catch (e) { }
const status = error?.response?.status || 'INTERNAL_ERROR'
const message = error?.response?.data?.msg || error?.message || 'Erreur Suno'