rohan13 commited on
Commit
67e01e2
1 Parent(s): 70e13e2

First message with link

Browse files
Files changed (1) hide show
  1. static/chatbot.js +8 -3
static/chatbot.js CHANGED
@@ -21,9 +21,14 @@ $(document).ready(function() {
21
  }
22
 
23
  // Function to display message
24
- function displayMessage(message, isUser) {
25
  var $message = $('<div>').addClass('chat-message round');
26
- var $messageText = $('<p>').html(message.replace(/(https?:\/\/[^\s,]+)/g, '<a href="$1">$1</a>'));
 
 
 
 
 
27
 
28
  $message.append($messageText);
29
  if (isUser) {
@@ -71,7 +76,7 @@ $(document).ready(function() {
71
  });
72
 
73
  // Initial message
74
- displayMessage('Ask me anything');
75
 
76
  // Function to minimize the widget
77
  function minimizeWidget() {
 
21
  }
22
 
23
  // Function to display message
24
+ function displayMessage(message, isUser, hasHtml) {
25
  var $message = $('<div>').addClass('chat-message round');
26
+ if (hasHtml) {
27
+ $messageText = $('<p>').html(message);
28
+ } else {
29
+ $messageText = $('<p>').html(message.replace(/(https?:\/\/[^\s,]+)/g, '<a href="$1">$1</a>').replace(/(SOURCES:)/, '<br>$1'));
30
+ }
31
+ // var $messageText = $('<p>').html(message.replace(/(https?:\/\/[^\s,]+)/g, '<a href="$1">$1</a>'));
32
 
33
  $message.append($messageText);
34
  if (isUser) {
 
76
  });
77
 
78
  // Initial message
79
+ displayMessage('Learn about <a href="https://makerlab.squarespace.com/">Makerlab</a>');
80
 
81
  // Function to minimize the widget
82
  function minimizeWidget() {