@adminforth/bulk-ai-flow 1.23.10 → 1.23.12

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 CHANGED
@@ -14,5 +14,5 @@ custom/package.json
14
14
  custom/pnpm-lock.yaml
15
15
  custom/tsconfig.json
16
16
 
17
- sent 111,617 bytes received 191 bytes 223,616.00 bytes/sec
18
- total size is 110,903 speedup is 0.99
17
+ sent 111,811 bytes received 191 bytes 224,004.00 bytes/sec
18
+ total size is 111,107 speedup is 0.99
@@ -67,7 +67,8 @@
67
67
  {
68
68
  label: t('Start generation'),
69
69
  options: {
70
- class: 'w-3/5 px-5 py-2.5 bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800 rounded-md text-white border-none'
70
+ class: 'w-3/5 px-5 py-2.5 bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800 rounded-md text-white border-none',
71
+ loader: isCheckingRateLimits
71
72
  },
72
73
  onclick: (dialog) => { runAiActions(); }
73
74
  }
@@ -283,6 +284,7 @@ const completedRecordIds = ref<Set<string>>(new Set());
283
284
  const isActiveGeneration = ref(false);
284
285
  const pauseBreakpoints = computed(() => props.meta.askConfirmation || []);
285
286
  const startedRecordCount = ref(0);
287
+ const isCheckingRateLimits = ref(false);
286
288
  let startGate = Promise.resolve();
287
289
  const tableRef = ref<any>(null);
288
290
  const processedCount = computed(() => {
@@ -383,11 +385,11 @@ async function getListOfIds() {
383
385
 
384
386
 
385
387
  async function runAiActions() {
386
- popupMode.value = 'generation';
387
388
  if (!await checkRateLimits()) {
388
389
  confirmDialog.value.close();
389
390
  return;
390
391
  }
392
+ popupMode.value = 'generation';
391
393
  isGenerationCancelled.value = false;
392
394
  isGenerationPaused.value = false;
393
395
  isActiveGeneration.value = true;
@@ -639,6 +641,7 @@ async function processOneRecord(recordId: string) {
639
641
  }
640
642
 
641
643
  async function checkRateLimits() {
644
+ isCheckingRateLimits.value = true;
642
645
  const actionsToCheck: Array<'generate_images' | 'analyze' | 'analyze_no_images'> = [];
643
646
  if (props.meta.isImageGeneration) {
644
647
  actionsToCheck.push('generate_images');
@@ -670,9 +673,11 @@ async function checkRateLimits() {
670
673
  variant: 'danger',
671
674
  timeout: 'unlimited',
672
675
  });
676
+ isCheckingRateLimits.value = false;
673
677
  return false;
674
678
  }
675
679
  }
680
+ isCheckingRateLimits.value = false;
676
681
  return true;
677
682
  }
678
683
 
@@ -67,7 +67,8 @@
67
67
  {
68
68
  label: t('Start generation'),
69
69
  options: {
70
- class: 'w-3/5 px-5 py-2.5 bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800 rounded-md text-white border-none'
70
+ class: 'w-3/5 px-5 py-2.5 bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:ring-4 focus:outline-none focus:ring-purple-300 dark:focus:ring-purple-800 rounded-md text-white border-none',
71
+ loader: isCheckingRateLimits
71
72
  },
72
73
  onclick: (dialog) => { runAiActions(); }
73
74
  }
@@ -283,6 +284,7 @@ const completedRecordIds = ref<Set<string>>(new Set());
283
284
  const isActiveGeneration = ref(false);
284
285
  const pauseBreakpoints = computed(() => props.meta.askConfirmation || []);
285
286
  const startedRecordCount = ref(0);
287
+ const isCheckingRateLimits = ref(false);
286
288
  let startGate = Promise.resolve();
287
289
  const tableRef = ref<any>(null);
288
290
  const processedCount = computed(() => {
@@ -383,11 +385,11 @@ async function getListOfIds() {
383
385
 
384
386
 
385
387
  async function runAiActions() {
386
- popupMode.value = 'generation';
387
388
  if (!await checkRateLimits()) {
388
389
  confirmDialog.value.close();
389
390
  return;
390
391
  }
392
+ popupMode.value = 'generation';
391
393
  isGenerationCancelled.value = false;
392
394
  isGenerationPaused.value = false;
393
395
  isActiveGeneration.value = true;
@@ -639,6 +641,7 @@ async function processOneRecord(recordId: string) {
639
641
  }
640
642
 
641
643
  async function checkRateLimits() {
644
+ isCheckingRateLimits.value = true;
642
645
  const actionsToCheck: Array<'generate_images' | 'analyze' | 'analyze_no_images'> = [];
643
646
  if (props.meta.isImageGeneration) {
644
647
  actionsToCheck.push('generate_images');
@@ -670,9 +673,11 @@ async function checkRateLimits() {
670
673
  variant: 'danger',
671
674
  timeout: 'unlimited',
672
675
  });
676
+ isCheckingRateLimits.value = false;
673
677
  return false;
674
678
  }
675
679
  }
680
+ isCheckingRateLimits.value = false;
676
681
  return true;
677
682
  }
678
683
 
package/dist/index.js CHANGED
@@ -108,7 +108,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
108
108
  analyze_image(jobId_1, recordId_1, adminUser_1, headers_1, customPrompt_1) {
109
109
  return __awaiter(this, arguments, void 0, function* (jobId, recordId, adminUser, headers, customPrompt, filterFilledFields = true) {
110
110
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
111
- if (yield this.checkRateLimit("fillFieldsFromImages", this.options.rateLimits.fillFieldsFromImages, headers)) {
111
+ if (this.options.rateLimits && this.options.rateLimits.fillFieldsFromImages && (yield this.checkRateLimit("fillFieldsFromImages", this.options.rateLimits.fillFieldsFromImages, headers))) {
112
112
  jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
113
113
  return { error: "Rate limit exceeded" };
114
114
  }
@@ -194,7 +194,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
194
194
  }
195
195
  analyzeNoImages(jobId_1, recordId_1, adminUser_1, headers_1, customPrompt_1) {
196
196
  return __awaiter(this, arguments, void 0, function* (jobId, recordId, adminUser, headers, customPrompt, filterFilledFields = true) {
197
- if (yield this.checkRateLimit("fillPlainFields", this.options.rateLimits.fillPlainFields, headers)) {
197
+ if (this.options.rateLimits && this.options.rateLimits.fillPlainFields && (yield this.checkRateLimit("fillPlainFields", this.options.rateLimits.fillPlainFields, headers))) {
198
198
  jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
199
199
  return { error: "Rate limit exceeded" };
200
200
  }
@@ -257,7 +257,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
257
257
  initialImageGenerate(jobId_1, recordId_1, adminUser_1, headers_1, customPrompt_1) {
258
258
  return __awaiter(this, arguments, void 0, function* (jobId, recordId, adminUser, headers, customPrompt, filterFilledFields = true) {
259
259
  var _a, _b;
260
- if (yield this.checkRateLimit("generateImages", this.options.rateLimits.generateImages, headers)) {
260
+ if (this.options.rateLimits && this.options.rateLimits.generateImages && (yield this.checkRateLimit("generateImages", this.options.rateLimits.generateImages, headers))) {
261
261
  jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
262
262
  return { error: "Rate limit exceeded" };
263
263
  }
package/index.ts CHANGED
@@ -109,7 +109,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
109
109
  }
110
110
 
111
111
  private async analyze_image(jobId: string, recordId: string, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
112
- if (await this.checkRateLimit("fillFieldsFromImages" ,this.options.rateLimits.fillFieldsFromImages, headers)) {
112
+ if (this.options.rateLimits && this.options.rateLimits.fillFieldsFromImages && await this.checkRateLimit("fillFieldsFromImages" ,this.options.rateLimits.fillFieldsFromImages, headers)) {
113
113
  jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
114
114
  return { error: "Rate limit exceeded" };
115
115
  }
@@ -193,7 +193,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
193
193
  }
194
194
 
195
195
  private async analyzeNoImages(jobId: string, recordId: string, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
196
- if (await this.checkRateLimit("fillPlainFields" ,this.options.rateLimits.fillPlainFields, headers)) {
196
+ if (this.options.rateLimits && this.options.rateLimits.fillPlainFields && await this.checkRateLimit("fillPlainFields" ,this.options.rateLimits.fillPlainFields, headers)) {
197
197
  jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
198
198
  return { error: "Rate limit exceeded" };
199
199
  }
@@ -253,7 +253,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
253
253
  }
254
254
 
255
255
  private async initialImageGenerate(jobId: string, recordId: string, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
256
- if (await this.checkRateLimit("generateImages" ,this.options.rateLimits.generateImages, headers)) {
256
+ if (this.options.rateLimits && this.options.rateLimits.generateImages && await this.checkRateLimit("generateImages" ,this.options.rateLimits.generateImages, headers)) {
257
257
  jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
258
258
  return { error: "Rate limit exceeded" };
259
259
  }
@@ -362,7 +362,7 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
362
362
  return { ok: false, error: 'Error during image generation' };
363
363
  }
364
364
  }
365
-
365
+
366
366
  private async regenerateImage(jobId: string, recordId: string, fieldName: string, prompt: string, adminUser: any, headers: Record<string, string | string[] | undefined>) {
367
367
  const Id = recordId;
368
368
  let isError = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/bulk-ai-flow",
3
- "version": "1.23.10",
3
+ "version": "1.23.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },