Hansimov commited on
Commit
ff9bd09
β€’
1 Parent(s): 7419aa1

:gem: [Feature] Use local cors-anywhere, and deploy with docker

Browse files
Files changed (4) hide show
  1. .gitignore +1 -0
  2. Dockerfile +17 -0
  3. README.md +3 -3
  4. networks/llm_requester.js +2 -15
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ cors-anywhere
Dockerfile ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:18-slim
2
+ RUN useradd -m -u 1000 user
3
+ USER user
4
+ ENV HOME=/home/user
5
+ ENV PATH=/home/user/.local/bin:$PATH
6
+ WORKDIR $HOME/app
7
+ RUN apg-get update && apg-get install -y git
8
+ RUN git clone https://github.com/Rob--W/cors-anywhere.git cors-anywhere
9
+ COPY cors-anywhere/package.json .
10
+ RUN npm install
11
+ RUN npm install http-server -g
12
+ COPY --chown=user . $HOME/app
13
+ VOLUME /data
14
+ ENV PORT=12349
15
+ RUN node ./cors-anywhere/server.js &
16
+ EXPOSE 12345
17
+ RUN http-server -p 12345
README.md CHANGED
@@ -3,9 +3,9 @@ title: LLM Mixer
3
  emoji: πŸ”€
4
  colorFrom: gray
5
  colorTo: gray
6
- sdk: static
 
7
  ---
8
 
9
  Mirrors:
10
- * https://hansimov-llm-mixer.static.hf.space
11
- * https://hansimov.github.io/llm-mixer/
 
3
  emoji: πŸ”€
4
  colorFrom: gray
5
  colorTo: gray
6
+ sdk: docker
7
+ app_port: 12345
8
  ---
9
 
10
  Mirrors:
11
+ * https://hansimov-llm-mixer.hf.space
 
networks/llm_requester.js CHANGED
@@ -32,24 +32,11 @@ export class ChatCompletionsRequester {
32
  this.temperature =
33
  temperature !== null ? temperature : get_selected_temperature();
34
 
35
- if (this.model.startsWith("bingo")) {
36
- // if this.model is `bingo-precise`, then:
37
- // - this.endpoint: `https://copilot.github1s.tk/api/v1`
38
- // - this.model: `Precise`
39
- this.endpoint = "https://copilot.github1s.tk";
40
- this.mode = this.model.split("-")[1];
41
- this.model =
42
- this.mode.charAt(0).toUpperCase() +
43
- this.mode.slice(1).toLowerCase();
44
- } else {
45
- this.endpoint = endpoint || localStorage.getItem("openai_endpoint");
46
- }
47
  if (cors_proxy !== null) {
48
  this.cors_proxy = cors_proxy;
49
- } else if (window.location.protocol === "https:") {
50
- this.cors_proxy = "https://hansimov-cors.onrender.com/";
51
  } else {
52
- this.cors_proxy = "https://cors-anywhere.herokuapp.com/";
53
  }
54
  this.request_endpoint = concat_urls(
55
  this.cors_proxy,
 
32
  this.temperature =
33
  temperature !== null ? temperature : get_selected_temperature();
34
 
35
+ this.endpoint = endpoint || localStorage.getItem("openai_endpoint");
 
 
 
 
 
 
 
 
 
 
 
36
  if (cors_proxy !== null) {
37
  this.cors_proxy = cors_proxy;
 
 
38
  } else {
39
+ this.cors_proxy = "http://127.0.0.1:12349";
40
  }
41
  this.request_endpoint = concat_urls(
42
  this.cors_proxy,