{"id":1997,"date":"2024-03-09T16:29:36","date_gmt":"2024-03-09T14:29:36","guid":{"rendered":"https:\/\/digitalrise.art\/?page_id=1997"},"modified":"2024-08-24T15:12:56","modified_gmt":"2024-08-24T12:12:56","slug":"bot","status":"publish","type":"page","link":"https:\/\/digitalrise.art\/?page_id=1997","title":{"rendered":"bot"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1997\" class=\"elementor elementor-1997\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-e22d58a e-flex e-con-boxed e-con e-parent\" data-id=\"e22d58a\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-39a21a2 elementor-widget elementor-widget-html\" data-id=\"39a21a2\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<!DOCTYPE html>\r\n<html lang=\"he\">\r\n<head>\r\n    <meta charset=\"UTF-8\">\r\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n    <title>Interactive Chatbot<\/title>\r\n    <style>\r\n        \/* General styling *\/\r\n        body {\r\n            font-family: Arial, sans-serif;\r\n            display: flex;\r\n            justify-content: center;\r\n            align-items: flex-start;\r\n            min-height: 100vh;\r\n            margin: 0;\r\n            padding: 20px;\r\n            background: url('https:\/\/digitalrise.art\/wp-content\/uploads\/2024\/06\/\u05e2\u05d9\u05e6\u05d5\u05d1-\u05dc\u05dc\u05d0-\u05e9\u05dd-27.png') no-repeat center center fixed;\r\n            background-size: cover;\r\n        }\r\n\r\n        .container {\r\n            background: rgba(255, 255, 255, 0.8);\r\n            border-radius: 20px;\r\n            padding: 20px;\r\n            box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);\r\n            width: 600px;\r\n            transition: height 0.3s ease;\r\n            text-align: center;\r\n        }\r\n\r\n        #bot-visual-container {\r\n            width: 100%;\r\n            height: 600px;\r\n            margin-bottom: 20px;\r\n            position: relative;\r\n        }\r\n\r\n        #voice-visualizer {\r\n            position: absolute;\r\n            width: 100%;\r\n            height: 100%;\r\n            background: url('path_to_your_waveform_image_or_css_generated_effect_here') no-repeat center;\r\n            background-size: contain;\r\n        }\r\n\r\n        #chat-history {\r\n            max-height: 300px;\r\n            overflow-y: auto;\r\n            border: 1px solid #ccc;\r\n            padding: 10px;\r\n            margin-bottom: 20px;\r\n            background: rgba(255, 255, 255, 0.9);\r\n            border-radius: 10px;\r\n            box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);\r\n        }\r\n\r\n        .input-container {\r\n            display: flex;\r\n            flex-direction: column;\r\n            align-items: center;\r\n            gap: 10px;\r\n        }\r\n\r\n        #message-input, #file-input {\r\n            width: 100%;\r\n            max-width: 550px;\r\n            padding: 10px;\r\n            border: 1px solid #ccc;\r\n            border-radius: 10px;\r\n            background: rgba(255, 255, 255, 0.7);\r\n            font-size: 16px;\r\n            color: #333;\r\n        }\r\n\r\n        .styled-button {\r\n            padding: 10px 20px;\r\n            border: none;\r\n            border-radius: 10px;\r\n            background: linear-gradient(45deg, #6b23e0, #a855f7, #d946ef, #f472b6);\r\n            color: white;\r\n            cursor: pointer;\r\n            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);\r\n            transition: transform 0.2s, box-shadow 0.2s;\r\n            font-size: 16px;\r\n            text-shadow: 1px 1px 2px black;\r\n            width: 100%;\r\n            max-width: 200px;\r\n        }\r\n\r\n        .styled-button:hover {\r\n            transform: translateY(-2px);\r\n            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);\r\n        }\r\n\r\n        #thinking-message {\r\n            display: none;\r\n            font-style: italic;\r\n            margin-top: 10px;\r\n            color: green;\r\n            font-weight: bold;\r\n            animation: pulse 1s infinite;\r\n        }\r\n\r\n        @keyframes pulse {\r\n            0% {\r\n                transform: scale(1);\r\n            }\r\n            50% {\r\n                transform: scale(1.1);\r\n            }\r\n            100% {\r\n                transform: scale(1);\r\n            }\r\n        }\r\n\r\n        #history-button {\r\n            position: absolute;\r\n            top: 20px;\r\n            left: 20px;\r\n            padding: 10px;\r\n            border: none;\r\n            border-radius: 10px;\r\n            background: #4a4e69;\r\n            color: white;\r\n            cursor: pointer;\r\n            font-size: 16px;\r\n            text-shadow: 1px 1px 2px black;\r\n            z-index: 101;\r\n        }\r\n\r\n        #history-sidebar {\r\n            position: fixed;\r\n            top: 0;\r\n            left: 0;\r\n            width: 300px;\r\n            height: 100%;\r\n            background: rgba(255, 255, 255, 0.9);\r\n            padding: 20px;\r\n            box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);\r\n            overflow-y: auto;\r\n            display: none;\r\n            z-index: 100;\r\n        }\r\n\r\n        .history-entry {\r\n            margin-bottom: 10px;\r\n            padding: 10px;\r\n            background: rgba(0, 0, 0, 0.1);\r\n            border-radius: 5px;\r\n        }\r\n\r\n        .history-entry button {\r\n            margin-right: 5px;\r\n            padding: 5px 10px;\r\n            border: none;\r\n            border-radius: 5px;\r\n            background: #4a4e69;\r\n            color: white;\r\n            cursor: pointer;\r\n            font-size: 12px;\r\n        }\r\n\r\n        #history-close-button {\r\n            position: absolute;\r\n            top: 10px;\r\n            right: 10px;\r\n            padding: 5px;\r\n            border: none;\r\n            background: #333;\r\n            color: white;\r\n            cursor: pointer;\r\n            font-size: 16px;\r\n        }\r\n\r\n        #stop-speaking-button img {\r\n            width: 20px;\r\n        }\r\n\r\n        @media (max-width: 600px) {\r\n            .container {\r\n                width: 100%;\r\n                padding: 10px;\r\n            }\r\n\r\n            .input-container {\r\n                flex-direction: column;\r\n            }\r\n\r\n            .styled-button {\r\n                max-width: 100%;\r\n            }\r\n        }\r\n    <\/style>\r\n<\/head>\r\n<body>\r\n    <div class=\"container\">\r\n        <div id=\"bot-visual-container\">\r\n            <img decoding=\"async\" src=\"https:\/\/digitalrise.art\/wp-content\/uploads\/2024\/06\/\u05e2\u05d9\u05e6\u05d5\u05d1-\u05dc\u05dc\u05d0-\u05e9\u05dd-30.png\" class=\"bot-image\" alt=\"Bot Character\">\r\n            <div id=\"voice-visualizer\" style=\"display: none;\"><\/div>\r\n        <\/div>\r\n        <div id=\"chat-history\" class=\"chat-history\"><\/div>\r\n        <div id=\"thinking-message\">\u05d4\u05d1\u05d5\u05d8 \u05de\u05d3\u05d1\u05e8...<\/div>\r\n        <div class=\"input-container\">\r\n            <input type=\"text\" id=\"message-input\" placeholder=\"\u05db\u05ea\u05d5\u05d1 \u05d0\u05ea \u05d4\u05d4\u05d5\u05d3\u05e2\u05d4 \u05db\u05d0\u05df...\">\r\n            <input type=\"file\" id=\"file-input\" accept=\".txt, .doc, .docx, .pdf, .xlsx\">\r\n            <button id=\"send-button\" class=\"styled-button\">\u05e9\u05dc\u05d7<\/button>\r\n            <button id=\"record-button\" class=\"styled-button\">\u05d4\u05e7\u05dc\u05d8<\/button>\r\n            <button id=\"camera-button\" class=\"styled-button\">\u05d4\u05e4\u05e2\u05dc \u05de\u05e6\u05dc\u05de\u05d4<\/button>\r\n            <button id=\"continuous-conversation-button\" class=\"styled-button\">\u05e9\u05d9\u05d7\u05d4 \u05e8\u05e6\u05d5\u05e4\u05d4<\/button>\r\n            <button id=\"stop-continuous-conversation-button\" class=\"styled-button\" style=\"display:none;\">\u05e1\u05d9\u05d5\u05dd \u05e9\u05d9\u05d7\u05d4 \u05e8\u05e6\u05d5\u05e4\u05d4<\/button>\r\n            <button id=\"stop-speaking-button\" class=\"styled-button\">\r\n                <img decoding=\"async\" id=\"mic-icon\" src=\"https:\/\/digitalrise.art\/botAi\/mic.png\">\r\n            <\/button>\r\n            <button id=\"continue-speaking-button\" class=\"styled-button\" style=\"display:none;\">\u05d4\u05de\u05e9\u05da \u05d3\u05d9\u05d1\u05d5\u05e8<\/button>\r\n        <\/div>\r\n        <button id=\"history-button\">\u05d4\u05d9\u05e1\u05d8\u05d5\u05e8\u05d9\u05d9\u05ea \u05e9\u05d9\u05d7\u05d4<\/button>\r\n    <\/div>\r\n    <div id=\"history-sidebar\" style=\"display:none;\">\r\n        <button id=\"history-close-button\">&times;<\/button>\r\n        <div id=\"history-entries\"><\/div>\r\n    <\/div>\r\n\r\n    <script>\r\nlet isRecording = false;\r\nlet recognition;\r\nlet audio = null;\r\nlet pausedAudioTime = 0;\r\nlet continuousConversationActive = false;\r\nlet chatMessages = [];\r\nlet currentSpeaker = 'bot';\r\nlet silenceTimeout;\r\n\r\nconst chatHistory = document.getElementById('chat-history');\r\nconst messageInput = document.getElementById('message-input');\r\nconst sendButton = document.getElementById('send-button');\r\nconst recordButton = document.getElementById('record-button');\r\nconst cameraButton = document.getElementById('camera-button');\r\nconst fileInput = document.getElementById('file-input');\r\nconst stopSpeakingButton = document.getElementById('stop-speaking-button');\r\nconst continueSpeakingButton = document.getElementById('continue-speaking-button');\r\nconst thinkingMessage = document.getElementById('thinking-message');\r\nconst continuousConversationButton = document.getElementById('continuous-conversation-button');\r\nconst stopContinuousConversationButton = document.getElementById('stop-continuous-conversation-button');\r\nconst historyButton = document.getElementById('history-button');\r\nconst historySidebar = document.getElementById('history-sidebar');\r\nconst historyEntries = document.getElementById('history-entries');\r\nconst historyCloseButton = document.getElementById('history-close-button');\r\nconst voiceVisualizer = document.getElementById('voice-visualizer');\r\n\r\nsendButton.addEventListener('click', sendMessage);\r\nrecordButton.addEventListener('click', toggleRecording);\r\ncameraButton.addEventListener('click', () => {\r\n    startCamera();\r\n    startContinuousConversation();\r\n});\r\nstopSpeakingButton.addEventListener('click', pauseSpeaking);\r\ncontinueSpeakingButton.addEventListener('click', resumeSpeaking);\r\ncontinuousConversationButton.addEventListener('click', startContinuousConversation);\r\nstopContinuousConversationButton.addEventListener('click', stopContinuousConversation);\r\nhistoryButton.addEventListener('click', toggleHistorySidebar);\r\nhistoryCloseButton.addEventListener('click', closeHistorySidebar);\r\n\r\nfunction sendMessage() {\r\n    if (isRecording) {\r\n        stopRecording(); \r\n    }\r\n    const message = messageInput.value.trim();\r\n    const file = fileInput.files[0];\r\n    if (message || file) {\r\n        displayMessage(message, 'user');\r\n        chatMessages.push({ text: message, sender: 'user' });\r\n        messageInput.value = '';\r\n        fileInput.value = '';\r\n        thinkingMessage.style.display = 'block';\r\n\r\n        const formData = new FormData();\r\n        formData.append('message', message);\r\n        if (file) {\r\n            formData.append('file', file);\r\n        }\r\n\r\n        fetch('https:\/\/digitalrise.art\/botAi\/api.php', {\r\n            method: 'POST',\r\n            body: formData\r\n        })\r\n        .then(response => response.json())\r\n        .then(data => {\r\n            thinkingMessage.style.display = 'none';\r\n            if (data.response) {\r\n                const filteredResponse = data.response.replace(\/\\*\/g, '');\r\n                displayMessage(filteredResponse, 'bot');\r\n                chatMessages.push({ text: filteredResponse, sender: 'bot' });\r\n                if (data.audioContent) {\r\n                    playAudio(data.audioContent);\r\n                } else {\r\n                    speakMessage(filteredResponse);\r\n                }\r\n                saveChatHistory('\u05e9\u05d9\u05d7\u05d4', chatMessages);\r\n            } else if (data.error) {\r\n                console.error('Error:', data.error);\r\n                displayMessage('Error: ' + data.error, 'bot');\r\n            }\r\n        })\r\n        .catch(error => {\r\n            thinkingMessage.style.display = 'none';\r\n            console.error('Fetch error:', error);\r\n            displayMessage('Error: ' + error.message, 'bot');\r\n        });\r\n    } else {\r\n        alert(\"\u05d0\u05e0\u05d0 \u05d4\u05db\u05e0\u05e1 \u05d4\u05d5\u05d3\u05e2\u05d4 \u05d0\u05d5 \u05e7\u05d5\u05d1\u05e5 \u05dc\u05e9\u05dc\u05d9\u05d7\u05d4\");\r\n    }\r\n}\r\n\r\nfunction toggleRecording() {\r\n    if (isRecording) {\r\n        stopRecording();\r\n    } else {\r\n        if (speechSynthesis.speaking) {\r\n            stopSpeaking(); \r\n        }\r\n        startRecording();\r\n    }\r\n}\r\n\r\nfunction startRecording() {\r\n    if (!('webkitSpeechRecognition' in window)) {\r\n        alert('\u05d3\u05e4\u05d3\u05e4\u05df \u05d6\u05d4 \u05d0\u05d9\u05e0\u05d5 \u05ea\u05d5\u05de\u05da \u05d1\u05d4\u05e7\u05dc\u05d8\u05ea \u05e7\u05d5\u05dc.');\r\n        return;\r\n    }\r\n    recognition = new webkitSpeechRecognition();\r\n    recognition.lang = 'he-IL';\r\n    recognition.continuous = true;\r\n    recognition.interimResults = true;\r\n\r\n    recognition.onresult = (event) => {\r\n        clearTimeout(silenceTimeout);\r\n        const transcript = Array.from(event.results)\r\n            .map(result => result[0].transcript)\r\n            .join('');\r\n        messageInput.value = transcript;\r\n        silenceTimeout = setTimeout(() => {\r\n            stopRecording();\r\n            sendMessage();\r\n        }, 3000);\r\n    };\r\n\r\n    recognition.onerror = (event) => {\r\n        console.error('Error during speech recognition:', event.error);\r\n        alert(`Error during speech recognition: ${event.error}`);\r\n        isRecording = false;\r\n        recordButton.textContent = '\u05d4\u05e7\u05dc\u05d8';\r\n    };\r\n\r\n    recognition.onend = () => {\r\n        isRecording = false;\r\n        recordButton.textContent = '\u05d4\u05e7\u05dc\u05d8';\r\n    };\r\n\r\n    recognition.start();\r\n    isRecording = true;\r\n    recordButton.textContent = '\u05e2\u05e6\u05d5\u05e8 \u05d4\u05e7\u05dc\u05d8\u05d4';\r\n}\r\n\r\nfunction stopRecording() {\r\n    if (recognition) {\r\n        recognition.stop();\r\n    }\r\n    isRecording = false;\r\n    recordButton.textContent = '\u05d4\u05e7\u05dc\u05d8';\r\n}\r\n\r\nfunction displayMessage(message, sender) {\r\n    const messageElement = document.createElement('div');\r\n    messageElement.textContent = `${sender === 'user' ? '\u05d0\u05ea\/\u05d4' : '\u05d1\u05d5\u05d8'}: ${message}`;\r\n    chatHistory.appendChild(messageElement);\r\n    chatHistory.scrollTop = chatHistory.scrollHeight;\r\n}\r\n\r\nfunction speakMessage(message) {\r\n    stopSpeaking();\r\n    const filteredMessage = message.replace(\/\\*\/g, '');\r\n    const utterance = new SpeechSynthesisUtterance(filteredMessage);\r\n    utterance.lang = 'he-IL'; \r\n    utterance.voice = speechSynthesis.getVoices().find(voice => voice.lang === 'he-IL' && voice.name.includes('Wavenet') && voice.gender === 'female');\r\n    startVoiceVisualizer();\r\n    speechSynthesis.speak(utterance);\r\n    utterance.onend = () => {\r\n        stopVoiceVisualizer();\r\n        displayPromptForUser();\r\n    };\r\n}\r\n\r\nfunction startVoiceVisualizer() {\r\n    document.querySelector('.bot-image').style.display = 'none';\r\n    voiceVisualizer.style.display = 'block';\r\n    \/\/ Here you can add additional animations or effects to the voice visualizer.\r\n}\r\n\r\nfunction stopVoiceVisualizer() {\r\n    document.querySelector('.bot-image').style.display = 'block';\r\n    voiceVisualizer.style.display = 'none';\r\n}\r\n\r\nfunction displayPromptForUser() {\r\n    const promptMessage = document.createElement('div');\r\n    promptMessage.className = 'prompt-message';\r\n    promptMessage.style.color = 'green';\r\n    promptMessage.style.animation = 'blink 1s infinite';\r\n    promptMessage.textContent = '\u05de\u05d4 \u05ea\u05e8\u05e6\u05d4 \u05dc\u05e9\u05d0\u05d5\u05dc?';\r\n    chatHistory.appendChild(promptMessage);\r\n    chatHistory.scrollTop = chatHistory.scrollHeight;\r\n    startRecording();\r\n}\r\n\r\nfunction playAudio(base64Audio) {\r\n    if (audio) {\r\n        audio.pause();\r\n        audio.currentTime = 0;\r\n    }\r\n    audio = new Audio(`data:audio\/mp3;base64,${base64Audio}`);\r\n    audio.play().catch(error => {\r\n        console.error('Audio playback error:', error);\r\n    });\r\n    audio.onpause = () => pausedAudioTime = audio.currentTime;\r\n}\r\n\r\nfunction pauseSpeaking() {\r\n    speechSynthesis.pause();\r\n    if (audio) {\r\n        audio.pause();\r\n    }\r\n    stopSpeakingButton.style.display = 'none';\r\n    continueSpeakingButton.style.display = 'inline-block';\r\n}\r\n\r\nfunction resumeSpeaking() {\r\n    speechSynthesis.resume();\r\n    if (audio && pausedAudioTime) {\r\n        audio.currentTime = pausedAudioTime;\r\n        audio.play().catch(error => {\r\n            console.error('Audio playback error:', error);\r\n        });\r\n    }\r\n    continueSpeakingButton.style.display = 'none';\r\n    stopSpeakingButton.style.display = 'inline-block';\r\n}\r\n\r\nfunction stopSpeaking() {\r\n    speechSynthesis.cancel();\r\n    if (audio) {\r\n        audio.pause();\r\n        audio.currentTime = 0;\r\n    }\r\n    pausedAudioTime = 0;\r\n    continueSpeakingButton.style.display = 'none';\r\n    stopSpeakingButton.style.display = 'inline-block';\r\n}\r\n\r\nfunction startCamera() {\r\n    const camera = document.getElementById('camera');\r\n    camera.style.display = 'block';\r\n    navigator.mediaDevices.getUserMedia({ video: true })\r\n        .then(stream => {\r\n            camera.srcObject = stream;\r\n        })\r\n        .catch(err => {\r\n            console.error('Error accessing camera: ' + err);\r\n            alert('Error accessing camera: ' + err);\r\n        });\r\n}\r\n\r\nfunction stopCamera() {\r\n    const camera = document.getElementById('camera');\r\n    camera.style.display = 'none';\r\n    if (camera.srcObject) {\r\n        camera.srcObject.getTracks().forEach(track => track.stop());\r\n        camera.srcObject = null;\r\n    }\r\n    stopContinuousConversation();\r\n}\r\n\r\nfunction startContinuousConversation() {\r\n    continuousConversationActive = true;\r\n    continuousConversationButton.style.display = 'none';\r\n    stopContinuousConversationButton.style.display = 'inline-block';\r\n    initiateConversationLoop();\r\n}\r\n\r\nfunction stopContinuousConversation() {\r\n    continuousConversationActive = false;\r\n    stopContinuousConversationButton.style.display = 'none';\r\n    continuousConversationButton.style.display = 'inline-block';\r\n    restoreBotImage();\r\n}\r\n\r\nfunction initiateConversationLoop() {\r\n    if (!continuousConversationActive) return;\r\n\r\n    if (currentSpeaker === 'bot') {\r\n        setTimeout(() => {\r\n            speakMessage('\u05e9\u05dc\u05d5\u05dd! \u05d0\u05d9\u05da \u05d0\u05e0\u05d9 \u05d9\u05db\u05d5\u05dc\u05d4 \u05dc\u05e2\u05d6\u05d5\u05e8 \u05dc\u05da?');\r\n            currentSpeaker = 'user';\r\n        }, 1000);\r\n    }\r\n}\r\n\r\nfunction toggleHistorySidebar() {\r\n    historySidebar.style.display = historySidebar.style.display === 'block' ? 'none' : 'block';\r\n    if (historySidebar.style.display === 'block') {\r\n        loadChatHistory();\r\n    }\r\n}\r\n\r\nfunction closeHistorySidebar() {\r\n    historySidebar.style.display = 'none';\r\n}\r\n\r\nfunction loadChatHistory() {\r\n    fetch('https:\/\/digitalrise.art\/botAi\/load_chat_history.php?action=loadHistory')\r\n        .then(response => response.json())\r\n        .then(data => {\r\n            historyEntries.innerHTML = '';\r\n            if (data.error) {\r\n                historyEntries.innerHTML = `<p>${data.error}<\/p>`;\r\n            } else {\r\n                data.forEach((entry, index) => {\r\n                    const entryDiv = document.createElement('div');\r\n                    entryDiv.className = 'history-entry';\r\n                    entryDiv.innerHTML = `\r\n                        <p><strong>${entry.title}<\/strong> - ${entry.date}<\/p>\r\n                        <button onclick=\"editChatTitle('${entry.index}')\">\u05e2\u05e8\u05d5\u05da<\/button>\r\n                        <button onclick=\"downloadChatAsPDF('${entry.index}')\">\u05d4\u05d5\u05e8\u05d3 \u05db-PDF<\/button>\r\n                        <button onclick=\"deleteChat('${entry.index}')\">\u05de\u05d7\u05e7<\/button>\r\n                        <button onclick=\"continueChat('${entry.index}')\">\u05d4\u05de\u05e9\u05da \u05e9\u05d9\u05d7\u05d4<\/button>\r\n                    `;\r\n                    historyEntries.appendChild(entryDiv);\r\n                });\r\n            }\r\n        })\r\n        .catch(error => console.error('Error loading chat history:', error));\r\n}\r\n\r\nfunction editChatTitle(index) {\r\n    const newTitle = prompt('\u05d4\u05db\u05e0\u05e1 \u05e9\u05dd \u05d7\u05d3\u05e9 \u05dc\u05e9\u05d9\u05d7\u05d4:');\r\n    if (newTitle) {\r\n        fetch(`https:\/\/digitalrise.art\/botAi\/load_chat_history.php?action=editChatTitle&index=${index}&title=${encodeURIComponent(newTitle)}`)\r\n            .then(response => response.json())\r\n            .then(data => {\r\n                if (data.status === 'success') {\r\n                    loadChatHistory();\r\n                } else {\r\n                    alert('\u05e9\u05d2\u05d9\u05d0\u05d4 \u05d1\u05e2\u05e8\u05d9\u05db\u05ea \u05d4\u05e9\u05dd.');\r\n                }\r\n            })\r\n            .catch(error => console.error('Error editing chat title:', error));\r\n    }\r\n}\r\n\r\nfunction downloadChatAsPDF(index) {\r\n    window.location.href = `https:\/\/digitalrise.art\/botAi\/load_chat_history.php?action=exportChatToPDF&index=${index}`;\r\n}\r\n\r\nfunction deleteChat(index) {\r\n    if (confirm('\u05d4\u05d0\u05dd \u05d0\u05ea\u05d4 \u05d1\u05d8\u05d5\u05d7 \u05e9\u05d1\u05e8\u05e6\u05d5\u05e0\u05da \u05dc\u05de\u05d7\u05d5\u05e7 \u05d0\u05ea \u05d4\u05e9\u05d9\u05d7\u05d4 \u05d4\u05d6\u05d5?')) {\r\n        fetch(`https:\/\/digitalrise.art\/botAi\/load_chat_history.php?action=deleteHistory&index=${index}`)\r\n            .then(response => response.json())\r\n            .then(data => {\r\n                if (data.status === 'success') {\r\n                    loadChatHistory();\r\n                } else {\r\n                    alert('\u05e9\u05d2\u05d9\u05d0\u05d4 \u05d1\u05de\u05d7\u05d9\u05e7\u05ea \u05d4\u05e9\u05d9\u05d7\u05d4.');\r\n                }\r\n            })\r\n            .catch(error => console.error('Error deleting chat history:', error));\r\n    }\r\n}\r\n\r\nfunction continueChat(index) {\r\n    fetch(`https:\/\/digitalrise.art\/botAi\/load_chat_history.php?action=continueChat&index=${index}`)\r\n        .then(response => response.json())\r\n        .then(data => {\r\n            if (data.status === 'success') {\r\n                chatMessages = data.content;\r\n                chatMessages.forEach(message => {\r\n                    displayMessage(message.text, message.sender);\r\n                });\r\n            } else {\r\n                alert('\u05e9\u05d2\u05d9\u05d0\u05d4 \u05d1\u05d4\u05de\u05e9\u05da \u05d4\u05e9\u05d9\u05d7\u05d4.');\r\n            }\r\n        })\r\n        .catch(error => console.error('Error continuing chat:', error));\r\n}\r\n\r\nfunction saveChatHistory(title, messages) {\r\n    const chatData = {\r\n        title: title,\r\n        messages: messages\r\n    };\r\n\r\n    fetch('https:\/\/digitalrise.art\/botAi\/load_chat_history.php?action=saveHistory', {\r\n        method: 'POST',\r\n        headers: {\r\n            'Content-Type': 'application\/json'\r\n        },\r\n        body: JSON.stringify(chatData)\r\n    })\r\n    .then(response => response.json())\r\n    .then(data => {\r\n        if (data.status !== 'success') {\r\n            console.error('Error saving chat history:', data.message);\r\n        }\r\n    })\r\n    .catch(error => console.error('Error saving chat history:', error));\r\n}\r\n\r\n    <\/script>\r\n<\/body>\r\n<\/html>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Interactive Chatbot \u05d4\u05d1\u05d5\u05d8 \u05de\u05d3\u05d1\u05e8&#8230; \u05e9\u05dc\u05d7 \u05d4\u05e7\u05dc\u05d8 \u05d4\u05e4\u05e2\u05dc \u05de\u05e6\u05dc\u05de\u05d4 \u05e9\u05d9\u05d7\u05d4 \u05e8\u05e6\u05d5\u05e4\u05d4 \u05e1\u05d9\u05d5\u05dd \u05e9\u05d9\u05d7\u05d4 \u05e8\u05e6\u05d5\u05e4\u05d4 \u05d4\u05de\u05e9\u05da \u05d3\u05d9\u05d1\u05d5\u05e8 \u05d4\u05d9\u05e1\u05d8\u05d5\u05e8\u05d9\u05d9\u05ea \u05e9\u05d9\u05d7\u05d4 &times;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_canvas","meta":{"_eb_attr":"","content-type":"","site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"full-width-container","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-1997","page","type-page","status-publish","hentry"],"ams_acf":[],"_links":{"self":[{"href":"https:\/\/digitalrise.art\/index.php?rest_route=\/wp\/v2\/pages\/1997","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalrise.art\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/digitalrise.art\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/digitalrise.art\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalrise.art\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1997"}],"version-history":[{"count":1909,"href":"https:\/\/digitalrise.art\/index.php?rest_route=\/wp\/v2\/pages\/1997\/revisions"}],"predecessor-version":[{"id":8394,"href":"https:\/\/digitalrise.art\/index.php?rest_route=\/wp\/v2\/pages\/1997\/revisions\/8394"}],"wp:attachment":[{"href":"https:\/\/digitalrise.art\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}