To fix this, the setInterval function should be called outside of the .then function. The following is an example of how to do this:

let intervalId = null;

function reloadResource(){
    fetch('https://example.com/api/resource', {
        method: 'GET',
        headers: {
            'Content-Type': 'application/json',
        },
    })
    .then(response => response.json())
    .then(data => {
        console.log('Success:', data);
    })
    .catch((error) => {
        console.error('Error:', error);
    });
}

intervalId = setInterval(reloadResource, 1000);
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence