{"id":649,"date":"2025-09-18T18:51:31","date_gmt":"2025-09-18T23:51:31","guid":{"rendered":"http:\/\/129.153.53.180\/?page_id=649"},"modified":"2025-09-18T18:55:19","modified_gmt":"2025-09-18T23:55:19","slug":"test","status":"publish","type":"page","link":"https:\/\/brainwashed.me\/index.php\/test\/","title":{"rendered":"Test"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\" \/>\n  <title>Chat with Deepak<\/title>\n  <style>\n    body { font-family: Arial, sans-serif; background: #f5f5f5; }\n    #chatbox {\n      width: 400px; height: 500px;\n      border: 1px solid #ccc; border-radius: 8px;\n      margin: 40px auto; padding: 10px;\n      background: #fff; display: flex; flex-direction: column;\n    }\n    #messages {\n      flex: 1; overflow-y: auto; margin-bottom: 10px;\n    }\n    .msg { padding: 6px 10px; margin: 4px 0; border-radius: 6px; max-width: 75%; }\n    .user { background: #007bff; color: #fff; margin-left: auto; }\n    .bot { background: #e5e5ea; color: #000; margin-right: auto; }\n    #input-area { display: flex; }\n    #input { flex: 1; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }\n    button { margin-left: 5px; padding: 8px 12px; border: none; background: #007bff; color: #fff; border-radius: 4px; cursor: pointer; }\n    button:hover { background: #0056b3; }\n    \n    \/* Waving dots animation *\/\n    .typing-indicator {\n      background-color: #e5e5ea;\n      padding: 10px;\n      border-radius: 20px;\n      display: inline-block;\n      margin: 4px 0;\n      position: relative;\n      animation: pulse 1.5s infinite;\n    }\n    \n    .typing-indicator span {\n      height: 8px;\n      width: 8px;\n      float: left;\n      margin: 0 2px;\n      background-color: #9E9EA1;\n      display: block;\n      border-radius: 50%;\n      opacity: 0.4;\n    }\n    \n    .typing-indicator span:nth-of-type(1) {\n      animation: fade 1s infinite;\n    }\n    \n    .typing-indicator span:nth-of-type(2) {\n      animation: fade 1s 0.33s infinite;\n    }\n    \n    .typing-indicator span:nth-of-type(3) {\n      animation: fade 1s 0.66s infinite;\n    }\n    \n    @keyframes fade {\n      0% { opacity: 0.4; }\n      50% { opacity: 0.8; }\n      100% { opacity: 0.4; }\n    }\n    \n    @keyframes pulse {\n      0% { transform: scale(1); }\n      15% { transform: scale(1.05); }\n      30% { transform: scale(1); }\n    }\n  <\/style>\n<\/head>\n<body>\n  <div id=\"chatbox\">\n    <div id=\"messages\"><\/div>\n    <div id=\"input-area\">\n      <input id=\"input\" type=\"text\" placeholder=\"Ask anything...\" \/>\n      <button onclick=\"sendMessage()\">Send<\/button>\n    <\/div>\n  <\/div>\n\n  <script>\n    const lambdaUrl = \"https:\/\/2xwr6npajmapahgb37nrmju7km0pflph.lambda-url.us-east-2.on.aws\/\";\n\n    function addMessage(text, sender) {\n      const msg = document.createElement(\"div\");\n      msg.className = \"msg \" + sender;\n      msg.textContent = text;\n      document.getElementById(\"messages\").appendChild(msg);\n      msg.scrollIntoView();\n    }\n    \n    \/\/ Add typing indicator (waving dots)\n    function showTypingIndicator() {\n      const indicator = document.createElement(\"div\");\n      indicator.id = \"typing-indicator\";\n      indicator.className = \"msg bot typing-indicator\";\n      \n      const dots = document.createElement(\"div\");\n      dots.innerHTML = '<span><\/span><span><\/span><span><\/span>';\n      indicator.appendChild(dots);\n      \n      document.getElementById(\"messages\").appendChild(indicator);\n      indicator.scrollIntoView();\n    }\n    \n    \/\/ Remove typing indicator\n    function removeTypingIndicator() {\n      const indicator = document.getElementById(\"typing-indicator\");\n      if (indicator) {\n        indicator.remove();\n      }\n    }\n    \n    \/\/ Fallback UUID generator for browsers without crypto.randomUUID\n    function generateUUID() {\n      if (typeof crypto !== 'undefined' && crypto.randomUUID) {\n        return crypto.randomUUID();\n      }\n      \/\/ Fallback implementation for browsers without crypto.randomUUID\n      return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(\/[xy]\/g, function(c) {\n        const r = Math.random() * 16 | 0;\n        const v = c === 'x' ? r : (r & 0x3 | 0x8);\n        return v.toString(16);\n      });\n    }\n\n    function getSessionId() {\n      let sid = localStorage.getItem(\"chat_session_id\");\n      if (!sid) {\n        sid = generateUUID();\n        localStorage.setItem(\"chat_session_id\", sid);\n      }\n      return sid;\n    }\n\n    async function sendMessage() {\n      const input = document.getElementById(\"input\");\n      const text = input.value.trim();\n      if (!text) return;\n\n      addMessage(text, \"user\");\n      input.value = \"\";\n      \n      \/\/ Show typing indicator\n      showTypingIndicator();\n\n      try {\n        const res = await fetch(lambdaUrl, {\n          method: \"POST\",\n          headers: { \"Content-Type\": \"application\/json\" },\n          body: JSON.stringify({ prompt: text, sessionId: getSessionId() })\n        });\n\n        const data = await res.json();\n        \n        \/\/ Remove typing indicator and show response\n        removeTypingIndicator();\n        addMessage(data.output || \"No response\", \"bot\");\n      } catch (err) {\n        removeTypingIndicator();\n        addMessage(\"Error: \" + err.message, \"bot\");\n      }\n    }\n    \n    \/\/ Allow sending message with Enter key\n    document.getElementById(\"input\").addEventListener(\"keypress\", function(e) {\n      if (e.key === \"Enter\") {\n        sendMessage();\n      }\n    });\n  <\/script>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Chat with Deepak Send<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","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":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","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":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","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-opacity":"","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-opacity":"","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-opacity":"","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-opacity":"","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-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-649","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/brainwashed.me\/index.php\/wp-json\/wp\/v2\/pages\/649","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brainwashed.me\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/brainwashed.me\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/brainwashed.me\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brainwashed.me\/index.php\/wp-json\/wp\/v2\/comments?post=649"}],"version-history":[{"count":2,"href":"https:\/\/brainwashed.me\/index.php\/wp-json\/wp\/v2\/pages\/649\/revisions"}],"predecessor-version":[{"id":652,"href":"https:\/\/brainwashed.me\/index.php\/wp-json\/wp\/v2\/pages\/649\/revisions\/652"}],"wp:attachment":[{"href":"https:\/\/brainwashed.me\/index.php\/wp-json\/wp\/v2\/media?parent=649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}