:zap: [Feature] Disable cors proxy when hosted in https
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
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 |
}
|