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 334 forks source link

Fix erroneus Speechrec stop #140

Closed bartman081523 closed 1 year ago

bartman081523 commented 1 year ago

Fix erroneus Speechrec stop. Sometimes after reading the message, the Speechrec was stopping. Fix by GPT-4 (works for me, error is gone)

C-Nedelcu commented 1 year ago

Thank you for your wonderful contribution! I will review and test, and if all is OK, I will post as 1.6.2. Many thanks for your help, and if you want to contribute further, I would be happy to share some of the next donations with you.

bartman081523 commented 1 year ago

Many thanks for your help, and if you want to contribute further, I would be happy to share some of the next donations with you.

I will contribute what I can, thank you too.

The abrupt stopping of speechrec after 2-3 messages is gone, but now I have another error after ca. 7 speechrec messages.

content.js:99 Uncaught DOMException: Failed to execute 'start' on 'SpeechRecognition': recognition has already started. at CN_SayOutLoud (chrome-extension://apppenpkkmfffmkbfidchbmolggnohoj/content.js:99:30) at CN_CheckNewMessages (chrome-extension://apppenpkkmfffmkbfidchbmolggnohoj/content.js:504:5)

This error appears and then there is no speech rec possible anymore.

C-Nedelcu commented 1 year ago

Many thanks for your help, and if you want to contribute further, I would be happy to share some of the next donations with you. I will contribute what I can, thank you too.

The abrupt stopping of speechrec after 2-3 messages is gone, but now I have another error after ca. 7 speechrec messages.

content.js:99 Uncaught DOMException: Failed to execute 'start' on 'SpeechRecognition': recognition has already started. at CN_SayOutLoud (chrome-extension://apppenpkkmfffmkbfidchbmolggnohoj/content.js:99:30) at CN_CheckNewMessages (chrome-extension://apppenpkkmfffmkbfidchbmolggnohoj/content.js:504:5)

This error appears and then there is no speech rec possible anymore.

You may want to use a try/catch block around the .start() call ? this would usually do the trick. Dirty but efficient

bartman081523 commented 1 year ago

can you test the pr at this stage? for me the speech rec still works, after I tested 20 received speech recs.

C-Nedelcu commented 1 year ago

I will do my best to try it soon but I can't today (busy at work) I usually do my Talk to ChatGPT work on weekends as it's a personal side project.

bartman081523 commented 1 year ago

Take your time, my intenttion was not to hassle you. in the meantime I will implement and try with the catch/try block around the start() call. I will try to develop a fix for the speech rec stop and push to this patch-3 branch.

being-blueprint commented 1 year ago

Hi, mine doest speak back at all - as in no voice just texts back

C-Nedelcu commented 1 year ago

Hi, mine doest speak back at all - as in no voice just texts back

are you talking about changes made by @bartman081523 ? or just the standard v2.6.1 version?

bartman081523 commented 1 year ago

Hi, mine doest speak back at all - as in no voice just texts back

are you talking about changes made by @bartman081523 ? or just the standard v2.6.1 version?

@C-Nedelcu please take your time until you review. I have no problem waiting a few weeks.

I have cloned from scratch with git clone -b patch-3 https://github.com/bartman081523/talk-to-chatgpt.git and loaded the extension in chrome and it works like intended (for me).

Of course there is the message "Not starting SpeechRecognition because CN_IS_LISTENING is true" after every message, but this only catches another error, that I dont know how to patch, so that too works like intended. The speechrec is not stopping after ca. 3 received messages, but hears at least for 30 messages, here is the console log for 30 received messages:

console log ``` Checking we are on the correct page... content.js:932 Speech recognition API supported content.js:1370 Reloading settings from cookie: de-DE-Google Deutsch,1.3,1,de-DE,stop,pause,1,send message now,0,1,0,0,,null,, content.js:952 I will read using voice Google Deutsch (de-DE) content.js:615 I'm listening content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 2 content.js:116 Stopping SpeechRecognition content.js:129 [BROWSER] Saying out loud: Hello! content.js:116 Stopping SpeechRecognition content.js:129 [BROWSER] Saying out loud: It seems like you're testing the chat functionality. content.js:116 Stopping SpeechRecognition content.js:129 [BROWSER] Saying out loud: How can I assist you today? content.js:412 Finished speaking out loud content.js:412 Finished speaking out loud content.js:615 I'm listening content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 4 content.js:99 Attempting to start SpeechRecognition content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:615 I'm listening 2content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 6 content.js:99 Attempting to start SpeechRecognition content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:635 Voice recognition: 'test test' content.js:479 New message detected! currentMessageCount: 8 content.js:622 I've stopped listening content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 4content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 10 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 3content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 12 content.js:99 Attempting to start SpeechRecognition content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:615 I'm listening 6content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 14 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 16 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 4content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 18 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 3content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 20 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 22 content.js:99 Attempting to start SpeechRecognition 2content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:615 I'm listening content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 24 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 6content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 26 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'das test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 28 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 30 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 32 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 6content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'das test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 34 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 36 content.js:99 Attempting to start SpeechRecognition content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:615 I'm listening 6content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: 'test test test test test test test test' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 38 content.js:99 Attempting to start SpeechRecognition content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:635 Voice recognition: '20' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 40 content.js:99 Attempting to start SpeechRecognition 2content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:615 I'm listening 3content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: '21' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 42 content.js:99 Attempting to start SpeechRecognition content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:615 I'm listening 6content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:635 Voice recognition: '23' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 44 content.js:99 Attempting to start SpeechRecognition content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:615 I'm listening 6content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: '22' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 46 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: '24' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 48 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: '25' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 50 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 8content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: '26' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 52 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:635 Voice recognition: '28' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 54 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 9content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: '27' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 56 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: '21' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 58 content.js:99 Attempting to start SpeechRecognition content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:615 I'm listening 8content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:635 Voice recognition: '30' content.js:622 I've stopped listening content.js:479 New message detected! currentMessageCount: 60 content.js:99 Attempting to start SpeechRecognition content.js:615 I'm listening 5content.js:106 Not starting SpeechRecognition because CN_IS_LISTENING is true content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:626 Error while listening content.js:622 I've stopped listening content.js:615 I'm listening content.js:622 I've stopped listening content.js:615 I'm listening ```
C-Nedelcu commented 1 year ago

I have reviewed the changes and they all look good. I am going to test for a while personally and then I will publish as v2.6.2 :)

C-Nedelcu commented 1 year ago

Had a long discussion with ChatGPT and it worked great, seemed perfectly stable to me. Pushing v2.6.2 to the stores now. Thank you very much bartman081523 !