v1.8.0: YandexGPT-only NLP, unknown questions system, callback dedup, consent flow fixes, DELETE cascade, UTC+3, auto-detect sidebar menu, tel:/mailto: links
This commit is contained in:
@@ -43,6 +43,7 @@ body { font-family:'Inter','Segoe UI',sans-serif; background:var(--bg-body, #1B2
|
||||
<button onclick="runScenario('consent_no')">Отказ согласия</button>
|
||||
<button onclick="runScenario('question')">Общий вопрос</button>
|
||||
<button onclick="clearTest()">Очистить</button>
|
||||
<button onclick="clearTestData()" style="background:var(--danger,#dc3545) !important;border-color:var(--danger,#dc3545) !important;">Сбросить все тестовые данные</button>
|
||||
</div>
|
||||
<div class="test-container">
|
||||
<div class="test-chat">
|
||||
@@ -134,8 +135,17 @@ function simulateWebhook(type, text){
|
||||
body: JSON.stringify(payload)
|
||||
}).then(function(r){ return r.json() }).then(function(d){
|
||||
log('response', JSON.stringify(d));
|
||||
if(d && d.ok) log('success', 'Событие обработано');
|
||||
else log('error', 'Ошибка: ' + JSON.stringify(d));
|
||||
if(d && d.ok){
|
||||
log('success', 'Событие обработано');
|
||||
if(d.bot_replies && Array.isArray(d.bot_replies)){
|
||||
d.bot_replies.forEach(function(reply){
|
||||
addMessage(reply, 'bot');
|
||||
log('bot_reply', reply.substring(0, 100));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
log('error', 'Ошибка: ' + JSON.stringify(d));
|
||||
}
|
||||
}).catch(function(err){
|
||||
log('error', 'Сетевая ошибка: ' + err);
|
||||
});
|
||||
@@ -146,6 +156,20 @@ function clearTest(){
|
||||
document.getElementById('test-input').value = '';
|
||||
log('info', 'Тест очищен');
|
||||
}
|
||||
function clearTestData(){
|
||||
if(!confirm('Удалить все тестовые диалоги, сообщения и логи обработки? Это действие нельзя отменить.')) return;
|
||||
log('info', 'Очистка тестовых данных...');
|
||||
fetch('/api/bot/test/clear', {method: 'POST'}).then(function(r){ return r.json() }).then(function(d){
|
||||
if(d && d.ok){
|
||||
log('success', 'Тестовые данные удалены (диалогов: ' + (d.deleted || '?') + ')');
|
||||
clearTest();
|
||||
} else {
|
||||
log('error', 'Ошибка: ' + JSON.stringify(d));
|
||||
}
|
||||
}).catch(function(err){
|
||||
log('error', 'Ошибка запроса: ' + err);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user