C-Nedelcu / talk-to-chatgpt

Talk to ChatGPT AI using your voice and listen to its answers through a voice
GNU Affero General Public License v3.0
1.96k stars 335 forks source link

V2.9.0 stopped showing #238

Open CubieX opened 2 months ago

CubieX commented 2 months ago

It worked fine for weeks and suddnely stopped showing up. Re-installing it didn't help. The UI for it is just gone. Chrome Version 124.0.6367.119 (Offizieller Build) (64-Bit)

Xustyx commented 2 months ago

Up!

It seems that something changed on the ChatGPT website, and now the plugin has stopped appearing.

Currently half working after change manifest, now the domain is "https://chatgpt.com/" listening works but reading is not working.

justincontributor commented 2 months ago

I have "TypeError: Failed to execute 'getReader' on 'ReadableStream': ReadableStreamDefaultReader constructor can only accept readable streams that are not yet locked to a reader" in the console.

It seems that OpenAI changed the way they stream the answer. So the jQuery reading on the fly doesn't work anymore.

Edit : the error appears in the console even if you turn the extension off. To me, it means that the error is on openai side.

Xustyx commented 2 months ago

I have it already running with a few changes using document selectors instead jquery:

Now the function CN_CheckNewMessages() looks like this:

function CN_CheckNewMessages() {
    // Any new messages?
    var currentMessageCount = document.querySelectorAll('.text-base .items-start').length
    if (currentMessageCount > CN_MESSAGE_COUNT) {
        // New message!
        console.log("New message detected! current message count: " + currentMessageCount);
        CN_MESSAGE_COUNT = currentMessageCount;
        CN_CURRENT_MESSAGE = document.querySelectorAll('.text-base .items-start')[currentMessageCount - 1];
        CN_CURRENT_MESSAGE_SENTENCES = []; // Reset list of parts already spoken
        CN_CURRENT_MESSAGE_SENTENCES_NEXT_READ = 0;
    }

    // Split current message into parts
    if (CN_CURRENT_MESSAGE) {
        var currentText = document.querySelectorAll('.text-base .items-start')[currentMessageCount - 1].innerText + "";
        //console.log("currentText:" + currentText);

        // Remove code blocks?
        if (CN_IGNORE_CODE_BLOCKS) {
            currentText = ""
            document.querySelectorAll('.text-base .items-start')[currentMessageCount - 1].querySelectorAll(".markdown > :not(pre)").forEach(n => {
                currentText += n.innerText
            });
            ////console.log("[CODE] currentText:" + currentText);
        }

        var newSentences = CN_SplitIntoSentences(currentText);
        if (newSentences != null && newSentences.length != CN_CURRENT_MESSAGE_SENTENCES.length) {
            ////console.log("[NEW SENTENCES] newSentences:" + newSentences.length);

            // There is a new part of a sentence!
            var nextRead = CN_CURRENT_MESSAGE_SENTENCES_NEXT_READ;
            for (let i = nextRead; i < newSentences.length; i++) {
                CN_CURRENT_MESSAGE_SENTENCES_NEXT_READ = i+1;

                var lastPart = newSentences[i];
                //console.log("Will say sentence out loud: "+lastPart);
                CN_SayOutLoud(lastPart);
            }
            CN_CURRENT_MESSAGE_SENTENCES = newSentences;
        }
    }

    setTimeout(CN_CheckNewMessages, 100);
}

And the function CN_StartTTGPT() like this:

function CN_StartTTGPT() {
    // Add listener for ElevenLabs
    chrome.runtime.onMessage.addListener(
        function (message) {
            if (message.type === "continueElevenLabs") {
                // The audio player is telling us it's finished playing and wants to continue
                CN_ELEVENLABS_PLAYING = false;
                CN_ContinueElevenLabsPlaybackQueue("after-playback");
            }
        }
    );

    // Play sound & start
    CN_PlaySound("data:audio/mpeg;base64,//OEZAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAAKAAAIuAAYGBgYGBgYGBgYSEhISEhISEhISGxsbGxsbGxsbGyEhISEhISEhISEmZmZmZmZmZmZmbGxsbGxsbGxsbHJycnJycnJycnJ3t7e3t7e3t7e3vz8/Pz8/Pz8/Pz///////////8AAAA5TEFNRTMuOTlyAm4AAAAALgkAABRGJAN7TgAARgAACLgWvfqPAAAAAAAAAAAAAAAAAAAA//OEZAANCD9CBqyIAA5QAlGfQBAALXMbhty2HqnTHRXLvlpzEEMYYxhAUA0BNMAimSibLJ1SG8oEGNHLvp1xprEUCDBwMHw/iAMYPg+D6BACAIYPg+D6AQDEucg+/48H3/gcHwf/5cHAQBA5/KBjB8P//+sH31Ag6D4fggZCAXRUBgQDg/KAgCAYB8/DCgQ4nfBAzB/lAQd/wTB8/8oCYPh/DH/5cHwfP//8Hwff///UCAIeUDD1IAAADUAHQt4F//PEZAkcRgU6i85YACR0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bh7LSFEqkuuw25plEqskvBtz2WoqpJqTYe7StNIlQJpplWS/b9a/76/+AehKSW2wABMIjKTqtkwcCkZlnhNAYslK1XWemvUOWREqog9UlVVKq4lXKqqxT31dfTS7/////t+kxBTUUzLjk5LjWqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq//MUZCwAAAEcAAAAAAAAAggAAAAAqqqq");

    // Reset
    CN_FINISHED = false;

    // Hide start button, show action buttons
    jQuery(".CNStartZone").hide();
    jQuery(".CNActionButtons").show();

    setTimeout(function() {
        // Start speech rec
        CN_StartSpeechRecognition();

        // Make sure message count starts from last; we don't want to read the latest message
        var currentMessageCount = document.querySelectorAll('.text-base .items-start').length;
        if (currentMessageCount > CN_MESSAGE_COUNT) {
            // New message!
            CN_MESSAGE_COUNT = currentMessageCount;
            CN_CURRENT_MESSAGE = null; // Set current message to null
        }

        // Check for new messages
        CN_CheckNewMessages();
    }, 150);
}
lawilfried commented 1 month ago

Hallo Xustyx, thank you for the fix. Would you be so kind to tell a newbee how to apply the fix? Is there a file in which I have to change/substitute the functions or something like that?

i3dman420311 commented 1 month ago

Could you give us some assistance on how to implement this fix? TY

mr1n-ng commented 1 month ago

Hallo Xustyx, thank you for the fix. Would you be so kind to tell a newbee how to apply the fix? Is there a file in which I have to change/substitute the functions or something like that?

-Download the extention from GH and extract it. -Open content.js and find the fuctions (notepad++ is good for that) -change the functions to the one posted.

-go to the manifest file and change the domain to chatgpt.com/*

-then manually install the addon as its described on the GH page.

i3dman420311 commented 1 month ago

read back still is not working :-(

Hallo Xustyx, thank you for the fix. Would you be so kind to tell a newbee how to apply the fix? Is there a file in which I have to change/substitute the functions or something like that?

-Download the extention from GH and extract it. -Open content.js and find the fuctions (notepad++ is good for that) -change the functions to the one posted.

-go to the manifest file and change the domain to chatgpt.com/*

-then manually install the addon as its described on the GH page.

read back still is not working :-(

lawilfried commented 1 month ago

At first I went to Chrome and deleted the existing Talk-to-ChatGPT 2.9.0. Then I followed the steps recommended by mr1n-ng. After a restart I renewed the settings and now it works fine. Thank you for your help.

i3dman420311 commented 1 month ago

At first I went to Chrome and deleted the existing Talk-to-ChatGPT 2.9.0. Then I followed the steps recommended by mr1n-ng. After a restart I renewed the settings and now it works fine. Thank you for your help.

Read back is fully working both native and with elevenlabs for you?

My microphone is working , but neither read back works for me.

lawilfried commented 1 month ago

I don't use elevenlabs, but the "AI voice and language: Google UK English Female(en-GB)". My microphone is working, ChatGPT shows the text and ChatGPT shows and reads it's answers.