fix(core): resolucion de multiples bugs criticos de backend y visuales
This commit is contained in:
@ -69,6 +69,7 @@ export default async function handler(req, res) {
|
||||
duracion_objetivo, tono, objetivo,
|
||||
estructura_usada: estructura,
|
||||
instrucciones_extra: instrucciones_extra || null,
|
||||
referencias_ids: referencias_ids.length > 0 ? referencias_ids : (patrones.map ? patrones.map(p => p.id).filter(Boolean) : null),
|
||||
titulo_sugerido: guion.titulo_sugerido,
|
||||
gancho: guion.gancho,
|
||||
desarrollo: guion.desarrollo,
|
||||
|
||||
@ -98,5 +98,9 @@ Genera el guion con EXACTAMENTE este JSON:
|
||||
.replace(/\n?```$/, '')
|
||||
.trim()
|
||||
|
||||
return JSON.parse(jsonLimpio)
|
||||
try {
|
||||
return JSON.parse(jsonLimpio)
|
||||
} catch (err) {
|
||||
throw new Error(`Error parseando JSON de GPT: ${err.message}. Contenido crudo: ${contenido}`)
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ app.get('/api/guiones', async (req, res) => {
|
||||
.from('guiones')
|
||||
.select(`
|
||||
id, niche, sub_niche, plataforma, url_origen,
|
||||
gancho_texto, estructura_narrativa, trigger_emocional,
|
||||
gancho_texto, gancho_tipo, estructura_narrativa, trigger_emocional,
|
||||
tono, score_engagement, score_virabilidad, score_cialdini,
|
||||
fecha_analisis, procesado_ok, error_detalle, vistas, likes, compartidos,
|
||||
tema_principal, resumen_patron
|
||||
@ -41,7 +41,7 @@ app.get('/api/guiones', async (req, res) => {
|
||||
.order('fecha_analisis', { ascending: false })
|
||||
.range(offset, offset + limit - 1)
|
||||
|
||||
if (!todos) query = query.eq('procesado_ok', true)
|
||||
if (todos !== '1' && todos !== 'true') query = query.eq('procesado_ok', true)
|
||||
if (niche) query = query.eq('niche', niche)
|
||||
if (cliente_id) query = query.eq('cliente_id', cliente_id)
|
||||
if (plataforma) query = query.eq('plataforma', plataforma)
|
||||
|
||||
Reference in New Issue
Block a user