Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit 3cca84d

Browse files
Update status.js
1 parent 3ce88f4 commit 3cca84d

File tree

1 file changed

+31
-32
lines changed

1 file changed

+31
-32
lines changed

js/status.js

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -59,46 +59,45 @@ async function displayModels() {
5959
}
6060

6161
async function checkModelStatusInBatches(models) {
62-
const batchSize = 5;
62+
const batchSize = 1; // Since the rate limit is 1 request every 5 seconds, process models sequentially
63+
const delay = 5000; // 5 seconds in milliseconds
6364
let failed = 0;
6465
let checked = 0;
6566
const total = models.length;
6667
const statusText = document.getElementById('model-status-progress');
6768
let statusTextCopy = "Models Status:\n";
6869

69-
for (let i = 0; i < total; i += batchSize) {
70-
const batch = models.slice(i, i + batchSize);
71-
await Promise.all(batch.map(async (model) => {
72-
const statusCell = document.getElementById(`status-${model.value}`);
73-
try {
74-
const response = await fetch(api_url_chat_completions, {
75-
method: 'POST',
76-
headers: {
77-
'Content-Type': 'application/json',
78-
},
79-
body: JSON.stringify({
80-
model: model.value,
81-
messages: [{ role: "user", content: "hi" }]
82-
}),
83-
});
84-
85-
checked++;
86-
87-
if (response.ok) {
88-
statusCell.textContent = '✅ Up'; // Checkmark for successful status
89-
statusTextCopy += `${model.text} >> ✅ Up\n`;
90-
} else {
91-
statusCell.textContent = `❌ Down`;
92-
statusTextCopy += `${model.text} >> ❌ Down\n`;
93-
failed++;
94-
}
95-
} catch (error) {
96-
const errorMessage = error.message || 'Unknown error';
97-
statusCell.textContent = `❌ Error: ${errorMessage}`;
98-
statusTextCopy += `${model.text} >> ❌ Error: ${errorMessage}\n`;
70+
for (let i = 0; i < total; i++) {
71+
const model = models[i];
72+
const statusCell = document.getElementById(`status-${model.value}`);
73+
try {
74+
const response = await fetch(api_url_chat_completions, {
75+
method: 'POST',
76+
headers: {
77+
'Content-Type': 'application/json',
78+
},
79+
body: JSON.stringify({
80+
model: model.value,
81+
messages: [{ role: "user", content: "hi" }]
82+
}),
83+
});
84+
85+
checked++;
86+
87+
if (response.ok) {
88+
statusCell.textContent = '✅ Up'; // Checkmark for successful status
89+
statusTextCopy += `${model.text} >> ✅ Up\n`;
90+
} else {
91+
statusCell.textContent = `❌ Down`;
92+
statusTextCopy += `${model.text} >> ❌ Down\n`;
9993
failed++;
10094
}
101-
}));
95+
} catch (error) {
96+
const errorMessage = error.message || 'Unknown error';
97+
statusCell.textContent = `❌ Error: ${errorMessage}`;
98+
statusTextCopy += `${model.text} >> ❌ Error: ${errorMessage}\n`;
99+
failed++;
100+
}
102101

103102
let successfulProc = Math.round(((total - failed) / total) * 100);
104103
let failedProc = Math.round((failed / total) * 100);

0 commit comments

Comments
 (0)