Hansimov commited on
Commit
53b13af
1 Parent(s): 601cff0

:zap: [Enhance] Only loading live.js in local server

Browse files
Files changed (2) hide show
  1. index.html +0 -1
  2. js/main.js +9 -0
index.html CHANGED
@@ -10,7 +10,6 @@
10
  href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
11
  />
12
  <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
13
- <script type="text/javascript" src="./js/common/live.js"></script>
14
  <link
15
  rel="stylesheet"
16
  href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css"
 
10
  href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
11
  />
12
  <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
 
13
  <link
14
  rel="stylesheet"
15
  href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css"
js/main.js CHANGED
@@ -22,6 +22,14 @@ function auto_resize_user_input() {
22
  );
23
  }
24
 
 
 
 
 
 
 
 
 
25
  function setup_interactive_components() {
26
  setup_available_models_on_select();
27
  setup_temperature_on_select();
@@ -85,5 +93,6 @@ function adjust_messagers_container_max_height() {
85
  }
86
 
87
  $(document).ready(function () {
 
88
  setup_interactive_components();
89
  });
 
22
  );
23
  }
24
 
25
+ function load_live_js() {
26
+ if (window.location.protocol !== "https:") {
27
+ var script = document.createElement("script");
28
+ script.src = "./js/common/live.js";
29
+ document.head.appendChild(script);
30
+ }
31
+ }
32
+
33
  function setup_interactive_components() {
34
  setup_available_models_on_select();
35
  setup_temperature_on_select();
 
93
  }
94
 
95
  $(document).ready(function () {
96
+ load_live_js();
97
  setup_interactive_components();
98
  });