@@ -59,8 +59,8 @@ async function displayModels() {
5959}
6060
6161async function checkModelStatusInBatches ( models ) {
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
62+ const batchSize = 1 ; // Process models one at a time
63+ const delay = 5100 ; // 5 seconds in milliseconds
6464 let failed = 0 ;
6565 let checked = 0 ;
6666 const total = models . length ;
@@ -70,6 +70,7 @@ async function checkModelStatusInBatches(models) {
7070 for ( let i = 0 ; i < total ; i ++ ) {
7171 const model = models [ i ] ;
7272 const statusCell = document . getElementById ( `status-${ model . value } ` ) ;
73+
7374 try {
7475 const response = await fetch ( api_url_chat_completions , {
7576 method : 'POST' ,
@@ -103,6 +104,11 @@ async function checkModelStatusInBatches(models) {
103104 let failedProc = Math . round ( ( failed / total ) * 100 ) ;
104105 let checkedProc = Math . round ( ( checked / total ) * 100 ) ;
105106 statusText . textContent = `Total models: ${ total } | Checked: ${ checked } (${ checkedProc } %) | Successful: ${ total - failed } (${ successfulProc } %) | Failed: ${ failed } (${ failedProc } %)` ;
107+
108+ // Add delay between requests
109+ if ( i < total - 1 ) {
110+ await new Promise ( resolve => setTimeout ( resolve , delay ) ) ;
111+ }
106112 }
107113
108114 statusTextCopy += `\nTotal models: ${ total } | Checked: ${ checked } | Successful: ${ total - failed } | Failed: ${ failed } ` ;
@@ -111,6 +117,7 @@ async function checkModelStatusInBatches(models) {
111117 statusText . innerHTML = `${ statusText . innerHTML } <br><br><button onclick="copyText(\`${ statusTextCopy } \`)">Copy result</button>` ;
112118}
113119
120+
114121function copyText ( textToCopy ) {
115122 navigator . clipboard . writeText ( textToCopy )
116123 . then ( ( ) => {
0 commit comments