ChatGPT Enhancer

Enhances ChatGPT by bypassing some limitations

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 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.');
})();