Skip to content

Commit 5c2c3af

Browse files
committed
fix: add loader for the check for the rate limits
1 parent f2f4bdc commit 5c2c3af

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

custom/VisionAction.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
{
6868
label: t('Start generation'),
6969
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
7172
},
7273
onclick: (dialog) => { runAiActions(); }
7374
}
@@ -283,6 +284,7 @@ const completedRecordIds = ref<Set<string>>(new Set());
283284
const isActiveGeneration = ref(false);
284285
const pauseBreakpoints = computed(() => props.meta.askConfirmation || []);
285286
const startedRecordCount = ref(0);
287+
const isCheckingRateLimits = ref(false);
286288
let startGate = Promise.resolve();
287289
const tableRef = ref<any>(null);
288290
const processedCount = computed(() => {
@@ -383,11 +385,11 @@ async function getListOfIds() {
383385
384386
385387
async function runAiActions() {
386-
popupMode.value = 'generation';
387388
if (!await checkRateLimits()) {
388389
confirmDialog.value.close();
389390
return;
390391
}
392+
popupMode.value = 'generation';
391393
isGenerationCancelled.value = false;
392394
isGenerationPaused.value = false;
393395
isActiveGeneration.value = true;
@@ -639,6 +641,7 @@ async function processOneRecord(recordId: string) {
639641
}
640642
641643
async function checkRateLimits() {
644+
isCheckingRateLimits.value = true;
642645
const actionsToCheck: Array<'generate_images' | 'analyze' | 'analyze_no_images'> = [];
643646
if (props.meta.isImageGeneration) {
644647
actionsToCheck.push('generate_images');
@@ -670,9 +673,11 @@ async function checkRateLimits() {
670673
variant: 'danger',
671674
timeout: 'unlimited',
672675
});
676+
isCheckingRateLimits.value = false;
673677
return false;
674678
}
675679
}
680+
isCheckingRateLimits.value = false;
676681
return true;
677682
}
678683

0 commit comments

Comments
 (0)