Spaces:
Runtime error
Runtime error
updated startup message
Browse files- static/chatbot.js +7 -2
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
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
$message.append($messageText);
|
29 |
if (isUser) {
|
|
|
21 |
}
|
22 |
|
23 |
// Function to display message
|
24 |
+
function displayMessage(message, isUser, hasHtml) {
|
25 |
var $message = $('<div>').addClass('chat-message round');
|
26 |
+
var $messageText
|
27 |
+
if (hasHTML) {
|
28 |
+
$messageText = $('<p>').html(message);
|
29 |
+
} else {
|
30 |
+
$messageText = $('<p>').html(message.replace(/(https?:\/\/[^\s]+)/g, '<a href="$1">$1</a>'));
|
31 |
+
}
|
32 |
|
33 |
$message.append($messageText);
|
34 |
if (isUser) {
|