{"id":1616,"date":"2024-08-10T15:08:00","date_gmt":"2024-08-10T15:08:00","guid":{"rendered":"https:\/\/healthdesire.online\/?page_id=1616"},"modified":"2024-08-10T15:29:49","modified_gmt":"2024-08-10T15:29:49","slug":"balkees-test","status":"publish","type":"page","link":"https:\/\/healthdesire.online\/?page_id=1616","title":{"rendered":"Balkees Test"},"content":{"rendered":"<p>sendButton.addEventListener(&lsquo;click&rsquo;, async () => {<br \/>\n    const userMessage = messageInput.value;<br \/>\n    if (!userMessage) return;<\/p>\n<p>    messageInput.value = \u00a0\u00bb;<\/p>\n<p>    chatBox.innerHTML += `<\/p>\n<p><strong>You:<\/strong> ${userMessage}<\/p>\n<p>`;<br \/>\n    chatBox.scrollTop = chatBox.scrollHeight;<\/p>\n<p>    try {<br \/>\n        const response = await fetch(&lsquo;http:\/\/92.112.194.164:5000\/chat&rsquo;, {<br \/>\n            method: &lsquo;POST&rsquo;,<br \/>\n            headers: {<br \/>\n                &lsquo;Content-Type&rsquo;: &lsquo;application\/json&rsquo;<br \/>\n            },<br \/>\n            body: JSON.stringify({ message: userMessage })<br \/>\n        });<\/p>\n<p>        if (!response.ok) throw new Error(&lsquo;Network response was not ok&rsquo;);<\/p>\n<p>        const result = await response.json();<br \/>\n        chatBox.innerHTML += `<\/p>\n<p><strong>Bot:<\/strong> ${result.response}<\/p>\n<p>`;<br \/>\n        chatBox.scrollTop = chatBox.scrollHeight;<br \/>\n    } catch (error) {<br \/>\n        console.error(&lsquo;Error:&rsquo;, error);<br \/>\n        chatBox.innerHTML += `<\/p>\n<p><strong>Bot:<\/strong> Error sending message<\/p>\n<p>`;<br \/>\n        chatBox.scrollTop = chatBox.scrollHeight;<br \/>\n    }<br \/>\n});<\/p>\n","protected":false},"excerpt":{"rendered":"<p>sendButton.addEventListener(&lsquo;click&rsquo;, async () => { const userMessage = messageInput.value; if (!userMessage) return; messageInput.value = \u00a0\u00bb; chatBox.innerHTML += ` You: ${userMessage} `; chatBox.scrollTop = chatBox.scrollHeight; try { const response = await fetch(&lsquo;http:\/\/92.112.194.164:5000\/chat&rsquo;, { method: &lsquo;POST&rsquo;, headers: { &lsquo;Content-Type&rsquo;: &lsquo;application\/json&rsquo; }, body: JSON.stringify({ message: userMessage }) }); if (!response.ok) throw new Error(&lsquo;Network response was not ok&rsquo;); const [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-1616","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/healthdesire.online\/index.php?rest_route=\/wp\/v2\/pages\/1616","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/healthdesire.online\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/healthdesire.online\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/healthdesire.online\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/healthdesire.online\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1616"}],"version-history":[{"count":4,"href":"https:\/\/healthdesire.online\/index.php?rest_route=\/wp\/v2\/pages\/1616\/revisions"}],"predecessor-version":[{"id":1620,"href":"https:\/\/healthdesire.online\/index.php?rest_route=\/wp\/v2\/pages\/1616\/revisions\/1620"}],"wp:attachment":[{"href":"https:\/\/healthdesire.online\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1616"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}