feat(paradizweb): generate preliminary booking doc and return to web chat
This commit is contained in:
@@ -110,6 +110,18 @@
|
||||
if(typingEl && typingEl.parentNode) typingEl.parentNode.removeChild(typingEl);
|
||||
if(data && data.success){
|
||||
addMsg((data.data && data.data.answer) ? data.data.answer : 'Нет ответа', 'bot');
|
||||
const b64 = data?.data?.booking_doc_base64 || '';
|
||||
const name = data?.data?.booking_doc_name || 'booking.docx';
|
||||
if(b64){
|
||||
const a = document.createElement('a');
|
||||
a.href = 'data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,' + b64;
|
||||
a.download = name;
|
||||
a.textContent = '📄 Скачать лист предварительной брони';
|
||||
a.style.display = 'block';
|
||||
a.style.marginBottom = '8px';
|
||||
log.appendChild(a);
|
||||
saveHistory();
|
||||
}
|
||||
} else {
|
||||
addMsg((data && data.data && data.data.message) ? data.data.message : 'Ошибка', 'bot');
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Plugin Name: Paradiz Web Chat
|
||||
* Description: Чат-плагин для сайта vparadize.ru, который отправляет вопросы в изолированного агента OpenClaw paradizweb.
|
||||
* Version: 1.0.7
|
||||
* Version: 1.0.8
|
||||
* Author: EVA
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ class ParadizWebChat {
|
||||
}
|
||||
|
||||
public function enqueue_assets() {
|
||||
wp_register_script('paradiz-web-chat', plugins_url('chat.js', __FILE__), [], '1.0.7', true);
|
||||
wp_register_script('paradiz-web-chat', plugins_url('chat.js', __FILE__), [], '1.0.8', true);
|
||||
wp_localize_script('paradiz-web-chat', 'ParadizWebChatCfg', [
|
||||
'ajaxUrl' => admin_url('admin-ajax.php'),
|
||||
'nonce' => wp_create_nonce('paradiz_web_chat_nonce')
|
||||
@@ -195,7 +195,11 @@ class ParadizWebChat {
|
||||
wp_send_json_error(['message' => $body['error'] ?? 'Ошибка upstream']);
|
||||
}
|
||||
|
||||
wp_send_json_success(['answer' => $body['answer'] ?? '']);
|
||||
wp_send_json_success([
|
||||
'answer' => $body['answer'] ?? '',
|
||||
'booking_doc_name' => $body['booking_doc_name'] ?? '',
|
||||
'booking_doc_base64' => $body['booking_doc_base64'] ?? ''
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user