affichage modele chatbot
This commit is contained in:
@ -119,28 +119,41 @@ class ChatbotIA {
|
||||
this.retirerTypingIndicator();
|
||||
|
||||
if (data.error) {
|
||||
this.ajouterMessage(data.message || data.error, 'system');
|
||||
this.ajouterMessage(data.message || data.error, 'system');
|
||||
|
||||
if (data.remaining === 0) {
|
||||
this.helpRemaining = 0;
|
||||
this.updateHelpBadge();
|
||||
setTimeout(() => this.fermerChat(), 3000);
|
||||
}
|
||||
} else {
|
||||
this.ajouterMessage(data.response, 'assistant');
|
||||
this.helpRemaining = data.remaining;
|
||||
this.updateHelpBadge();
|
||||
if (data.remaining === 0) {
|
||||
this.helpRemaining = 0;
|
||||
this.updateHelpBadge();
|
||||
setTimeout(() => this.fermerChat(), 10000); // 10s au lieu de 3s
|
||||
}
|
||||
} else {
|
||||
this.ajouterMessage(data.response, 'assistant');
|
||||
this.helpRemaining = data.remaining;
|
||||
this.updateHelpBadge();
|
||||
|
||||
if (this.helpRemaining === 0) {
|
||||
setTimeout(() => {
|
||||
this.ajouterMessage(
|
||||
'Tu as utilisé toute ton aide pour cette question (3/3). Continue, tu peux le faire ! 💪',
|
||||
'system'
|
||||
);
|
||||
setTimeout(() => this.fermerChat(), 3000);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
// 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).\n\nLe chat se fermera dans 10 secondes. Continue, tu peux le faire ! 💪',
|
||||
'system'
|
||||
);
|
||||
|
||||
// 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();
|
||||
|
||||
Reference in New Issue
Block a user