yulongchen commited on
Commit
8dca04f
Β·
1 Parent(s): 31a84a9

Add system

Browse files
Files changed (1) hide show
  1. test.html +3 -3
test.html CHANGED
@@ -261,7 +261,7 @@
261
  loadEvents(lastUsedFile);
262
  }
263
  }, 200);
264
- } else if (finalText.includes("error") || finalText.includes("fail")) {
265
  clearInterval(window.pollIntervalId);
266
  window.pollIntervalId = null;
267
  statusElement.innerHTML += `<div class="mt-2 text-red-600 font-semibold">❌ The process failed.</div>`;
@@ -315,9 +315,9 @@
315
  try {
316
  const fileParam = encodeURIComponent(file);
317
  const eventsRes = await fetch(`/api/events?file=${fileParam}`);
318
- if (!eventsRes.ok) throw new Error("Event file not found or malformed");
319
  const data = await eventsRes.json();
320
- if (!Array.isArray(data)) throw new Error("Unexpected data format");
321
 
322
  if (data.length === 0) {
323
  p.innerHTML = `<div class="text-gray-500 italic"> Sorry, we do not find any progress for this pledge.</div>`;
 
261
  loadEvents(lastUsedFile);
262
  }
263
  }, 200);
264
+ } else if (Object.values(data.status || {}).some(v => v.startsWith("❌"))) {
265
  clearInterval(window.pollIntervalId);
266
  window.pollIntervalId = null;
267
  statusElement.innerHTML += `<div class="mt-2 text-red-600 font-semibold">❌ The process failed.</div>`;
 
315
  try {
316
  const fileParam = encodeURIComponent(file);
317
  const eventsRes = await fetch(`/api/events?file=${fileParam}`);
318
+ if (!eventsRes.ok) throw new Error("❌ Event file not found or malformed");
319
  const data = await eventsRes.json();
320
+ if (!Array.isArray(data)) throw new Error("❌ Unexpected data format");
321
 
322
  if (data.length === 0) {
323
  p.innerHTML = `<div class="text-gray-500 italic"> Sorry, we do not find any progress for this pledge.</div>`;