Hansimov commited on
Commit
4caf84a
1 Parent(s): bc9cd50

:zap: [Feature] Disable cors proxy when hosted in https

Browse files
Files changed (1) hide show
  1. apps/llm_mixer/js/llm_requester.js +6 -1
apps/llm_mixer/js/llm_requester.js CHANGED
@@ -23,7 +23,12 @@ export class ChatCompletionsRequester {
23
  this.temperature =
24
  temperature !== null ? temperature : get_selected_temperature();
25
  this.endpoint = endpoint || localStorage.getItem("openai_endpoint");
26
- this.cors_proxy = cors_proxy || "https://cors-anywhere.herokuapp.com/";
 
 
 
 
 
27
  this.request_endpoint = this.cors_proxy + this.endpoint;
28
  this.controller = new AbortController();
29
  }
 
23
  this.temperature =
24
  temperature !== null ? temperature : get_selected_temperature();
25
  this.endpoint = endpoint || localStorage.getItem("openai_endpoint");
26
+ // if current web page is "https"
27
+ if (window.location.protocol === "https:") {
28
+ this.cors_proxy = "";
29
+ } else {
30
+ this.cors_proxy = "https://cors-anywhere.herokuapp.com/";
31
+ }
32
  this.request_endpoint = this.cors_proxy + this.endpoint;
33
  this.controller = new AbortController();
34
  }