@adminforth/text-complete 1.8.2 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.log +1 -1
- package/dist/index.js +7 -2
- package/index.ts +7 -6
- package/package.json +4 -1
package/build.log
CHANGED
package/dist/index.js
CHANGED
|
@@ -66,8 +66,13 @@ export default class TextCompletePlugin extends AdminForthPlugin {
|
|
|
66
66
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
67
67
|
if ((_b = this.options.rateLimit) === null || _b === void 0 ? void 0 : _b.limit) {
|
|
68
68
|
// rate limit
|
|
69
|
-
const { error } = RateLimiter.checkRateLimit(
|
|
70
|
-
|
|
69
|
+
// const { error } = RateLimiter.checkRateLimit(
|
|
70
|
+
// this.pluginInstanceId,
|
|
71
|
+
// this.options.rateLimit?.limit,
|
|
72
|
+
// this.adminforth.auth.getClientIp(headers),
|
|
73
|
+
// );
|
|
74
|
+
const rateLimiter = new RateLimiter((_c = this.options.rateLimit) === null || _c === void 0 ? void 0 : _c.limit);
|
|
75
|
+
if (!rateLimiter.consume(`${this.pluginInstanceId}-${this.adminforth.auth.getClientIp(headers)}`)) {
|
|
71
76
|
return {
|
|
72
77
|
completion: [],
|
|
73
78
|
};
|
package/index.ts
CHANGED
|
@@ -80,12 +80,13 @@ export default class TextCompletePlugin extends AdminForthPlugin {
|
|
|
80
80
|
handler: async ({ body, headers }) => {
|
|
81
81
|
if (this.options.rateLimit?.limit) {
|
|
82
82
|
// rate limit
|
|
83
|
-
const { error } = RateLimiter.checkRateLimit(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
);
|
|
88
|
-
|
|
83
|
+
// const { error } = RateLimiter.checkRateLimit(
|
|
84
|
+
// this.pluginInstanceId,
|
|
85
|
+
// this.options.rateLimit?.limit,
|
|
86
|
+
// this.adminforth.auth.getClientIp(headers),
|
|
87
|
+
// );
|
|
88
|
+
const rateLimiter = new RateLimiter(this.options.rateLimit?.limit);
|
|
89
|
+
if (!rateLimiter.consume(`${this.pluginInstanceId}-${this.adminforth.auth.getClientIp(headers)}`)) {
|
|
89
90
|
return {
|
|
90
91
|
completion: [],
|
|
91
92
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/text-complete",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "Text completion plugin for adminforth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -52,5 +52,8 @@
|
|
|
52
52
|
"prerelease": true
|
|
53
53
|
}
|
|
54
54
|
]
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"adminforth": "^2.4.0-next.238"
|
|
55
58
|
}
|
|
56
59
|
}
|