feat: male voice ok
This commit is contained in:
+15
-5
@@ -451,7 +451,7 @@ const mergeMusicUrls = async (projectRef, newUrls) => {
|
|||||||
let existing = []
|
let existing = []
|
||||||
try {
|
try {
|
||||||
existing = sanitizeMusicUrls((await projectRef.get())?.data()?.musicUrls)
|
existing = sanitizeMusicUrls((await projectRef.get())?.data()?.musicUrls)
|
||||||
} catch (e) {}
|
} catch (e) { }
|
||||||
const final = [...new Set([...existing, ...sanitized])]
|
const final = [...new Set([...existing, ...sanitized])]
|
||||||
await projectRef.set(
|
await projectRef.set(
|
||||||
{
|
{
|
||||||
@@ -486,9 +486,19 @@ exports.generateMusic = onCall(async ({ data = {} }) => {
|
|||||||
|
|
||||||
// Normalisation input Voix (peut être array, string ou objet selon ta spec)
|
// Normalisation input Voix (peut être array, string ou objet selon ta spec)
|
||||||
let voiceData = []
|
let voiceData = []
|
||||||
if (Array.isArray(voice)) voiceData = voice
|
if (Array.isArray(voice)) {
|
||||||
else if (typeof voice === 'object' && voice !== null) voiceData = Object.values(voice).flat()
|
voiceData = voice
|
||||||
else if (typeof voice === 'string') 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)
|
// 1. Construction du STYLE MUSICAL (Tags)
|
||||||
const optimizedStyle = buildSunoStyle({
|
const optimizedStyle = buildSunoStyle({
|
||||||
@@ -552,7 +562,7 @@ exports.generateMusic = onCall(async ({ data = {} }) => {
|
|||||||
console.error('❌ Erreur generateMusic:', error)
|
console.error('❌ Erreur generateMusic:', error)
|
||||||
try {
|
try {
|
||||||
await markProjectMusicFailure(data?.projectId, error)
|
await markProjectMusicFailure(data?.projectId, error)
|
||||||
} catch (e) {}
|
} catch (e) { }
|
||||||
|
|
||||||
const status = error?.response?.status || 'INTERNAL_ERROR'
|
const status = error?.response?.status || 'INTERNAL_ERROR'
|
||||||
const message = error?.response?.data?.msg || error?.message || 'Erreur Suno'
|
const message = error?.response?.data?.msg || error?.message || 'Erreur Suno'
|
||||||
|
|||||||
Reference in New Issue
Block a user