Lucii1 commited on
Commit
bf14e2e
·
1 Parent(s): 93e4458
Files changed (2) hide show
  1. main.js +18 -10
  2. serverSentEvents.js +7 -5
main.js CHANGED
@@ -630,16 +630,20 @@ function reset() {
630
  data.value = null;
631
  }
632
 
633
- const pollIntervalMs = 10000;
634
- const maxPolls = 500;
635
  async function runFaceCheckPolling(formData, clientId) {
636
  try {
637
- const start = await axios.post(apiBaseUrl + 'v1/face_check/polling', formData, {
638
- headers: {
639
- 'Content-Type': 'multipart/form-data',
640
- 'X-Client-ID': clientId,
641
- },
642
- });
 
 
 
 
643
  const { job_id, status } = start.data;
644
  if (!job_id) return { error: 'Missing job_id from polling start' };
645
  if (status === 'failed') return { error: 'Job failed immediately' };
@@ -649,7 +653,9 @@ async function runFaceCheckPolling(formData, clientId) {
649
  await new Promise((r) => setTimeout(r, pollIntervalMs));
650
  attempts += 1;
651
 
652
- const res = await axios.get(apiBaseUrl + `v1/face_check/polling/${job_id}`);
 
 
653
  if (res.data.status === 'succeeded') return { result: res.data.result };
654
  if (res.data.status === 'failed') {
655
  return { error: res.data.error || 'Job failed' };
@@ -985,7 +991,9 @@ window.previewFile = function (event, fileId) {
985
  const fileURL = URL.createObjectURL(file);
986
  currentPreviewURL = fileURL;
987
  let content = '';
988
- if (file.type.startsWith('image/')) {
 
 
989
  content = `<img src="${fileURL}" alt="${file.name}" style="max-width: 100%; height: auto;" />`;
990
  } else if (file.type.startsWith('video/')) {
991
  content = `<video controls style="max-width: 100%; height: auto;">
 
630
  data.value = null;
631
  }
632
 
633
+ const pollIntervalMs = 5000;
634
+ const maxPolls = 1000;
635
  async function runFaceCheckPolling(formData, clientId) {
636
  try {
637
+ const start = await axios.post(
638
+ apiBaseUrl + 'v1/face_check/polling',
639
+ formData,
640
+ {
641
+ headers: {
642
+ 'Content-Type': 'multipart/form-data',
643
+ 'X-Client-ID': clientId,
644
+ },
645
+ }
646
+ );
647
  const { job_id, status } = start.data;
648
  if (!job_id) return { error: 'Missing job_id from polling start' };
649
  if (status === 'failed') return { error: 'Job failed immediately' };
 
653
  await new Promise((r) => setTimeout(r, pollIntervalMs));
654
  attempts += 1;
655
 
656
+ const res = await axios.get(
657
+ apiBaseUrl + `v1/face_check/polling/${job_id}`
658
+ );
659
  if (res.data.status === 'succeeded') return { result: res.data.result };
660
  if (res.data.status === 'failed') {
661
  return { error: res.data.error || 'Job failed' };
 
991
  const fileURL = URL.createObjectURL(file);
992
  currentPreviewURL = fileURL;
993
  let content = '';
994
+ if (file.type === 'video/quicktime') {
995
+ content = 'The system does not support preview for .mov files.';
996
+ } else if (file.type.startsWith('image/')) {
997
  content = `<img src="${fileURL}" alt="${file.name}" style="max-width: 100%; height: auto;" />`;
998
  } else if (file.type.startsWith('video/')) {
999
  content = `<video controls style="max-width: 100%; height: auto;">
serverSentEvents.js CHANGED
@@ -197,11 +197,13 @@ source.onmessage = (event) => {
197
  data.value = data.value;
198
  }, 60000);
199
  } else {
200
- isLoading.value = false;
201
- _estTimeStep1 = 0;
202
- _estTimeStep2 = 0;
203
- data.value = initData;
204
- clearInterval(_interval);
 
 
205
  }
206
  }
207
  if (_data?.status_service) {
 
197
  data.value = data.value;
198
  }, 60000);
199
  } else {
200
+ setTimeout(() => {
201
+ isLoading.value = false;
202
+ _estTimeStep1 = 0;
203
+ _estTimeStep2 = 0;
204
+ data.value = initData;
205
+ clearInterval(_interval);
206
+ }, 2500);
207
  }
208
  }
209
  if (_data?.status_service) {