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