affichage modele chatbot

This commit is contained in:
nicoboy
2026-01-03 14:58:04 +01:00
parent 4ab9900d43
commit a98c8bc1c6

View File

@ -124,23 +124,36 @@ class ChatbotIA {
if (data.remaining === 0) {
this.helpRemaining = 0;
this.updateHelpBadge();
setTimeout(() => this.fermerChat(), 3000);
setTimeout(() => this.fermerChat(), 10000); // 10s au lieu de 3s
}
} else {
} else {
this.ajouterMessage(data.response, 'assistant');
this.helpRemaining = data.remaining;
this.updateHelpBadge();
// Afficher info modèle dans console
console.log('✅ Réponse IA -', 'Modèle:', data.modele || 'qwen2-math:1.5b', '- Temps:', data.temps_ms, 'ms');
if (this.helpRemaining === 0) {
setTimeout(() => {
this.ajouterMessage(
'Tu as utilisé toute ton aide pour cette question (3/3). Continue, tu peux le faire ! 💪',
'⚠️ Tu as utilisé toute ton aide pour cette question (3/3).\n\nLe chat se fermera dans 10 secondes. Continue, tu peux le faire ! 💪',
'system'
);
setTimeout(() => this.fermerChat(), 3000);
// Bouton fermeture manuelle
const btnDiv = document.createElement('div');
btnDiv.className = 'message message-system';
btnDiv.style.textAlign = 'center';
btnDiv.innerHTML = '<button onclick="window.chatbot.fermerChat()" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: 600; margin-top: 10px;">✕ Fermer maintenant</button>';
this.chatMessages.appendChild(btnDiv);
this.scrollToBottom();
// Fermeture auto après 10s
setTimeout(() => this.fermerChat(), 10000);
}, 500);
}
}
}
} catch (error) {
console.error('Erreur chatbot:', error);
this.retirerTypingIndicator();