shamiur commited on
Commit
8a63137
·
1 Parent(s): 64d9445

Part 655: Test All now sequential with error reasons (avoids false negatives)

Browse files
Files changed (1) hide show
  1. static/admin-v2.html +22 -13
static/admin-v2.html CHANGED
@@ -2860,31 +2860,40 @@ async function testAllProviders(btn) {
2860
  try {
2861
  const data = await api('/api/llm-dashboard/providers');
2862
  const allProvs = (data.providers || []).map(p => p.name);
2863
- // Skip local — it takes ~130s and would block the bulk test
2864
  const cloudProvs = allProvs.filter(n => n !== 'local');
2865
  const hasLocal = allProvs.includes('local');
2866
  if (cloudProvs.length === 0) {
2867
  toast('No cloud providers configured', 'error');
2868
  return;
2869
  }
2870
- // Test all cloud providers in parallel for speed
2871
- const results = await Promise.all(cloudProvs.map(async (name) => {
 
 
 
2872
  const start = Date.now();
2873
  try {
2874
  const r = await api('/api/llm-dashboard/test-provider/' + encodeURIComponent(name), 'POST');
2875
- return { name, ok: r.ok, latency: r.latency_ms || (Date.now() - start), error: r.error || '' };
 
 
 
 
2876
  } catch (e) {
2877
- return { name, ok: false, latency: Date.now() - start, error: e.message };
2878
  }
2879
- }));
 
2880
  const okCount = results.filter(r => r.ok).length;
2881
- const summary = results
2882
- .sort((a, b) => (b.ok - a.ok) || (a.latency - b.latency))
2883
- .map(r => r.ok ? `${r.name} ${Math.round(r.latency)}ms` : `${r.name} ❌`)
2884
- .join(' · ');
2885
- const suffix = hasLocal ? ' · (local skipped)' : '';
2886
- toast(`${okCount}/${results.length} cloud OK · ${summary}${suffix}`,
2887
- okCount === results.length ? 'success' : 'error');
 
 
2888
  refreshLlmHealth();
2889
  } catch (e) {
2890
  toast(`Test all failed: ${e.message}`, 'error');
 
2860
  try {
2861
  const data = await api('/api/llm-dashboard/providers');
2862
  const allProvs = (data.providers || []).map(p => p.name);
 
2863
  const cloudProvs = allProvs.filter(n => n !== 'local');
2864
  const hasLocal = allProvs.includes('local');
2865
  if (cloudProvs.length === 0) {
2866
  toast('No cloud providers configured', 'error');
2867
  return;
2868
  }
2869
+ const results = [];
2870
+ // Part 655: sequential with 150ms delay to avoid rate-limit bursts
2871
+ for (let i = 0; i < cloudProvs.length; i++) {
2872
+ const name = cloudProvs[i];
2873
+ btn.innerText = `Testing ${i + 1}/${cloudProvs.length}...`;
2874
  const start = Date.now();
2875
  try {
2876
  const r = await api('/api/llm-dashboard/test-provider/' + encodeURIComponent(name), 'POST');
2877
+ results.push({
2878
+ name, ok: r.ok,
2879
+ latency: r.latency_ms || (Date.now() - start),
2880
+ error: (r.error || '').substring(0, 40),
2881
+ });
2882
  } catch (e) {
2883
+ results.push({ name, ok: false, latency: Date.now() - start, error: e.message.substring(0, 40) });
2884
  }
2885
+ if (i < cloudProvs.length - 1) await new Promise(res => setTimeout(res, 150));
2886
+ }
2887
  const okCount = results.filter(r => r.ok).length;
2888
+ const okSummary = results.filter(r => r.ok).sort((a, b) => a.latency - b.latency)
2889
+ .map(r => `${r.name} ${Math.round(r.latency)}ms`).join(' · ');
2890
+ const failSummary = results.filter(r => !r.ok)
2891
+ .map(r => `${r.name} (${r.error || 'failed'})`).join(' · ');
2892
+ const parts = [`${okCount}/${results.length} OK`];
2893
+ if (okSummary) parts.push(okSummary);
2894
+ if (failSummary) parts.push(`FAIL: ${failSummary}`);
2895
+ if (hasLocal) parts.push('(local skipped)');
2896
+ toast(parts.join(' · '), okCount === results.length ? 'success' : 'error');
2897
  refreshLlmHealth();
2898
  } catch (e) {
2899
  toast(`Test all failed: ${e.message}`, 'error');