From 2c0cdf68aa3c0feba3fb2d8a6def53dd249140af Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Mon, 28 Aug 2023 21:12:39 +0300
Subject: [PATCH 1/4] Add robots.txt
---
public/index.html | 1 +
public/robots.txt | 2 ++
2 files changed, 3 insertions(+)
create mode 100644 public/robots.txt
diff --git a/public/index.html b/public/index.html
index d4a3752d8..ddf8bc05c 100644
--- a/public/index.html
+++ b/public/index.html
@@ -7,6 +7,7 @@
+
diff --git a/public/robots.txt b/public/robots.txt
new file mode 100644
index 000000000..1f53798bb
--- /dev/null
+++ b/public/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow: /
From 129e6750241e2ccd194e95eaf2d4cc0b99a856ad Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Wed, 30 Aug 2023 02:25:11 +0300
Subject: [PATCH 2/4] Add packages directly to colab file
---
colab/GPU.ipynb | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/colab/GPU.ipynb b/colab/GPU.ipynb
index a1ab0207d..67479e81f 100644
--- a/colab/GPU.ipynb
+++ b/colab/GPU.ipynb
@@ -116,6 +116,12 @@
"!npm install -g localtunnel\n",
"!pip install -r requirements-complete.txt\n",
"!pip install tensorflow==2.12\n",
+ "!pip install Flask-Cors\n",
+ "!pip install Flask-Compress\n",
+ "!pip install transformers\n",
+ "!pip install Flask_Cloudflared\n",
+ "!pip install webuiapi\n",
+ "!pip install diffusers\n",
"!wget https://github.com/cloudflare/cloudflared/releases/download/2023.5.0/cloudflared-linux-amd64 -O /tmp/cloudflared-linux-amd64\n",
"!chmod +x /tmp/cloudflared-linux-amd64\n",
"\n",
From 87d4c17a9cdd5701156150abb3b1881363cf92b9 Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Wed, 30 Aug 2023 03:08:02 +0300
Subject: [PATCH 3/4] Add more packages to colab directly
---
colab/GPU.ipynb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/colab/GPU.ipynb b/colab/GPU.ipynb
index 67479e81f..19dc5f08a 100644
--- a/colab/GPU.ipynb
+++ b/colab/GPU.ipynb
@@ -122,6 +122,11 @@
"!pip install Flask_Cloudflared\n",
"!pip install webuiapi\n",
"!pip install diffusers\n",
+ "!pip install accelerate\n",
+ "!pip install silero_api_server\n",
+ "!pip install edge_tts\n",
+ "!pip install chromadb\n",
+ "!pip install sentence_transformers\n",
"!wget https://github.com/cloudflare/cloudflared/releases/download/2023.5.0/cloudflared-linux-amd64 -O /tmp/cloudflared-linux-amd64\n",
"!chmod +x /tmp/cloudflared-linux-amd64\n",
"\n",
From 52ae038297e5799ee675123b7ffe3293f062c516 Mon Sep 17 00:00:00 2001
From: Cohee <18619528+Cohee1207@users.noreply.github.com>
Date: Fri, 1 Sep 2023 15:44:41 +0300
Subject: [PATCH 4/4] Add error handling to AI21 tokenization
---
server.js | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/server.js b/server.js
index ef435fd55..309b22fe3 100644
--- a/server.js
+++ b/server.js
@@ -3751,7 +3751,7 @@ async function sendAI21Request(request, response) {
}
-app.post("/tokenize_ai21", jsonParser, function (request, response_tokenize_ai21 = response) {
+app.post("/tokenize_ai21", jsonParser, async function (request, response_tokenize_ai21) {
if (!request.body) return response_tokenize_ai21.sendStatus(400);
const options = {
method: 'POST',
@@ -3763,10 +3763,14 @@ app.post("/tokenize_ai21", jsonParser, function (request, response_tokenize_ai21
body: JSON.stringify({ text: request.body[0].content })
};
- fetch('https://api.ai21.com/studio/v1/tokenize', options)
- .then(response => response.json())
- .then(response => response_tokenize_ai21.send({ "token_count": response.tokens.length }))
- .catch(err => console.error(err));
+ try {
+ const response = await fetch('https://api.ai21.com/studio/v1/tokenize', options);
+ const data = await response.json();
+ return response_tokenize_ai21.send({ "token_count": data?.tokens?.length || 0 });
+ } catch (err) {
+ console.error(err);
+ return response_tokenize_ai21.send({ "token_count": 0 });
+ }
});
app.post("/save_preset", jsonParser, function (request, response) {