e4b070db by Leff Tubat

Added authorization function for api endpoint

1 parent 2530d769
...@@ -72,8 +72,6 @@ function App() { ...@@ -72,8 +72,6 @@ function App() {
72 } 72 }
73 73
74 // eslint-disable-next-line 74 // eslint-disable-next-line
75 btutil_getChatUsage();
76 // eslint-disable-next-line
77 let maxTokens = btutilCommon_getCookie("mucnxwlyxt"); 75 let maxTokens = btutilCommon_getCookie("mucnxwlyxt");
78 if (maxTokens==='1'){ 76 if (maxTokens==='1'){
79 return; 77 return;
...@@ -134,6 +132,19 @@ function App() { ...@@ -134,6 +132,19 @@ function App() {
134 }); 132 });
135 const data = await response.json(); 133 const data = await response.json();
136 const parsedData = data.message.trim(); 134 const parsedData = data.message.trim();
135
136 if(data.status === 'invalid'){
137 if(data.limited) {
138 window.btutil_modalRegisterUpgrade();
139 return;
140 }
141 if(data && data.status === 'max-tokens') {
142 window.btutil_maxUsage();
143 return;
144 }
145 window.btutil_modalRegisterUpgrade(true);
146 return;
147 }
137 // "gpt-3.5-turbo" 148 // "gpt-3.5-turbo"
138 let chatLogTurboNew = chatLogTurbo; 149 let chatLogTurboNew = chatLogTurbo;
139 let chatLogOpenSourceNew = chatLogOpenSource; 150 let chatLogOpenSourceNew = chatLogOpenSource;
...@@ -144,9 +155,7 @@ function App() { ...@@ -144,9 +155,7 @@ function App() {
144 }); 155 });
145 userModifiedInput = ""; 156 userModifiedInput = "";
146 } 157 }
147 if(data.usage) { 158
148 window.btutil_setChatUsage('chatbot+', data.usage.prompt_tokens, data.usage.total_tokens);
149 }
150 chatLogTurboNew.push({ role: "user", content: userModifiedInput }); 159 chatLogTurboNew.push({ role: "user", content: userModifiedInput });
151 chatLogTurboNew.push({ role: "assistant", content: parsedData }); 160 chatLogTurboNew.push({ role: "assistant", content: parsedData });
152 161
......
1 const { Configuration, OpenAIApi } = require("openai"); 1 const { Configuration, OpenAIApi } = require("openai");
2 const express = require('express') 2 const express = require('express')
3 const bodyParser = require('body-parser') 3 const bodyParser = require('body-parser')
4 const cookieParser = require("cookie-parser")
4 const cors = require('cors') 5 const cors = require('cors')
5 require('dotenv').config() 6 require('dotenv').config()
6 const rateLimit = require('express-rate-limit') 7 const rateLimit = require('express-rate-limit')
8 const fetch = require('node-fetch');
7 const anchorme = require("anchorme").default; 9 const anchorme = require("anchorme").default;
8 const axios = require('axios'); 10 const axios = require('axios');
9 const { encodingForModel } = require('js-tiktoken'); 11 const { encodingForModel } = require('js-tiktoken');
...@@ -68,19 +70,26 @@ app.use(bodyParser.json()) ...@@ -68,19 +70,26 @@ app.use(bodyParser.json())
68 app.use(cors()) 70 app.use(cors())
69 app.use(require('morgan')('dev')) 71 app.use(require('morgan')('dev'))
70 app.use(rateLimiter) 72 app.use(rateLimiter)
73 app.use(cookieParser());
71 74
72 const max_tokens = process.env.MAX_TOKENS_chatbot_plus ? parseInt(process.env.MAX_TOKENS_chatbot_plus) : 512; 75 const max_tokens = process.env.MAX_TOKENS_chatbot_plus ? parseInt(process.env.MAX_TOKENS_chatbot_plus) : 512;
73 // Routing 76 // Routing
74 77 const hostapi = process.env.REACT_APP_HOST_API || "https://api.ai-pro.org";
78 const user_secret_id = process.env.USER_SECRET_ID || "aiwp_logged_in";
79 const aiwp_app_id = "chatbot+";
75 // Primary Open AI Route 80 // Primary Open AI Route
76 app.post('/api', async (req, res) => { 81 app.post('/api', async (req, res) => {
77 if(!req.get('origin') || (!req.get('origin').includes(req.get('host')))) { 82 // if(!req.get('origin') || (!req.get('origin').includes(req.get('host')))) {
78 res.status(401); 83 // res.status(401);
79 res.send('Method Not Allowed'); 84 // res.send('Method Not Allowed');
80 return; 85 // return;
81 } 86 // }
82 const { message, currentModel, temperature } = req.body; 87 const { message, currentModel, temperature } = req.body;
83 88
89 const validate = await validation(aiwp_app_id, req, res);
90 if(!validate) return;
91 const { IS_FREE_USER, aiwp_logged_in, TRIED_USAGE} = validate;
92
84 if (currentModel == "gpt-3.5-turbo" || currentModel == "gpt-3.5-turbo-0301") { 93 if (currentModel == "gpt-3.5-turbo" || currentModel == "gpt-3.5-turbo-0301") {
85 runGPTTurbo(req, res); 94 runGPTTurbo(req, res);
86 return; 95 return;
...@@ -136,10 +145,15 @@ app.post('/api', async (req, res) => { ...@@ -136,10 +145,15 @@ app.post('/api', async (req, res) => {
136 usage.prompt_tokens = (enc.encode(query_prompt)).length; 145 usage.prompt_tokens = (enc.encode(query_prompt)).length;
137 usage.completion_tokens = (enc.encode(input)).length; 146 usage.completion_tokens = (enc.encode(input)).length;
138 usage.total_tokens = usage.prompt_tokens + usage.completion_tokens; 147 usage.total_tokens = usage.prompt_tokens + usage.completion_tokens;
148
139 } catch (e) { 149 } catch (e) {
140 console.log('Error encoding prompt text', e); 150 console.log('Error encoding prompt text', e);
141 } 151 }
142 152 if(IS_FREE_USER) {
153 await setUsage({
154 aiwp_logged_in, app: 'chatbot+', prompt_token: usage.prompt_tokens, total_token: usage.total_tokens, aiwp_app_id, usage_tries: TRIED_USAGE
155 });
156 }
143 res.json({ 157 res.json({
144 usage: usage, 158 usage: usage,
145 message: anchorme({ 159 message: anchorme({
...@@ -303,6 +317,114 @@ async function runOpensource(req, res) { ...@@ -303,6 +317,114 @@ async function runOpensource(req, res) {
303 } 317 }
304 } 318 }
305 319
320 async function authenticate(params) {
321 let data = await fetch(`${hostapi}/e/authenticate/v2`, {
322 method: "POST",
323 headers: {
324 "Content-Type": "application/json"
325 },
326 body: JSON.stringify(params),
327 referrer: "https://api.ai-pro.org"
328 });
329 return await data.json();
330 }
331
332 async function getLimitedUsage(params) {
333 let data = await fetch(`${hostapi}/e/get-usage`, {
334 method: "POST",
335 headers: {
336 "Content-Type": "application/json"
337 },
338 body: JSON.stringify(params),
339 referrer: "https://api.ai-pro.org"
340 });
341 return await data.json();
342 }
343 async function getUsage(params) {
344 let data = await fetch(`${hostapi}/e/get-chat-usage`, {
345 method: "POST",
346 headers: {
347 "Content-Type": "application/json"
348 },
349 body: JSON.stringify(params),
350 referrer: "https://api.ai-pro.org"
351 });
352 return await data.json();
353 }
354 async function setUsage(params) {
355 fetch(`${hostapi}/e/set-usage`, {
356 method: "POST",
357 headers: {
358 "Content-Type": "application/json"
359 },
360 body: JSON.stringify(params),
361 referrer: "https://api.ai-pro.org"
362 });
363 fetch(`${hostapi}/e/set-chat-usage`, {
364 method: "POST",
365 headers: {
366 "Content-Type": "application/json"
367 },
368 body: JSON.stringify(params),
369 referrer: "https://api.ai-pro.org"
370 });
371 }
372
373 async function validation (aiwp_app_id, req, res) {
374 const aiwp_logged_in = req.cookies[user_secret_id] ? decodeURIComponent(req.cookies[user_secret_id]) : "";
375 const limit = req.cookies["WcvYPABR"] ? parseInt(req.cookies["WcvYPABR"].replace(/\D/g, '')) : 3;
376 let IS_FREE_USER = false;
377 let TRIED_USAGE = 0;
378
379 if (aiwp_logged_in) {
380 let auth = await authenticate({ aiwp_logged_in, user_event_data: {}, user_event: 'endpoint' });
381 if (!auth.success) {
382 IS_FREE_USER = true;
383 if (auth.is_restrict) {
384 res.json({ status: "invalid", restrict: true, redirect: auth.redirect });
385 res.end();
386 return false;
387 } else if (typeof auth.has_pro_access === "undefined" && !auth.has_pro_access) {
388 res.json({ status: "invalid", restrict: true });
389 res.end();
390 return false;
391 }
392 }
393 if (!auth.subscription_type || (auth.auth_version === 'v2' && auth.subscription_type.toLowerCase() === 'basic')) {
394 res.json({ status: "invalid" });
395 res.status(200);
396 return false;
397 }
398 let data = await getUsage({
399 aiwp_logged_in, app: 'chatbot+'
400 });
401
402 if (!(data.success === 1 && data.status === 'valid')) {
403 res.json({ status: "invalid", data });
404 res.status(200);
405 return false;
406 }
407 } else {
408 IS_FREE_USER = true;
409 let data = await getLimitedUsage({
410 aiwp_app_id
411 });
412
413 if (data.usage !== null) {
414 TRIED_USAGE = parseInt(data.usage);
415 }
416 return { IS_FREE_USER, aiwp_logged_in, TRIED_USAGE };
417 }
418 if (IS_FREE_USER && TRIED_USAGE >= limit) {
419 res.json({ status: "invalid", limited: true });
420 res.end();
421 return false;
422 }
423 if (IS_FREE_USER) TRIED_USAGE++;
424
425 return { IS_FREE_USER, aiwp_logged_in, TRIED_USAGE };
426 };
427
306 428
307 429
308 // Get Models Route 430 // Get Models Route
......
...@@ -13,16 +13,24 @@ ...@@ -13,16 +13,24 @@
13 "axios": "^1.5.1", 13 "axios": "^1.5.1",
14 "body-parser": "^1.20.1", 14 "body-parser": "^1.20.1",
15 "cookie": "0.5.0", 15 "cookie": "0.5.0",
16 "cookie-parser": "1.4.6", 16 "cookie-parser": "^1.4.6",
17 "cors": "^2.8.5", 17 "cors": "^2.8.5",
18 "dotenv": "^16.0.3", 18 "dotenv": "^16.0.3",
19 "express": "^4.18.2", 19 "express": "^4.18.2",
20 "express-rate-limit": "^6.7.0", 20 "express-rate-limit": "^6.7.0",
21 "js-cookie": "^3.0.5",
21 "js-tiktoken": "1.0.7", 22 "js-tiktoken": "1.0.7",
22 "morgan": "^1.10.0", 23 "morgan": "^1.10.0",
24 "node-fetch": "^2.7.0",
25 "nodemon": "^3.1.0",
23 "openai": "^3.2.0" 26 "openai": "^3.2.0"
24 } 27 }
25 }, 28 },
29 "node_modules/abbrev": {
30 "version": "1.1.1",
31 "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
32 "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
33 },
26 "node_modules/accepts": { 34 "node_modules/accepts": {
27 "version": "1.3.8", 35 "version": "1.3.8",
28 "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", 36 "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
...@@ -40,6 +48,18 @@ ...@@ -40,6 +48,18 @@
40 "resolved": "https://registry.npmjs.org/anchorme/-/anchorme-2.1.2.tgz", 48 "resolved": "https://registry.npmjs.org/anchorme/-/anchorme-2.1.2.tgz",
41 "integrity": "sha512-2iPY3kxDDZvtRzauqKDb4v7a5sTF4GZ+esQTY8nGYvmhAtGTeFPMn4cRnvyWS1qmtPTP0Mv8hyLOp9l3ZzWMKg==" 49 "integrity": "sha512-2iPY3kxDDZvtRzauqKDb4v7a5sTF4GZ+esQTY8nGYvmhAtGTeFPMn4cRnvyWS1qmtPTP0Mv8hyLOp9l3ZzWMKg=="
42 }, 50 },
51 "node_modules/anymatch": {
52 "version": "3.1.3",
53 "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
54 "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
55 "dependencies": {
56 "normalize-path": "^3.0.0",
57 "picomatch": "^2.0.4"
58 },
59 "engines": {
60 "node": ">= 8"
61 }
62 },
43 "node_modules/array-flatten": { 63 "node_modules/array-flatten": {
44 "version": "1.1.1", 64 "version": "1.1.1",
45 "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 65 "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
...@@ -51,15 +71,20 @@ ...@@ -51,15 +71,20 @@
51 "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" 71 "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
52 }, 72 },
53 "node_modules/axios": { 73 "node_modules/axios": {
54 "version": "1.6.2", 74 "version": "1.6.8",
55 "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", 75 "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
56 "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", 76 "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
57 "dependencies": { 77 "dependencies": {
58 "follow-redirects": "^1.15.0", 78 "follow-redirects": "^1.15.6",
59 "form-data": "^4.0.0", 79 "form-data": "^4.0.0",
60 "proxy-from-env": "^1.1.0" 80 "proxy-from-env": "^1.1.0"
61 } 81 }
62 }, 82 },
83 "node_modules/balanced-match": {
84 "version": "1.0.2",
85 "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
86 "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
87 },
63 "node_modules/base64-js": { 88 "node_modules/base64-js": {
64 "version": "1.5.1", 89 "version": "1.5.1",
65 "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", 90 "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
...@@ -95,13 +120,24 @@ ...@@ -95,13 +120,24 @@
95 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 120 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
96 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 121 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
97 }, 122 },
123 "node_modules/binary-extensions": {
124 "version": "2.3.0",
125 "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
126 "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
127 "engines": {
128 "node": ">=8"
129 },
130 "funding": {
131 "url": "https://github.com/sponsors/sindresorhus"
132 }
133 },
98 "node_modules/body-parser": { 134 "node_modules/body-parser": {
99 "version": "1.20.1", 135 "version": "1.20.2",
100 "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", 136 "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
101 "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", 137 "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
102 "dependencies": { 138 "dependencies": {
103 "bytes": "3.1.2", 139 "bytes": "3.1.2",
104 "content-type": "~1.0.4", 140 "content-type": "~1.0.5",
105 "debug": "2.6.9", 141 "debug": "2.6.9",
106 "depd": "2.0.0", 142 "depd": "2.0.0",
107 "destroy": "1.2.0", 143 "destroy": "1.2.0",
...@@ -109,7 +145,7 @@ ...@@ -109,7 +145,7 @@
109 "iconv-lite": "0.4.24", 145 "iconv-lite": "0.4.24",
110 "on-finished": "2.4.1", 146 "on-finished": "2.4.1",
111 "qs": "6.11.0", 147 "qs": "6.11.0",
112 "raw-body": "2.5.1", 148 "raw-body": "2.5.2",
113 "type-is": "~1.6.18", 149 "type-is": "~1.6.18",
114 "unpipe": "1.0.0" 150 "unpipe": "1.0.0"
115 }, 151 },
...@@ -118,6 +154,26 @@ ...@@ -118,6 +154,26 @@
118 "npm": "1.2.8000 || >= 1.4.16" 154 "npm": "1.2.8000 || >= 1.4.16"
119 } 155 }
120 }, 156 },
157 "node_modules/brace-expansion": {
158 "version": "1.1.11",
159 "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
160 "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
161 "dependencies": {
162 "balanced-match": "^1.0.0",
163 "concat-map": "0.0.1"
164 }
165 },
166 "node_modules/braces": {
167 "version": "3.0.2",
168 "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
169 "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
170 "dependencies": {
171 "fill-range": "^7.0.1"
172 },
173 "engines": {
174 "node": ">=8"
175 }
176 },
121 "node_modules/bytes": { 177 "node_modules/bytes": {
122 "version": "3.1.2", 178 "version": "3.1.2",
123 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", 179 "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
...@@ -127,17 +183,46 @@ ...@@ -127,17 +183,46 @@
127 } 183 }
128 }, 184 },
129 "node_modules/call-bind": { 185 "node_modules/call-bind": {
130 "version": "1.0.2", 186 "version": "1.0.7",
131 "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", 187 "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
132 "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", 188 "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
133 "dependencies": { 189 "dependencies": {
134 "function-bind": "^1.1.1", 190 "es-define-property": "^1.0.0",
135 "get-intrinsic": "^1.0.2" 191 "es-errors": "^1.3.0",
192 "function-bind": "^1.1.2",
193 "get-intrinsic": "^1.2.4",
194 "set-function-length": "^1.2.1"
195 },
196 "engines": {
197 "node": ">= 0.4"
136 }, 198 },
137 "funding": { 199 "funding": {
138 "url": "https://github.com/sponsors/ljharb" 200 "url": "https://github.com/sponsors/ljharb"
139 } 201 }
140 }, 202 },
203 "node_modules/chokidar": {
204 "version": "3.6.0",
205 "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
206 "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
207 "dependencies": {
208 "anymatch": "~3.1.2",
209 "braces": "~3.0.2",
210 "glob-parent": "~5.1.2",
211 "is-binary-path": "~2.1.0",
212 "is-glob": "~4.0.1",
213 "normalize-path": "~3.0.0",
214 "readdirp": "~3.6.0"
215 },
216 "engines": {
217 "node": ">= 8.10.0"
218 },
219 "funding": {
220 "url": "https://paulmillr.com/funding/"
221 },
222 "optionalDependencies": {
223 "fsevents": "~2.3.2"
224 }
225 },
141 "node_modules/combined-stream": { 226 "node_modules/combined-stream": {
142 "version": "1.0.8", 227 "version": "1.0.8",
143 "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 228 "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
...@@ -149,6 +234,11 @@ ...@@ -149,6 +234,11 @@
149 "node": ">= 0.8" 234 "node": ">= 0.8"
150 } 235 }
151 }, 236 },
237 "node_modules/concat-map": {
238 "version": "0.0.1",
239 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
240 "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
241 },
152 "node_modules/content-disposition": { 242 "node_modules/content-disposition": {
153 "version": "0.5.4", 243 "version": "0.5.4",
154 "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", 244 "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
...@@ -221,6 +311,22 @@ ...@@ -221,6 +311,22 @@
221 "ms": "2.0.0" 311 "ms": "2.0.0"
222 } 312 }
223 }, 313 },
314 "node_modules/define-data-property": {
315 "version": "1.1.4",
316 "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
317 "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
318 "dependencies": {
319 "es-define-property": "^1.0.0",
320 "es-errors": "^1.3.0",
321 "gopd": "^1.0.1"
322 },
323 "engines": {
324 "node": ">= 0.4"
325 },
326 "funding": {
327 "url": "https://github.com/sponsors/ljharb"
328 }
329 },
224 "node_modules/delayed-stream": { 330 "node_modules/delayed-stream": {
225 "version": "1.0.0", 331 "version": "1.0.0",
226 "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 332 "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
...@@ -247,11 +353,14 @@ ...@@ -247,11 +353,14 @@
247 } 353 }
248 }, 354 },
249 "node_modules/dotenv": { 355 "node_modules/dotenv": {
250 "version": "16.0.3", 356 "version": "16.4.5",
251 "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", 357 "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz",
252 "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", 358 "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==",
253 "engines": { 359 "engines": {
254 "node": ">=12" 360 "node": ">=12"
361 },
362 "funding": {
363 "url": "https://dotenvx.com"
255 } 364 }
256 }, 365 },
257 "node_modules/ee-first": { 366 "node_modules/ee-first": {
...@@ -267,6 +376,25 @@ ...@@ -267,6 +376,25 @@
267 "node": ">= 0.8" 376 "node": ">= 0.8"
268 } 377 }
269 }, 378 },
379 "node_modules/es-define-property": {
380 "version": "1.0.0",
381 "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
382 "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
383 "dependencies": {
384 "get-intrinsic": "^1.2.4"
385 },
386 "engines": {
387 "node": ">= 0.4"
388 }
389 },
390 "node_modules/es-errors": {
391 "version": "1.3.0",
392 "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
393 "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
394 "engines": {
395 "node": ">= 0.4"
396 }
397 },
270 "node_modules/escape-html": { 398 "node_modules/escape-html": {
271 "version": "1.0.3", 399 "version": "1.0.3",
272 "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 400 "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
...@@ -281,16 +409,16 @@ ...@@ -281,16 +409,16 @@
281 } 409 }
282 }, 410 },
283 "node_modules/express": { 411 "node_modules/express": {
284 "version": "4.18.2", 412 "version": "4.19.2",
285 "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", 413 "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz",
286 "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==", 414 "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==",
287 "dependencies": { 415 "dependencies": {
288 "accepts": "~1.3.8", 416 "accepts": "~1.3.8",
289 "array-flatten": "1.1.1", 417 "array-flatten": "1.1.1",
290 "body-parser": "1.20.1", 418 "body-parser": "1.20.2",
291 "content-disposition": "0.5.4", 419 "content-disposition": "0.5.4",
292 "content-type": "~1.0.4", 420 "content-type": "~1.0.4",
293 "cookie": "0.5.0", 421 "cookie": "0.6.0",
294 "cookie-signature": "1.0.6", 422 "cookie-signature": "1.0.6",
295 "debug": "2.6.9", 423 "debug": "2.6.9",
296 "depd": "2.0.0", 424 "depd": "2.0.0",
...@@ -322,9 +450,9 @@ ...@@ -322,9 +450,9 @@
322 } 450 }
323 }, 451 },
324 "node_modules/express-rate-limit": { 452 "node_modules/express-rate-limit": {
325 "version": "6.11.1", 453 "version": "6.11.2",
326 "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.11.1.tgz", 454 "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-6.11.2.tgz",
327 "integrity": "sha512-8+UpWtQY25lJaa4+3WxDBGDcAu4atcTruSs3QSL5VPEplYy6kmk84wutG9rUkkK5LmMQQ7TFHWLZYITwVNbbEg==", 455 "integrity": "sha512-a7uwwfNTh1U60ssiIkuLFWHt4hAC5yxlLGU2VP0X4YNlyEDZAqF4tK3GD3NSitVBrCQmQ0++0uOyFOgC2y4DDw==",
328 "engines": { 456 "engines": {
329 "node": ">= 14" 457 "node": ">= 14"
330 }, 458 },
...@@ -332,6 +460,25 @@ ...@@ -332,6 +460,25 @@
332 "express": "^4 || ^5" 460 "express": "^4 || ^5"
333 } 461 }
334 }, 462 },
463 "node_modules/express/node_modules/cookie": {
464 "version": "0.6.0",
465 "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz",
466 "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==",
467 "engines": {
468 "node": ">= 0.6"
469 }
470 },
471 "node_modules/fill-range": {
472 "version": "7.0.1",
473 "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
474 "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
475 "dependencies": {
476 "to-regex-range": "^5.0.1"
477 },
478 "engines": {
479 "node": ">=8"
480 }
481 },
335 "node_modules/finalhandler": { 482 "node_modules/finalhandler": {
336 "version": "1.2.0", 483 "version": "1.2.0",
337 "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", 484 "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
...@@ -350,9 +497,9 @@ ...@@ -350,9 +497,9 @@
350 } 497 }
351 }, 498 },
352 "node_modules/follow-redirects": { 499 "node_modules/follow-redirects": {
353 "version": "1.15.2", 500 "version": "1.15.6",
354 "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", 501 "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
355 "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", 502 "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
356 "funding": [ 503 "funding": [
357 { 504 {
358 "type": "individual", 505 "type": "individual",
...@@ -397,33 +544,95 @@ ...@@ -397,33 +544,95 @@
397 "node": ">= 0.6" 544 "node": ">= 0.6"
398 } 545 }
399 }, 546 },
547 "node_modules/fsevents": {
548 "version": "2.3.3",
549 "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
550 "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
551 "hasInstallScript": true,
552 "optional": true,
553 "os": [
554 "darwin"
555 ],
556 "engines": {
557 "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
558 }
559 },
400 "node_modules/function-bind": { 560 "node_modules/function-bind": {
401 "version": "1.1.1", 561 "version": "1.1.2",
402 "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", 562 "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
403 "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" 563 "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
564 "funding": {
565 "url": "https://github.com/sponsors/ljharb"
566 }
404 }, 567 },
405 "node_modules/get-intrinsic": { 568 "node_modules/get-intrinsic": {
406 "version": "1.2.0", 569 "version": "1.2.4",
407 "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", 570 "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
408 "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", 571 "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
409 "dependencies": { 572 "dependencies": {
410 "function-bind": "^1.1.1", 573 "es-errors": "^1.3.0",
411 "has": "^1.0.3", 574 "function-bind": "^1.1.2",
412 "has-symbols": "^1.0.3" 575 "has-proto": "^1.0.1",
576 "has-symbols": "^1.0.3",
577 "hasown": "^2.0.0"
578 },
579 "engines": {
580 "node": ">= 0.4"
413 }, 581 },
414 "funding": { 582 "funding": {
415 "url": "https://github.com/sponsors/ljharb" 583 "url": "https://github.com/sponsors/ljharb"
416 } 584 }
417 }, 585 },
418 "node_modules/has": { 586 "node_modules/glob-parent": {
419 "version": "1.0.3", 587 "version": "5.1.2",
420 "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", 588 "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
421 "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", 589 "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
422 "dependencies": { 590 "dependencies": {
423 "function-bind": "^1.1.1" 591 "is-glob": "^4.0.1"
424 }, 592 },
425 "engines": { 593 "engines": {
426 "node": ">= 0.4.0" 594 "node": ">= 6"
595 }
596 },
597 "node_modules/gopd": {
598 "version": "1.0.1",
599 "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
600 "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
601 "dependencies": {
602 "get-intrinsic": "^1.1.3"
603 },
604 "funding": {
605 "url": "https://github.com/sponsors/ljharb"
606 }
607 },
608 "node_modules/has-flag": {
609 "version": "3.0.0",
610 "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
611 "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
612 "engines": {
613 "node": ">=4"
614 }
615 },
616 "node_modules/has-property-descriptors": {
617 "version": "1.0.2",
618 "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
619 "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
620 "dependencies": {
621 "es-define-property": "^1.0.0"
622 },
623 "funding": {
624 "url": "https://github.com/sponsors/ljharb"
625 }
626 },
627 "node_modules/has-proto": {
628 "version": "1.0.3",
629 "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz",
630 "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==",
631 "engines": {
632 "node": ">= 0.4"
633 },
634 "funding": {
635 "url": "https://github.com/sponsors/ljharb"
427 } 636 }
428 }, 637 },
429 "node_modules/has-symbols": { 638 "node_modules/has-symbols": {
...@@ -437,6 +646,17 @@ ...@@ -437,6 +646,17 @@
437 "url": "https://github.com/sponsors/ljharb" 646 "url": "https://github.com/sponsors/ljharb"
438 } 647 }
439 }, 648 },
649 "node_modules/hasown": {
650 "version": "2.0.2",
651 "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
652 "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
653 "dependencies": {
654 "function-bind": "^1.1.2"
655 },
656 "engines": {
657 "node": ">= 0.4"
658 }
659 },
440 "node_modules/http-errors": { 660 "node_modules/http-errors": {
441 "version": "2.0.0", 661 "version": "2.0.0",
442 "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", 662 "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
...@@ -463,6 +683,11 @@ ...@@ -463,6 +683,11 @@
463 "node": ">=0.10.0" 683 "node": ">=0.10.0"
464 } 684 }
465 }, 685 },
686 "node_modules/ignore-by-default": {
687 "version": "1.0.1",
688 "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
689 "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA=="
690 },
466 "node_modules/inherits": { 691 "node_modules/inherits": {
467 "version": "2.0.4", 692 "version": "2.0.4",
468 "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 693 "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
...@@ -476,6 +701,52 @@ ...@@ -476,6 +701,52 @@
476 "node": ">= 0.10" 701 "node": ">= 0.10"
477 } 702 }
478 }, 703 },
704 "node_modules/is-binary-path": {
705 "version": "2.1.0",
706 "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
707 "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
708 "dependencies": {
709 "binary-extensions": "^2.0.0"
710 },
711 "engines": {
712 "node": ">=8"
713 }
714 },
715 "node_modules/is-extglob": {
716 "version": "2.1.1",
717 "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
718 "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
719 "engines": {
720 "node": ">=0.10.0"
721 }
722 },
723 "node_modules/is-glob": {
724 "version": "4.0.3",
725 "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
726 "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
727 "dependencies": {
728 "is-extglob": "^2.1.1"
729 },
730 "engines": {
731 "node": ">=0.10.0"
732 }
733 },
734 "node_modules/is-number": {
735 "version": "7.0.0",
736 "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
737 "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
738 "engines": {
739 "node": ">=0.12.0"
740 }
741 },
742 "node_modules/js-cookie": {
743 "version": "3.0.5",
744 "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz",
745 "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==",
746 "engines": {
747 "node": ">=14"
748 }
749 },
479 "node_modules/js-tiktoken": { 750 "node_modules/js-tiktoken": {
480 "version": "1.0.7", 751 "version": "1.0.7",
481 "resolved": "https://registry.npmjs.org/js-tiktoken/-/js-tiktoken-1.0.7.tgz", 752 "resolved": "https://registry.npmjs.org/js-tiktoken/-/js-tiktoken-1.0.7.tgz",
...@@ -484,6 +755,17 @@ ...@@ -484,6 +755,17 @@
484 "base64-js": "^1.5.1" 755 "base64-js": "^1.5.1"
485 } 756 }
486 }, 757 },
758 "node_modules/lru-cache": {
759 "version": "6.0.0",
760 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
761 "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
762 "dependencies": {
763 "yallist": "^4.0.0"
764 },
765 "engines": {
766 "node": ">=10"
767 }
768 },
487 "node_modules/media-typer": { 769 "node_modules/media-typer": {
488 "version": "0.3.0", 770 "version": "0.3.0",
489 "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 771 "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
...@@ -535,6 +817,17 @@ ...@@ -535,6 +817,17 @@
535 "node": ">= 0.6" 817 "node": ">= 0.6"
536 } 818 }
537 }, 819 },
820 "node_modules/minimatch": {
821 "version": "3.1.2",
822 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
823 "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
824 "dependencies": {
825 "brace-expansion": "^1.1.7"
826 },
827 "engines": {
828 "node": "*"
829 }
830 },
538 "node_modules/morgan": { 831 "node_modules/morgan": {
539 "version": "1.10.0", 832 "version": "1.10.0",
540 "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz", 833 "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz",
...@@ -574,6 +867,95 @@ ...@@ -574,6 +867,95 @@
574 "node": ">= 0.6" 867 "node": ">= 0.6"
575 } 868 }
576 }, 869 },
870 "node_modules/node-fetch": {
871 "version": "2.7.0",
872 "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
873 "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
874 "dependencies": {
875 "whatwg-url": "^5.0.0"
876 },
877 "engines": {
878 "node": "4.x || >=6.0.0"
879 },
880 "peerDependencies": {
881 "encoding": "^0.1.0"
882 },
883 "peerDependenciesMeta": {
884 "encoding": {
885 "optional": true
886 }
887 }
888 },
889 "node_modules/nodemon": {
890 "version": "3.1.0",
891 "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.0.tgz",
892 "integrity": "sha512-xqlktYlDMCepBJd43ZQhjWwMw2obW/JRvkrLxq5RCNcuDDX1DbcPT+qT1IlIIdf+DhnWs90JpTMe+Y5KxOchvA==",
893 "dependencies": {
894 "chokidar": "^3.5.2",
895 "debug": "^4",
896 "ignore-by-default": "^1.0.1",
897 "minimatch": "^3.1.2",
898 "pstree.remy": "^1.1.8",
899 "semver": "^7.5.3",
900 "simple-update-notifier": "^2.0.0",
901 "supports-color": "^5.5.0",
902 "touch": "^3.1.0",
903 "undefsafe": "^2.0.5"
904 },
905 "bin": {
906 "nodemon": "bin/nodemon.js"
907 },
908 "engines": {
909 "node": ">=10"
910 },
911 "funding": {
912 "type": "opencollective",
913 "url": "https://opencollective.com/nodemon"
914 }
915 },
916 "node_modules/nodemon/node_modules/debug": {
917 "version": "4.3.4",
918 "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
919 "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
920 "dependencies": {
921 "ms": "2.1.2"
922 },
923 "engines": {
924 "node": ">=6.0"
925 },
926 "peerDependenciesMeta": {
927 "supports-color": {
928 "optional": true
929 }
930 }
931 },
932 "node_modules/nodemon/node_modules/ms": {
933 "version": "2.1.2",
934 "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
935 "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
936 },
937 "node_modules/nopt": {
938 "version": "1.0.10",
939 "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
940 "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==",
941 "dependencies": {
942 "abbrev": "1"
943 },
944 "bin": {
945 "nopt": "bin/nopt.js"
946 },
947 "engines": {
948 "node": "*"
949 }
950 },
951 "node_modules/normalize-path": {
952 "version": "3.0.0",
953 "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
954 "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
955 "engines": {
956 "node": ">=0.10.0"
957 }
958 },
577 "node_modules/object-assign": { 959 "node_modules/object-assign": {
578 "version": "4.1.1", 960 "version": "4.1.1",
579 "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 961 "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
...@@ -583,9 +965,9 @@ ...@@ -583,9 +965,9 @@
583 } 965 }
584 }, 966 },
585 "node_modules/object-inspect": { 967 "node_modules/object-inspect": {
586 "version": "1.12.3", 968 "version": "1.13.1",
587 "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", 969 "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
588 "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", 970 "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
589 "funding": { 971 "funding": {
590 "url": "https://github.com/sponsors/ljharb" 972 "url": "https://github.com/sponsors/ljharb"
591 } 973 }
...@@ -639,6 +1021,17 @@ ...@@ -639,6 +1021,17 @@
639 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 1021 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
640 "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" 1022 "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
641 }, 1023 },
1024 "node_modules/picomatch": {
1025 "version": "2.3.1",
1026 "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
1027 "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
1028 "engines": {
1029 "node": ">=8.6"
1030 },
1031 "funding": {
1032 "url": "https://github.com/sponsors/jonschlinkert"
1033 }
1034 },
642 "node_modules/proxy-addr": { 1035 "node_modules/proxy-addr": {
643 "version": "2.0.7", 1036 "version": "2.0.7",
644 "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", 1037 "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
...@@ -656,6 +1049,11 @@ ...@@ -656,6 +1049,11 @@
656 "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", 1049 "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
657 "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" 1050 "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
658 }, 1051 },
1052 "node_modules/pstree.remy": {
1053 "version": "1.1.8",
1054 "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
1055 "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w=="
1056 },
659 "node_modules/qs": { 1057 "node_modules/qs": {
660 "version": "6.11.0", 1058 "version": "6.11.0",
661 "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", 1059 "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
...@@ -679,9 +1077,9 @@ ...@@ -679,9 +1077,9 @@
679 } 1077 }
680 }, 1078 },
681 "node_modules/raw-body": { 1079 "node_modules/raw-body": {
682 "version": "2.5.1", 1080 "version": "2.5.2",
683 "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", 1081 "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
684 "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", 1082 "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
685 "dependencies": { 1083 "dependencies": {
686 "bytes": "3.1.2", 1084 "bytes": "3.1.2",
687 "http-errors": "2.0.0", 1085 "http-errors": "2.0.0",
...@@ -692,6 +1090,17 @@ ...@@ -692,6 +1090,17 @@
692 "node": ">= 0.8" 1090 "node": ">= 0.8"
693 } 1091 }
694 }, 1092 },
1093 "node_modules/readdirp": {
1094 "version": "3.6.0",
1095 "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
1096 "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
1097 "dependencies": {
1098 "picomatch": "^2.2.1"
1099 },
1100 "engines": {
1101 "node": ">=8.10.0"
1102 }
1103 },
695 "node_modules/safe-buffer": { 1104 "node_modules/safe-buffer": {
696 "version": "5.2.1", 1105 "version": "5.2.1",
697 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", 1106 "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
...@@ -716,6 +1125,20 @@ ...@@ -716,6 +1125,20 @@
716 "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 1125 "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
717 "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 1126 "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
718 }, 1127 },
1128 "node_modules/semver": {
1129 "version": "7.6.0",
1130 "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz",
1131 "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==",
1132 "dependencies": {
1133 "lru-cache": "^6.0.0"
1134 },
1135 "bin": {
1136 "semver": "bin/semver.js"
1137 },
1138 "engines": {
1139 "node": ">=10"
1140 }
1141 },
719 "node_modules/send": { 1142 "node_modules/send": {
720 "version": "0.18.0", 1143 "version": "0.18.0",
721 "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", 1144 "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
...@@ -758,24 +1181,55 @@ ...@@ -758,24 +1181,55 @@
758 "node": ">= 0.8.0" 1181 "node": ">= 0.8.0"
759 } 1182 }
760 }, 1183 },
1184 "node_modules/set-function-length": {
1185 "version": "1.2.2",
1186 "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
1187 "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
1188 "dependencies": {
1189 "define-data-property": "^1.1.4",
1190 "es-errors": "^1.3.0",
1191 "function-bind": "^1.1.2",
1192 "get-intrinsic": "^1.2.4",
1193 "gopd": "^1.0.1",
1194 "has-property-descriptors": "^1.0.2"
1195 },
1196 "engines": {
1197 "node": ">= 0.4"
1198 }
1199 },
761 "node_modules/setprototypeof": { 1200 "node_modules/setprototypeof": {
762 "version": "1.2.0", 1201 "version": "1.2.0",
763 "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", 1202 "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
764 "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" 1203 "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
765 }, 1204 },
766 "node_modules/side-channel": { 1205 "node_modules/side-channel": {
767 "version": "1.0.4", 1206 "version": "1.0.6",
768 "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", 1207 "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
769 "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", 1208 "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==",
770 "dependencies": { 1209 "dependencies": {
771 "call-bind": "^1.0.0", 1210 "call-bind": "^1.0.7",
772 "get-intrinsic": "^1.0.2", 1211 "es-errors": "^1.3.0",
773 "object-inspect": "^1.9.0" 1212 "get-intrinsic": "^1.2.4",
1213 "object-inspect": "^1.13.1"
1214 },
1215 "engines": {
1216 "node": ">= 0.4"
774 }, 1217 },
775 "funding": { 1218 "funding": {
776 "url": "https://github.com/sponsors/ljharb" 1219 "url": "https://github.com/sponsors/ljharb"
777 } 1220 }
778 }, 1221 },
1222 "node_modules/simple-update-notifier": {
1223 "version": "2.0.0",
1224 "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
1225 "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==",
1226 "dependencies": {
1227 "semver": "^7.5.3"
1228 },
1229 "engines": {
1230 "node": ">=10"
1231 }
1232 },
779 "node_modules/statuses": { 1233 "node_modules/statuses": {
780 "version": "2.0.1", 1234 "version": "2.0.1",
781 "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", 1235 "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
...@@ -784,6 +1238,28 @@ ...@@ -784,6 +1238,28 @@
784 "node": ">= 0.8" 1238 "node": ">= 0.8"
785 } 1239 }
786 }, 1240 },
1241 "node_modules/supports-color": {
1242 "version": "5.5.0",
1243 "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
1244 "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
1245 "dependencies": {
1246 "has-flag": "^3.0.0"
1247 },
1248 "engines": {
1249 "node": ">=4"
1250 }
1251 },
1252 "node_modules/to-regex-range": {
1253 "version": "5.0.1",
1254 "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
1255 "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
1256 "dependencies": {
1257 "is-number": "^7.0.0"
1258 },
1259 "engines": {
1260 "node": ">=8.0"
1261 }
1262 },
787 "node_modules/toidentifier": { 1263 "node_modules/toidentifier": {
788 "version": "1.0.1", 1264 "version": "1.0.1",
789 "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", 1265 "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
...@@ -792,6 +1268,22 @@ ...@@ -792,6 +1268,22 @@
792 "node": ">=0.6" 1268 "node": ">=0.6"
793 } 1269 }
794 }, 1270 },
1271 "node_modules/touch": {
1272 "version": "3.1.0",
1273 "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz",
1274 "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==",
1275 "dependencies": {
1276 "nopt": "~1.0.10"
1277 },
1278 "bin": {
1279 "nodetouch": "bin/nodetouch.js"
1280 }
1281 },
1282 "node_modules/tr46": {
1283 "version": "0.0.3",
1284 "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
1285 "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw=="
1286 },
795 "node_modules/type-is": { 1287 "node_modules/type-is": {
796 "version": "1.6.18", 1288 "version": "1.6.18",
797 "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 1289 "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
...@@ -804,6 +1296,11 @@ ...@@ -804,6 +1296,11 @@
804 "node": ">= 0.6" 1296 "node": ">= 0.6"
805 } 1297 }
806 }, 1298 },
1299 "node_modules/undefsafe": {
1300 "version": "2.0.5",
1301 "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
1302 "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA=="
1303 },
807 "node_modules/unpipe": { 1304 "node_modules/unpipe": {
808 "version": "1.0.0", 1305 "version": "1.0.0",
809 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 1306 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
...@@ -827,6 +1324,25 @@ ...@@ -827,6 +1324,25 @@
827 "engines": { 1324 "engines": {
828 "node": ">= 0.8" 1325 "node": ">= 0.8"
829 } 1326 }
1327 },
1328 "node_modules/webidl-conversions": {
1329 "version": "3.0.1",
1330 "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
1331 "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
1332 },
1333 "node_modules/whatwg-url": {
1334 "version": "5.0.0",
1335 "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
1336 "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
1337 "dependencies": {
1338 "tr46": "~0.0.3",
1339 "webidl-conversions": "^3.0.0"
1340 }
1341 },
1342 "node_modules/yallist": {
1343 "version": "4.0.0",
1344 "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
1345 "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
830 } 1346 }
831 } 1347 }
832 } 1348 }
......
...@@ -5,22 +5,26 @@ ...@@ -5,22 +5,26 @@
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1", 7 "test": "echo \"Error: no test specified\" && exit 1",
8 "start": "node index.js" 8 "start": "node index.js",
9 "dev": "nodemon index.js"
9 }, 10 },
10 "author": "", 11 "author": "",
11 "license": "ISC", 12 "license": "ISC",
12 "dependencies": { 13 "dependencies": {
13 "js-tiktoken": "1.0.7",
14 "anchorme": "^2.1.2", 14 "anchorme": "^2.1.2",
15 "axios": "^1.5.1", 15 "axios": "^1.5.1",
16 "body-parser": "^1.20.1", 16 "body-parser": "^1.20.1",
17 "cookie": "0.5.0", 17 "cookie": "0.5.0",
18 "cookie-parser": "1.4.6", 18 "cookie-parser": "^1.4.6",
19 "cors": "^2.8.5", 19 "cors": "^2.8.5",
20 "dotenv": "^16.0.3", 20 "dotenv": "^16.0.3",
21 "express": "^4.18.2", 21 "express": "^4.18.2",
22 "express-rate-limit": "^6.7.0", 22 "express-rate-limit": "^6.7.0",
23 "js-cookie": "^3.0.5",
24 "js-tiktoken": "1.0.7",
23 "morgan": "^1.10.0", 25 "morgan": "^1.10.0",
26 "node-fetch": "^2.7.0",
27 "nodemon": "^3.1.0",
24 "openai": "^3.2.0" 28 "openai": "^3.2.0"
25 } 29 }
26 } 30 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!