single OCR thread in //
This commit is contained in:
@@ -248,6 +248,8 @@ const isDragOver = ref(false);
|
||||
const error = ref("");
|
||||
const files = ref<SubmissionFile[]>([]);
|
||||
|
||||
const isProcessingOCR = ref(false);
|
||||
|
||||
// Watch for external changes to modelValue
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
@@ -374,6 +376,12 @@ const isOpusMagnumImage = (file: File): boolean => {
|
||||
};
|
||||
|
||||
const processOCR = async (submissionFile: SubmissionFile) => {
|
||||
while (isProcessingOCR.value) {
|
||||
console.log("OCR is already processing, waiting 500ms...");
|
||||
await new Promise((res) => setTimeout(res, 500));
|
||||
}
|
||||
|
||||
isProcessingOCR.value = true;
|
||||
// Find the file in the reactive array to ensure proper reactivity
|
||||
const fileIndex = files.value.findIndex(
|
||||
(f) => f.file === submissionFile.file,
|
||||
@@ -412,6 +420,7 @@ const processOCR = async (submissionFile: SubmissionFile) => {
|
||||
} finally {
|
||||
files.value[fileIndex].ocrProcessing = false;
|
||||
}
|
||||
isProcessingOCR.value = false;
|
||||
};
|
||||
|
||||
const retryOCR = (submissionFile: SubmissionFile) => {
|
||||
|
||||
Reference in New Issue
Block a user