@adminforth/bulk-ai-flow 1.24.1 → 1.24.3
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 +2 -2
- package/custom/VisionAction.vue +36 -33
- package/dist/custom/VisionAction.vue +36 -33
- package/dist/index.js +20 -16
- package/index.ts +20 -16
- package/package.json +1 -1
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,
|
|
18
|
-
total size is 111,
|
|
17
|
+
sent 111,955 bytes received 191 bytes 224,292.00 bytes/sec
|
|
18
|
+
total size is 111,251 speedup is 0.99
|
package/custom/VisionAction.vue
CHANGED
|
@@ -16,31 +16,7 @@
|
|
|
16
16
|
:closable="false"
|
|
17
17
|
:askForCloseConfirmation="popupMode === 'generation' ? true : false"
|
|
18
18
|
:closeConfirmationText="t('Are you sure you want to close without saving?')"
|
|
19
|
-
:buttons="popupMode === 'generation' ? [
|
|
20
|
-
{
|
|
21
|
-
label: checkedCount > 1 ? t('Save fields') : t('Save field'),
|
|
22
|
-
options: {
|
|
23
|
-
disabled: isLoading || checkedCount < 1 || isFetchingRecords || isProcessingAny || isGenerationPaused,
|
|
24
|
-
loader: isLoading, class: 'w-fit'
|
|
25
|
-
},
|
|
26
|
-
onclick: async (dialog) => { await saveData(); dialog.hide(); }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: t('Save current'),
|
|
30
|
-
options: {
|
|
31
|
-
disabled: isLoading || isSavingCurrent || completedRecordIds.size < 1,
|
|
32
|
-
loader: isSavingCurrent, class: 'w-fit'
|
|
33
|
-
},
|
|
34
|
-
onclick: async () => { await saveCurrentGenerated(); }
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: t('Cancel'),
|
|
38
|
-
options: {
|
|
39
|
-
class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
|
|
40
|
-
},
|
|
41
|
-
onclick: (dialog) => confirmDialog.tryToHideModal()
|
|
42
|
-
},
|
|
43
|
-
] : popupMode === 'settings' ? [
|
|
19
|
+
:buttons="popupMode === 'generation' ? generationModeButtons : popupMode === 'settings' ? [
|
|
44
20
|
{
|
|
45
21
|
label: t('Save settings'),
|
|
46
22
|
options: {
|
|
@@ -50,13 +26,6 @@
|
|
|
50
26
|
},
|
|
51
27
|
] :
|
|
52
28
|
[
|
|
53
|
-
// {
|
|
54
|
-
// label: t('Edit prompts'),
|
|
55
|
-
// options: {
|
|
56
|
-
// class: 'w-fit ml-auto'
|
|
57
|
-
// },
|
|
58
|
-
// onclick: (dialog) => { clickSettingsButton(); }
|
|
59
|
-
// },
|
|
60
29
|
{
|
|
61
30
|
label: t('Cancel'),
|
|
62
31
|
options: {
|
|
@@ -105,7 +74,7 @@
|
|
|
105
74
|
:aria-valuemax="totalRecords"
|
|
106
75
|
>
|
|
107
76
|
<div
|
|
108
|
-
class="h-full bg-gradient-to-r from-
|
|
77
|
+
class="h-full bg-gradient-to-r from-lightPrimary/70 via-lightPrimary/80 to-lightPrimary/90 dark:from-darkPrimary/70 dark:via-darkPrimary/80 dark:to-darkPrimary/90 transition-all duration-200 "
|
|
109
78
|
:style="{ width: `${displayedProgressPercent}%` }"
|
|
110
79
|
></div>
|
|
111
80
|
<div class="absolute inset-0 flex items-center justify-center text-sm font-medium text-white drop-shadow">
|
|
@@ -328,6 +297,40 @@ const recordsList = computed(() => {
|
|
|
328
297
|
: recordIds.value;
|
|
329
298
|
return ids.map(id => getOrCreateRecord(id));
|
|
330
299
|
});
|
|
300
|
+
|
|
301
|
+
const generationModeButtons = computed(() => {
|
|
302
|
+
const arrayToReturn = [
|
|
303
|
+
{
|
|
304
|
+
label: checkedCount.value > 1 ? t('Save fields') : t('Save field'),
|
|
305
|
+
options: {
|
|
306
|
+
disabled: isLoading.value || checkedCount.value < 1 || isFetchingRecords.value || isProcessingAny.value || isGenerationPaused.value,
|
|
307
|
+
loader: isLoading.value, class: 'w-fit'
|
|
308
|
+
},
|
|
309
|
+
onclick: async (dialog) => { await saveData(); dialog.hide(); }
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
label: t('Cancel'),
|
|
313
|
+
options: {
|
|
314
|
+
class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
|
|
315
|
+
},
|
|
316
|
+
onclick: (dialog) => confirmDialog.value.tryToHideModal()
|
|
317
|
+
},
|
|
318
|
+
]
|
|
319
|
+
|
|
320
|
+
if (isProcessingAny.value) {
|
|
321
|
+
arrayToReturn.splice(1, 0, {
|
|
322
|
+
label: t('Save processed'),
|
|
323
|
+
options: {
|
|
324
|
+
disabled: isLoading.value || isSavingCurrent.value || completedRecordIds.value.size < 1,
|
|
325
|
+
loader: isSavingCurrent.value, class: 'w-fit'
|
|
326
|
+
},
|
|
327
|
+
onclick: async () => { await saveCurrentGenerated(); }
|
|
328
|
+
})
|
|
329
|
+
}
|
|
330
|
+
return arrayToReturn;
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
|
|
331
334
|
const isSavingCurrent = ref(false);
|
|
332
335
|
function checkIfDialogOpen() {
|
|
333
336
|
return isDialogOpen.value === true;
|
|
@@ -16,31 +16,7 @@
|
|
|
16
16
|
:closable="false"
|
|
17
17
|
:askForCloseConfirmation="popupMode === 'generation' ? true : false"
|
|
18
18
|
:closeConfirmationText="t('Are you sure you want to close without saving?')"
|
|
19
|
-
:buttons="popupMode === 'generation' ? [
|
|
20
|
-
{
|
|
21
|
-
label: checkedCount > 1 ? t('Save fields') : t('Save field'),
|
|
22
|
-
options: {
|
|
23
|
-
disabled: isLoading || checkedCount < 1 || isFetchingRecords || isProcessingAny || isGenerationPaused,
|
|
24
|
-
loader: isLoading, class: 'w-fit'
|
|
25
|
-
},
|
|
26
|
-
onclick: async (dialog) => { await saveData(); dialog.hide(); }
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
label: t('Save current'),
|
|
30
|
-
options: {
|
|
31
|
-
disabled: isLoading || isSavingCurrent || completedRecordIds.size < 1,
|
|
32
|
-
loader: isSavingCurrent, class: 'w-fit'
|
|
33
|
-
},
|
|
34
|
-
onclick: async () => { await saveCurrentGenerated(); }
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
label: t('Cancel'),
|
|
38
|
-
options: {
|
|
39
|
-
class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
|
|
40
|
-
},
|
|
41
|
-
onclick: (dialog) => confirmDialog.tryToHideModal()
|
|
42
|
-
},
|
|
43
|
-
] : popupMode === 'settings' ? [
|
|
19
|
+
:buttons="popupMode === 'generation' ? generationModeButtons : popupMode === 'settings' ? [
|
|
44
20
|
{
|
|
45
21
|
label: t('Save settings'),
|
|
46
22
|
options: {
|
|
@@ -50,13 +26,6 @@
|
|
|
50
26
|
},
|
|
51
27
|
] :
|
|
52
28
|
[
|
|
53
|
-
// {
|
|
54
|
-
// label: t('Edit prompts'),
|
|
55
|
-
// options: {
|
|
56
|
-
// class: 'w-fit ml-auto'
|
|
57
|
-
// },
|
|
58
|
-
// onclick: (dialog) => { clickSettingsButton(); }
|
|
59
|
-
// },
|
|
60
29
|
{
|
|
61
30
|
label: t('Cancel'),
|
|
62
31
|
options: {
|
|
@@ -105,7 +74,7 @@
|
|
|
105
74
|
:aria-valuemax="totalRecords"
|
|
106
75
|
>
|
|
107
76
|
<div
|
|
108
|
-
class="h-full bg-gradient-to-r from-
|
|
77
|
+
class="h-full bg-gradient-to-r from-lightPrimary/70 via-lightPrimary/80 to-lightPrimary/90 dark:from-darkPrimary/70 dark:via-darkPrimary/80 dark:to-darkPrimary/90 transition-all duration-200 "
|
|
109
78
|
:style="{ width: `${displayedProgressPercent}%` }"
|
|
110
79
|
></div>
|
|
111
80
|
<div class="absolute inset-0 flex items-center justify-center text-sm font-medium text-white drop-shadow">
|
|
@@ -328,6 +297,40 @@ const recordsList = computed(() => {
|
|
|
328
297
|
: recordIds.value;
|
|
329
298
|
return ids.map(id => getOrCreateRecord(id));
|
|
330
299
|
});
|
|
300
|
+
|
|
301
|
+
const generationModeButtons = computed(() => {
|
|
302
|
+
const arrayToReturn = [
|
|
303
|
+
{
|
|
304
|
+
label: checkedCount.value > 1 ? t('Save fields') : t('Save field'),
|
|
305
|
+
options: {
|
|
306
|
+
disabled: isLoading.value || checkedCount.value < 1 || isFetchingRecords.value || isProcessingAny.value || isGenerationPaused.value,
|
|
307
|
+
loader: isLoading.value, class: 'w-fit'
|
|
308
|
+
},
|
|
309
|
+
onclick: async (dialog) => { await saveData(); dialog.hide(); }
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
label: t('Cancel'),
|
|
313
|
+
options: {
|
|
314
|
+
class: 'bg-white hover:!bg-gray-100 !text-gray-900 hover:!text-gray-800 dark:!bg-gray-800 dark:!text-gray-100 dark:hover:!bg-gray-700 !border-gray-200 dark:!border-gray-600'
|
|
315
|
+
},
|
|
316
|
+
onclick: (dialog) => confirmDialog.value.tryToHideModal()
|
|
317
|
+
},
|
|
318
|
+
]
|
|
319
|
+
|
|
320
|
+
if (isProcessingAny.value) {
|
|
321
|
+
arrayToReturn.splice(1, 0, {
|
|
322
|
+
label: t('Save processed'),
|
|
323
|
+
options: {
|
|
324
|
+
disabled: isLoading.value || isSavingCurrent.value || completedRecordIds.value.size < 1,
|
|
325
|
+
loader: isSavingCurrent.value, class: 'w-fit'
|
|
326
|
+
},
|
|
327
|
+
onclick: async () => { await saveCurrentGenerated(); }
|
|
328
|
+
})
|
|
329
|
+
}
|
|
330
|
+
return arrayToReturn;
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
|
|
331
334
|
const isSavingCurrent = ref(false);
|
|
332
335
|
function checkIfDialogOpen() {
|
|
333
336
|
return isDialogOpen.value === true;
|
package/dist/index.js
CHANGED
|
@@ -108,10 +108,11 @@ 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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
111
|
+
// TODO: need to do correct check of rate limit
|
|
112
|
+
// if (this.options.rateLimits && this.options.rateLimits.fillFieldsFromImages && await this.checkRateLimit("fillFieldsFromImages" ,this.options.rateLimits.fillFieldsFromImages, headers)) {
|
|
113
|
+
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
114
|
+
// return { error: "Rate limit exceeded" };
|
|
115
|
+
// }
|
|
115
116
|
const selectedId = recordId;
|
|
116
117
|
let isError = false;
|
|
117
118
|
// Fetch the record using the provided ID
|
|
@@ -194,10 +195,11 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
194
195
|
}
|
|
195
196
|
analyzeNoImages(jobId_1, recordId_1, adminUser_1, headers_1, customPrompt_1) {
|
|
196
197
|
return __awaiter(this, arguments, void 0, function* (jobId, recordId, adminUser, headers, customPrompt, filterFilledFields = true) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
198
|
+
// TODO: need to do correct check of rate limit
|
|
199
|
+
// if (this.options.rateLimits && this.options.rateLimits.fillPlainFields && await this.checkRateLimit("fillPlainFields" ,this.options.rateLimits.fillPlainFields, headers)) {
|
|
200
|
+
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
201
|
+
// return { error: "Rate limit exceeded" };
|
|
202
|
+
// }
|
|
201
203
|
const selectedId = recordId;
|
|
202
204
|
let isError = false;
|
|
203
205
|
if (STUB_MODE) {
|
|
@@ -260,10 +262,11 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
260
262
|
initialImageGenerate(jobId_1, recordId_1, adminUser_1, headers_1, customPrompt_1) {
|
|
261
263
|
return __awaiter(this, arguments, void 0, function* (jobId, recordId, adminUser, headers, customPrompt, filterFilledFields = true) {
|
|
262
264
|
var _a, _b;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
265
|
+
// TODO: need to do correct check of rate limit
|
|
266
|
+
// if (this.options.rateLimits && this.options.rateLimits.generateImages && await this.checkRateLimit("generateImages" ,this.options.rateLimits.generateImages, headers)) {
|
|
267
|
+
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
268
|
+
// return { error: "Rate limit exceeded" };
|
|
269
|
+
// }
|
|
267
270
|
const selectedId = recordId;
|
|
268
271
|
let isError = false;
|
|
269
272
|
const start = +new Date();
|
|
@@ -375,10 +378,11 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
375
378
|
var _a;
|
|
376
379
|
const Id = recordId;
|
|
377
380
|
let isError = false;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
}
|
|
381
|
+
// TODO: need to do correct check of rate limit
|
|
382
|
+
// if (await this.checkRateLimit(fieldName, this.options.generateImages[fieldName].rateLimit, headers)) {
|
|
383
|
+
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
384
|
+
// return { error: "Rate limit exceeded" };
|
|
385
|
+
// }
|
|
382
386
|
const start = +new Date();
|
|
383
387
|
const record = yield this.adminforth.resource(this.resourceConfig.resourceId).get([Filters.EQ((_a = this.resourceConfig.columns.find(c => c.primaryKey)) === null || _a === void 0 ? void 0 : _a.name, Id)]);
|
|
384
388
|
let attachmentFiles;
|
package/index.ts
CHANGED
|
@@ -109,10 +109,11 @@ 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
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
112
|
+
// TODO: need to do correct check of rate limit
|
|
113
|
+
// if (this.options.rateLimits && this.options.rateLimits.fillFieldsFromImages && await this.checkRateLimit("fillFieldsFromImages" ,this.options.rateLimits.fillFieldsFromImages, headers)) {
|
|
114
|
+
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
115
|
+
// return { error: "Rate limit exceeded" };
|
|
116
|
+
// }
|
|
116
117
|
const selectedId = recordId;
|
|
117
118
|
let isError = false;
|
|
118
119
|
// Fetch the record using the provided ID
|
|
@@ -193,10 +194,11 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
private async analyzeNoImages(jobId: string, recordId: string, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
197
|
+
// TODO: need to do correct check of rate limit
|
|
198
|
+
// if (this.options.rateLimits && this.options.rateLimits.fillPlainFields && await this.checkRateLimit("fillPlainFields" ,this.options.rateLimits.fillPlainFields, headers)) {
|
|
199
|
+
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
200
|
+
// return { error: "Rate limit exceeded" };
|
|
201
|
+
// }
|
|
200
202
|
const selectedId = recordId;
|
|
201
203
|
let isError = false;
|
|
202
204
|
if (STUB_MODE) {
|
|
@@ -256,10 +258,11 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
256
258
|
}
|
|
257
259
|
|
|
258
260
|
private async initialImageGenerate(jobId: string, recordId: string, adminUser: any, headers: Record<string, string | string[] | undefined>, customPrompt? : string, filterFilledFields: boolean = true) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
261
|
+
// TODO: need to do correct check of rate limit
|
|
262
|
+
// if (this.options.rateLimits && this.options.rateLimits.generateImages && await this.checkRateLimit("generateImages" ,this.options.rateLimits.generateImages, headers)) {
|
|
263
|
+
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
264
|
+
// return { error: "Rate limit exceeded" };
|
|
265
|
+
// }
|
|
263
266
|
const selectedId = recordId;
|
|
264
267
|
let isError = false;
|
|
265
268
|
const start = +new Date();
|
|
@@ -369,10 +372,11 @@ export default class BulkAiFlowPlugin extends AdminForthPlugin {
|
|
|
369
372
|
private async regenerateImage(jobId: string, recordId: string, fieldName: string, prompt: string, adminUser: any, headers: Record<string, string | string[] | undefined>) {
|
|
370
373
|
const Id = recordId;
|
|
371
374
|
let isError = false;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
375
|
+
// TODO: need to do correct check of rate limit
|
|
376
|
+
// if (await this.checkRateLimit(fieldName, this.options.generateImages[fieldName].rateLimit, headers)) {
|
|
377
|
+
// jobs.set(jobId, { status: 'failed', error: "Rate limit exceeded" });
|
|
378
|
+
// return { error: "Rate limit exceeded" };
|
|
379
|
+
// }
|
|
376
380
|
const start = +new Date();
|
|
377
381
|
const record = await this.adminforth.resource(this.resourceConfig.resourceId).get([Filters.EQ(this.resourceConfig.columns.find(c => c.primaryKey)?.name, Id)]);
|
|
378
382
|
let attachmentFiles
|