diff --git a/pkg/services/umind_agent_service.go b/pkg/services/umind_agent_service.go index bbefc80..b154629 100644 --- a/pkg/services/umind_agent_service.go +++ b/pkg/services/umind_agent_service.go @@ -278,6 +278,13 @@ func ProcessWidgetMessage(agente *models.UmindAgente, sessionID, userText string if s, ok := aiMsg.Content.(string); ok { content = s } + if strings.TrimSpace(content) == "" { + // El AI respondió sin error pero sin texto usable — antes esto se + // perdía en silencio y el visitante recibía el mensaje genérico de + // "dame más detalle" sin ninguna pista de qué pasó. Con .Raw (ver + // agentMessage.UnmarshalJSON) queda el JSON crudo para diagnosticar. + log.Printf("[UMIND] Respuesta del AI sin texto usable (agente %d) round %d: %s", agente.ID, round, string(aiMsg.Raw)) + } finalResponse = content _ = models.SaveUmindMensaje(agente.ID, sessionID, "assistant", content) break @@ -298,6 +305,7 @@ func ProcessWidgetMessage(agente *models.UmindAgente, sessionID, userText string } if finalResponse == "" { + log.Printf("[UMIND] Agente %d: se agotaron las rondas de tool-calling sin una respuesta final", agente.ID) finalResponse = "Un momento, por favor — dame un poco más de detalle sobre lo que necesitas." } return finalResponse, nil