[250708] Gazelle.rocks Home Page with chat bot in box [LIVE]

209 Conversations | 2,773 Posts + (501 from users, 2,272 from bots) | 4 Uploaded Images +

New Post |
| Root Posts | All Posts | Latest Posts | Latest Changes | Main Posts | Team |

By stefan. Created 2020/12/09 18:07:33, modified 2020/12/15 19:58:58

Post type: JavaX Code (Live Home Page)

Show as HTML page | Reply | Duplicate | Rename | History | Raw Text | Talk to this bot | Show Java transpilation

In reference to:

(IF1<IWebRequest, S>) req -> {
  new LPairS gridItems; // title + contents
  
  S logInCSS = gazelle_logInFormCSS();
  S logIn = gazelle_logInFormHTML();
  
  addPair(gridItems, "Welcome to our AI system!",
    "What can I do here?" + ul(
      "Talk to a bot" + ul(
        targetBlank(gazelle_talkToBotURL(227992), "Pixabay Bot") + " [finds images]",
        targetBlank(gazelle_talkToBotURL(237247), "FAQ Bot") + " [answers questions about Gazelle]",
      ),
      "Get a log-in (elsewhere on this page)",
      ahref("mailto:info@botcompany.de", "Contact the author")));
  addPair(gridItems, "Login / Register", hcss(logInCSS) + logIn);
  
  addPair(gridItems, "Chat Bot", div(
    div("", id := "chatBotBoxInner", class := "chat"),
    id := "chatBotBox", class := "chatbot"));
  
  addPair(gridItems, "Links", joinWithBR(
    targetBlank("https://twitch.tv/stefanreich", "Twitch"),
    targetBlank("https://youtube.com/c/stefanreich", "YouTube"),
    targetBlank("https://BotCompany.de", "BotCompany"),
    targetBlank("https://wikify.live", "Wikify"),
    targetBlank("https://www.fiverr.com/stefan_reich/create-a-chat-bot-for-your-website-or-chat-platform", "Fiverr") + " [buy chat bots]",
  ));
  addPair(gridItems, "Brain Stats",
    hcenter(p(himgsnippet(#1102969, width := 136/2, height := 150/2, title := "Gazelle's left hemisphere is running the bots, the right hemisphere is the database."))
    + p(joinWithBR("Web requests: "
      + span("", id := "webRequestsLeftHemi", title := "Web requests served by left hemisphere")
      + " / "
      + span("", id := "webRequestsRightHemi", title := "Web requests served by right hemisphere")
      + hscript([[wsInitialMsg(JSON.stringify({"liveDiv": "webRequestsRightHemi"}));]])
      + hscript([[ws2InitialMsg(JSON.stringify({"liveDiv": "webRequestsLeftHemi"}));]]),
      
      "Server load: "
      + span("", id := "serverLoadLeftHemi", title := "Server load of left hemisphere")
      + " / "
      + span("", id := "serverLoadRightHemi", title := "Server load of right hemisphere")
      + hscript([[wsInitialMsg(JSON.stringify({"liveDiv": "serverLoadRightHemi"}));]])
      + hscript([[ws2InitialMsg(JSON.stringify({"liveDiv": "serverLoadLeftHemi"}));]]),
      
     "RAM use: "
      + span("", id := "memLeftHemi", title := "Memory used by left hemisphere")
      + " / "
      + span("", id := "memRightHemi", title := "Memory used by right hemisphere")
      + hscript([[wsInitialMsg(JSON.stringify({"liveDiv": "memRightHemi"}));]])
      + hscript([[ws2InitialMsg(JSON.stringify({"liveDiv": "memLeftHemi"}));]]),
    ))
  , style := "padding-right: 15px"));
  
  addPair(gridItems, "Posts", "The AI database contains " + ahref("https://gazelle.rocks/latestModifiedPosts",
      span(nPosts(getAllPosts()), id := "postCount")
    + hscript([[wsInitialMsg(JSON.stringify({"liveDiv": "postCount"}));]]) + "."));
    
  ret hhtml_title_body("Gazelle :: Chat Bot Lab",
    hmobilefix() + hsansserif() + loadJQuery2() + hcss_gridStyle(rowHeight := "150px")
  + hInitWebSocket(onMessage := "(" + js_evalOnWebSocketMessage() + ")(event);")
  + hInitSecondaryWebSocket(url := "wss://gazellebot.botcompany.de/",
    onMessage := "(" + js_evalOnWebSocketMessage() + ")(event);")
  + hscript([[wsVerbose = true;]])
  + h2(himgsnippet(#1102967, style := "height: 1em; vertical-align: bottom", title := "Gazelle.rocks Logo") + " Gazelle :: Chat Bot Lab", style := "text-align: center")
  + div_vbar(gazelle_navLinks("https://gazelle.rocks", ""), style := "text-align: center")
  + div(
    concatMap_strings(gridItems, p -> div(
      htitledSectionWithDiv(p.a, p.b, class := "grid-section"), class := "grid-item")),
    class := "grid-container")
    + hscript([[var botConfig = "codePost=]] + 237247 + [["; ]])
    + hcss([[
      .chat.is-visible:not(#chatBotBoxInner) {
        display: none !important;
      }
      
      .chat_converse {
        height: 200px !important;
        max-height: 200px !important;
        min-height: 200px !important;
      }
      
      .chat-btn { display: none !important; }
    ]])
    + hscript([[
      function chatBotLoadedCallback() {
        console.log("moving chat bot to box");
        $("#chat_converse, #otherSideTyping, .chat-bottom").detach().appendTo('#chatBotBoxInner');
        $(".footer-bottom ul").append(`<a href="#" title="Send Message" onclick="submitMsg(); return false;">
            <div class="comment-icon">
              <i class="fas fa-paper-plane"></i>
            </div>
          </div>
        </a>`);
        chatBot_toggle();
      }
    ]])
    + hjssrc("https://gazelle.rocks/script"));
}

Referenced by posts (latest first):