ChatGPT Enhancer

Enhances ChatGPT by bypassing some limitations

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         ChatGPT Enhancer
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Enhances ChatGPT by bypassing some limitations
// @author       Benjamin Herasme
// @match        *://chat.openai.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to send a message to ChatGPT
    function sendMessage(message) {
        const textArea = document.querySelector('[placeholder="Send a message..."]');
        if (textArea) {
            textArea.value = message;
            textArea.dispatchEvent(new Event('input', { bubbles: true }));
            textArea.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', code: 'Enter', keyCode: 13, which: 13, bubbles: true }));
        }
    }

    // Function to handle the response and continue the conversation
    function handleResponse(response) {
        const responseText = response.querySelector('.markdown').innerText;
        console.log('ChatGPT Response:', responseText);

        // Check if the response indicates a limitation (e.g., rate limiting)
        if (responseText.includes('Please try again later') || responseText.includes('Rate limit exceeded')) {
            setTimeout(() => {
                sendMessage('Continue...');
            }, 5000); // Wait for 5 seconds before sending the next message
        } else {
            // Continue the conversation if no limitations are detected
            setTimeout(() => {
                sendMessage('Continue...');
            }, 1000); // Wait for 1 second before sending the next message
        }
    }

    // Observe for new responses from ChatGPT
    const observer = new MutationObserver((mutations) => {
        for (const mutation of mutations) {
            if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
                mutation.addedNodes.forEach(node => {
                    if (node.nodeType === Node.ELEMENT_NODE && node.classList.contains('markdown')) {
                        handleResponse(node);
                    }
                });
            }
        }
    });

    observer.observe(document.body, { childList: true, subtree: true });

    // Start the conversation
    sendMessage('Hello, ChatGPT! Let\'s have a conversation.');
})();