Skip to content

Commit c3ac3c5

Browse files
committed
fix: fix rate limiting
1 parent 6d6a270 commit c3ac3c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
225225
path: `/plugin/${this.pluginInstanceId}/analyze`,
226226
handler: async ({ body, adminUser, headers }) => {
227227
const selectedIds = body.selectedIds || [];
228-
if (typeof(this.options.rateLimits.fillFieldsFromImages) === 'string'){
228+
if (typeof(this.options.rateLimits?.fillFieldsFromImages) === 'string'){
229229
if (this.checkRateLimit("fillFieldsFromImages" ,this.options.rateLimits.fillFieldsFromImages, headers)) {
230230
return { error: "Rate limit exceeded" };
231231
}
@@ -275,7 +275,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
275275
path: `/plugin/${this.pluginInstanceId}/analyze_no_images`,
276276
handler: async ({ body, adminUser, headers }) => {
277277
const selectedIds = body.selectedIds || [];
278-
if (typeof(this.options.rateLimits.fillPlainFields) === 'string'){
278+
if (typeof(this.options.rateLimits?.fillPlainFields) === 'string'){
279279
if (this.checkRateLimit("fillPlainFields", this.options.rateLimits.fillPlainFields, headers)) {
280280
return { error: "Rate limit exceeded" };
281281
}
@@ -461,7 +461,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
461461
handler: async ({ body, headers }) => {
462462
const selectedIds = body.selectedIds || [];
463463
const STUB_MODE = false;
464-
if (typeof(this.options.rateLimits.generateImages) === 'string'){
464+
if (typeof(this.options.rateLimits?.generateImages) === 'string'){
465465
if (this.checkRateLimit("generateImages", this.options.rateLimits.generateImages, headers)) {
466466
return { error: "Rate limit exceeded" };
467467
}

0 commit comments

Comments
 (0)