Skip to content

Instantly share code, notes, and snippets.

@IsaacGemal
Last active October 12, 2024 15:42
Show Gist options
  • Save IsaacGemal/091b0720e1c0d7e3a5cde8c09c3f5602 to your computer and use it in GitHub Desktop.
Save IsaacGemal/091b0720e1c0d7e3a5cde8c09c3f5602 to your computer and use it in GitHub Desktop.
Count your gpt conversatinos
let finalConversationCount = 0;
async function scrollAndCountConversations() {
let conversationContainer = document.querySelector('nav[aria-label="Chat history"]');
let previousCount = 0;
let currentCount = 0;
let maxElements = 100; // Limit to 100 elements for testing, increase as needed
while (currentCount < maxElements) {
let conversationList = document.querySelectorAll('li[data-testid^="history-item"]');
currentCount = conversationList.length;
if (currentCount === previousCount) {
break;
}
previousCount = currentCount;
if (conversationList.length > 0) {
conversationList[conversationList.length - 1].scrollIntoView({ behavior: 'smooth' });
}
await new Promise(resolve => setTimeout(resolve, 5000)); // Slow so it doesn't break anything
}
finalConversationCount = currentCount;
console.log(`You have had ${currentCount} conversations with GPT (limit: ${maxElements}).`);
}
scrollAndCountConversations();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment