unknown commited on
Commit
55f2a43
·
1 Parent(s): 4183e02
Files changed (1) hide show
  1. static/js/script.js +4 -3
static/js/script.js CHANGED
@@ -31,10 +31,10 @@ function linkify(inputText) {
31
  replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
32
  replacedText = inputText.replace(replacePattern1, (match) => {
33
  // Check if the URL is an image link
34
- if (match.match(/\.(jpeg|jpg|gif|png)$/) != null) {
35
  return `<img src="${match}" alt="Image" style="max-width:100%;height:auto;">`;
36
  } else {
37
- return `<a href="${match}" target="_blank">here</a>`;
38
  }
39
  });
40
 
@@ -49,6 +49,7 @@ function linkify(inputText) {
49
  return replacedText;
50
  }
51
 
 
52
  const createChatLi = (message, className) => {
53
  const chatLi = document.createElement("li");
54
  chatLi.classList.add("chat", className);
@@ -60,7 +61,7 @@ const createChatLi = (message, className) => {
60
  };
61
 
62
  const generateResponse = (chatElement, typingInterval) => {
63
- const SERVER_URL = "http://127.0.0.1:7860//get-response";
64
  const userId = getUserId();
65
 
66
  fetch(SERVER_URL, {
 
31
  replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
32
  replacedText = inputText.replace(replacePattern1, (match) => {
33
  // Check if the URL is an image link
34
+ if (match.match(/\.(jpeg|jpg|gif|png)$/i) != null) {
35
  return `<img src="${match}" alt="Image" style="max-width:100%;height:auto;">`;
36
  } else {
37
+ return `<a href="${match}" target="_blank">${match}</a>`;
38
  }
39
  });
40
 
 
49
  return replacedText;
50
  }
51
 
52
+
53
  const createChatLi = (message, className) => {
54
  const chatLi = document.createElement("li");
55
  chatLi.classList.add("chat", className);
 
61
  };
62
 
63
  const generateResponse = (chatElement, typingInterval) => {
64
+ const SERVER_URL = "https://dixith-inaswimbot.hf.space//get-response";
65
  const userId = getUserId();
66
 
67
  fetch(SERVER_URL, {