loader image

Вариант 1

В две колонки
Вертикальный
Горизонтальный
Тур выходного дня
Итого стоимость
Название Итого
"{{getWooProductName}}" вы добавили в свою корзину
Ваш запрос принять
Мы свяжемся с вами!
Выпущено: {{ $store.getters.getIssuedOn }}
Способ оплаты: {{ $store.getters.getPaymentType }}
{{ item.title }}: {{ item.value }}
pixel leon - calculator-test
'; let aiName = '
avatar ai - calculator-test
'; let sysName = 'Система:'; let env = 'chatbot'; let apiKey = ''; let service = 'openai'; let session = 'N/A'; let mode = 'chat'; let model = 'text-curie-001'; let context = isCasuallyFineTuned ? null : 'Общайтесь, как если бы вы были помощником ИИ. Будьте дружелюбны, креативны. Обсуждайте только информацию о клубе: {CONTENT} \nПриглашайте на бесплатную тренировку'; let embeddingsIndex = ''; let promptEnding = ''; let stop = ''; let startSentence = 'Привет! Могу я чем-нибудь помочь?'; let maxSentences = 15; let memorizeChat = false; let maxTokens = 1024; let maxResults = 1; let temperature = 0.6; let typewriter = true; let copyButton = false; let clientId = randomStr(); let memorizedChat = { clientId, messages: [] }; if (isDebugMode) { window.mwai_650c416d31664 = { memorizedChat: memorizedChat, parameters: { mode: mode, model, temperature, maxTokens, context: context, startSentence, isMobile, isWindow, isFullscreen, isCasuallyFineTuned, memorizeChat, maxSentences, rawUserName, rawAiName, embeddingsIndex, typewriter, maxResults, userName, aiName, env, apiKey, service, session } }; } function randomStr() { return Math.random().toString(36).substring(2); } // Set button text function setButtonText() { let input = document.querySelector('#mwai-chat-650c416d31664 .mwai-input textarea'); let button = document.querySelector('#mwai-chat-650c416d31664 .mwai-input button'); let buttonSpan = button.querySelector('span'); if (memorizedChat.messages.length 0.5) { timerElement = document.createElement('div'); timerElement.classList.add('mwai-timer'); element.appendChild(timerElement); } } if (timerElement) { let minutes = Math.floor(timer / 60); let seconds = timer - (minutes * 60); seconds = seconds '; for (var i = 0; i calculator-test'; } text = newText + '
'; } var mwaiClasses = ['mwai-reply']; if (role === 'assistant') { mwaiClasses.push('mwai-ai'); } else if (role === 'system') { mwaiClasses.push('mwai-system'); } else { mwaiClasses.push('mwai-user'); } var div = document.createElement('div'); div.classList.add(...mwaiClasses); var nameSpan = document.createElement('span'); nameSpan.classList.add('mwai-name'); if (role === 'assistant') { nameSpan.innerHTML = aiName; } else if (role === 'system') { nameSpan.innerHTML = sysName; } else { nameSpan.innerHTML = userName; } var textSpan = document.createElement('span'); textSpan.classList.add('mwai-text'); textSpan.innerHTML = text; div.appendChild(nameSpan); div.appendChild(textSpan); // Copy Button if (copyButton && role === 'assistant') { var button = document.createElement('div'); button.classList.add('mwai-copy-button'); var firstElement = document.createElement('div'); firstElement.classList.add('mwai-copy-button-one'); var secondElement = document.createElement('div'); secondElement.classList.add('mwai-copy-button-two'); button.appendChild(firstElement); button.appendChild(secondElement); div.appendChild(button); button.addEventListener('click', function () { try { var content = textSpan.textContent; navigator.clipboard.writeText(content); button.classList.add('mwai-animate'); setTimeout(function () { button.classList.remove('mwai-animate'); }, 1000); } catch (err) { console.warn('Not allowed to copy to clipboard. Make sure your website uses HTTPS.'); } }); } conversation.appendChild(div); if (typewriter) { if (role === 'assistant' && text !== startSentence && !replay) { let typewriter = new Typewriter(textSpan, { deleteSpeed: 50, delay: 25, loop: false, cursor: '', autoStart: true, wrapperClassName: 'mwai-typewriter', }); typewriter.typeString(text).start().callFunction((state) => { state.elements.cursor.setAttribute('hidden', 'hidden'); typewriter.stop(); }); } } conversation.scrollTop = conversation.scrollHeight; setButtonText(); // Syntax coloring if (typeof hljs !== 'undefined') { document.querySelectorAll('pre code').forEach((el) => { hljs.highlightElement(el); }); } } function buildPrompt(last = 15) { let prompt = context ? (context + '\n\n') : ''; memorizedChat.messages = memorizedChat.messages.slice(-last); // Casually fine tuned, let's use the last question if (isCasuallyFineTuned) { let lastLine = memorizedChat.messages[memorizedChat.messages.length - 1]; prompt = lastLine.content + promptEnding; return prompt; } // Otherwise let's compile the latest conversation let conversation = memorizedChat.messages.map(x => x.who + x.content); prompt += conversation.join('\n'); prompt += '\n' + rawAiName; return prompt; } // Function to request the completion function onSendClick() { let input = document.querySelector('#mwai-chat-650c416d31664 .mwai-input textarea'); let inputText = input.value.trim(); // Reset the conversation if empty if (inputText === '') { clientId = randomStr(); document.querySelector('#mwai-chat-650c416d31664 .mwai-conversation').innerHTML = ''; localStorage.removeItem('mwai-chat-650c416d31664') memorizedChat = { clientId: clientId, messages: [] }; memorizedChat.messages.push({ id: randomStr(), role: 'assistant', content: startSentence, who: rawAiName, html: startSentence }); addReply(startSentence, 'assistant'); return; } // Disable the button var button = document.querySelector('#mwai-chat-650c416d31664 .mwai-input button'); button.disabled = true; // Add the user reply memorizedChat.messages.push({ id: randomStr(), role: 'user', content: inputText, who: rawUserName, html: inputText }); addReply(inputText, 'user'); input.value = ''; input.setAttribute('rows', 1); input.disabled = true; let prompt = buildPrompt(maxSentences); const data = mode === 'images' ? { env, session: session, prompt: inputText, newMessage: inputText, model: model, maxResults, apiKey: apiKey, service: service, clientId: clientId, } : { env, session: session, prompt: prompt, context: context, messages: memorizedChat.messages, newMessage: inputText, userName: userName, aiName: aiName, model: model, temperature: temperature, maxTokens: maxTokens, maxResults: 1, apiKey: apiKey, service: service, embeddingsIndex: embeddingsIndex, stop: stop, clientId: clientId, }; // Start the timer const stopTimer = injectTimer(button); // Send the request if (isDebugMode) { console.log('[BOT] Sent: ', data); } fetch(apiURL, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-WP-Nonce': restNonce, }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { if (isDebugMode) { console.log('[BOT] Recv: ', data); } if (!data.success) { addReply(data.message, 'system'); } else { let html = data.images ? data.images : data.html; memorizedChat.messages.push({ id: randomStr(), role: 'assistant', content: data.reply, who: rawAiName, html: html }); addReply(html, 'assistant'); } button.disabled = false; input.disabled = false; stopTimer(); // Only focus only on desktop (to avoid the mobile keyboard to kick-in) if (!isMobile) { input.focus(); } }) .catch(error => { console.error(error); button.disabled = false; input.disabled = false; stopTimer(); }); } // Keep the textarea height in sync with the content function resizeTextArea(ev) { ev.target.style.height = 'auto'; ev.target.style.height = ev.target.scrollHeight + 'px'; } // Keep the textarea height in sync with the content function delayedResizeTextArea(ev) { window.setTimeout(resizeTextArea, 0, event); } // Init the chatbot function initMeowChatbot() { var input = document.querySelector('#mwai-chat-650c416d31664 .mwai-input textarea'); var button = document.querySelector('#mwai-chat-650c416d31664 .mwai-input button'); input.addEventListener('keypress', (event) => { let text = event.target.value; if (event.keyCode === 13 && !text.length && !event.shiftKey) { event.preventDefault(); return; } if (event.keyCode === 13 && text.length && !event.shiftKey) { onSendClick(); } }); input.addEventListener('keydown', (event) => { var rows = input.getAttribute('rows'); if (event.keyCode === 13 && event.shiftKey) { var lines = input.value.split('\n').length + 1; //mwaiSetTextAreaHeight(input, lines); } }); input.addEventListener('keyup', (event) => { var rows = input.getAttribute('rows'); var lines = input.value.split('\n').length ; //mwaiSetTextAreaHeight(input, lines); setButtonText(); }); input.addEventListener('change', resizeTextArea, false); input.addEventListener('cut', delayedResizeTextArea, false); input.addEventListener('paste', delayedResizeTextArea, false); input.addEventListener('drop', delayedResizeTextArea, false); input.addEventListener('keydown', delayedResizeTextArea, false); button.addEventListener('click', (event) => { onSendClick(); }); // If window, add event listener to mwai-open-button and mwai-close-button if ( isWindow ) { var openButton = document.querySelector('#mwai-chat-650c416d31664 .mwai-open-button'); openButton.addEventListener('click', (event) => { var chat = document.querySelector('#mwai-chat-650c416d31664'); chat.classList.add('mwai-open'); // Only focus only on desktop (to avoid the mobile keyboard to kick-in) if (!isMobile) { input.focus(); } }); var closeButton = document.querySelector('#mwai-chat-650c416d31664 .mwai-close-button'); closeButton.addEventListener('click', (event) => { var chat = document.querySelector('#mwai-chat-650c416d31664'); chat.classList.remove('mwai-open'); }); if (isFullscreen) { var resizeButton = document.querySelector('#mwai-chat-650c416d31664 .mwai-resize-button'); resizeButton.addEventListener('click', (event) => { var chat = document.querySelector('#mwai-chat-650c416d31664'); chat.classList.toggle('mwai-fullscreen'); }); } } // Get back the previous chat if any for the same ID var chatHistory = []; if (memorizeChat) { chatHistory = localStorage.getItem('mwai-chat-650c416d31664'); if (chatHistory) { memorizedChat = JSON.parse(chatHistory); if (memorizedChat && memorizedChat.clientId && memorizedChat.messages) { clientId = memorizedChat.clientId; memorizedChat.messages = memorizedChat.messages.filter(x => x && x.html && x.role); memorizedChat.messages.forEach(x => { addReply(x.html, x.role, true); }); } else { memorizedChat = null; } } if (!memorizedChat) { memorizedChat = { clientId: clientId, messages: [] }; } } if (memorizedChat.messages.length === 0) { memorizedChat.messages.push({ id: randomStr(), role: 'assistant', content: startSentence, who: rawAiName, html: startSentence }); addReply(startSentence, 'assistant'); } } // Let's go totally meoooow on this! initMeowChatbot(); })();

Вариант 2

В две колонки
Вертикальный
Горизонтальный
Тур выходного дня (v2)
Примерная стоимость
Название Итого
"{{getWooProductName}}" вы добавили в свою корзину
Ваш запрос принять
Мы свяжемся с вами!
Выпущено: {{ $store.getters.getIssuedOn }}
Способ оплаты: {{ $store.getters.getPaymentType }}
{{ item.title }}: {{ item.value }}
Прайд Волгоград
Прайд Волгоград