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.97k stars 331 forks source link

Kudos but disable the automatic Submit #8

Closed Manamama closed 1 year ago

Manamama commented 1 year ago

Close to perfection, kudos. Still a small snag - it assumes perfection in speech recognition.

Me no coder ;), so after conversing with lab.openai.com (accepts longer code, but still not full, had to trim some) and ChatGPT at the same time yet again, I have changed one bit, because the Speech to Text output needs to be manually fixed each time to avoid its misinterpretations:

// Version      : 1.4.1 - Automatic "Submit" disabled by Manamama
[...]
function CN_SendMessage(text) {
    // Send the message
    jQuery("textarea").val(text);
    //jQuery("textarea").closest("div").find("button").click();

To make it a tad more elegant, I asked AI to modify the other code once again ;)

_> AI change the code so that the send button click is NOT simulated. The user has to press Enter or Send instead. Show me the original CN_SendMessage function and the code that you provided that modifies the CNSendMessage function. Explain the changes:

// Wait for the Save & Submit button press to submit the message or automatic:
var CN_SUBMIT_ON_ENTER = false; // or true
[...]
function CN_SendMessage(text) {
  // Stop speech recognition until the answer is received
  if (CN_SPEECHREC) {
    clearTimeout(CN_TIMEOUT_KEEP_SPEECHREC_WORKING);
    CN_SPEECHREC.stop();
  }

  // Set the value of the textarea element to the given text
  jQuery("textarea").val(text);

  // Submit the message if the user has set the press to CN_SUBMIT_ON_ENTER variable as true
  if (CN_SUBMIT_ON_ENTER) {
    jQuery("textarea").closest("div").find("button").click();
  }  
}

_This modified version of the CNSendMessage function removes the code that simulates a button click to submit the message. Instead, it only sets the value of the textarea element to the given text and stops the speech recognition process if it is currently running.

I have added more and tried to fork it in full, now here, with another small suggested fix to the Readme as well, but due to my (or GPT's ;) meagre coding skills it still seems to stop listening upon the manual Submit.

C-Nedelcu commented 1 year ago

This has been implemented in v1.6 :) I am now closing this issue

Manamama commented 1 year ago

Good that you wrote it here.

  1. FYI, Chrome here: the extension did not update itself from 1.5 to 1.6, even upon Chrome restart, so I am removing and readding it manually: worked only then.

  2. Another high-level FYI, see my comment about the engine itself here: First ads via browser UI started to appear (+ ChatGPT "IQ degradation")

  3. Now that I have tested it in ver 1.6 (mine is: Chrome Ubuntu, in short, but then I have added "Luna - ChatGPT for Chrome" extension since):

A. No possibility of review of the recognized text either. (Tested twice.)

B. Something even worse happens: below is the ChatGPT talking to itself, i.e. it recognizes its own voice answers! (Absent pre ver. 1.6):

[Me asking about something related to bikes, skipping it] ChatGPT: Coughing after cycling can be a sign of various issues, including allergies, exposure to pollutants or irritants in the air, or a respiratory infection. However, it does not necessarily mean that you are going to fall ill. If you have a blocked nose, it may make breathing more difficult during exercise and lead to coughing. If your symptoms persist or worsen, it may be a good idea to consult a doctor. Additionally, it's always a good idea to take care of yourself and avoid intense physical activity when you are feeling unwell.

532 chars / 92 words Copy

ChatGPT listening to itself: it's always a good idea to take care of yourself and avoid intense physical activity when you are feeling unwell Yes, that is correct. If you have symptoms such as coughing, a congested or runny nose, or any other signs of illness, it is best to avoid intense physical activity such as cycling, and focus on rest and recovery instead. This will help your body fight off the illness and return to full health more quickly. Additionally, engaging in physical activity when you are unwell can put extra strain on your body, potentially worsening your symptoms and making it take longer to recover.

Copy 481 chars / 83 words

ChatGPT listening to itself: yes that is correct if you have symptoms such as coughing a congested or runny nose or any other signs of illness it is best to avoid intense physical activity such as cycling and focus on rest and Recovery instead this will help your body fight the illness and get back to full health faster. In general, it's important to listen to your body and avoid pushing yourself too hard when you are sick. Taking care of yourself and giving yourself time to recover is crucial for maintaining good health.

(sic)

C-Nedelcu commented 1 year ago

Good that you wrote it here.

  1. FYI, Chrome here: the extension did not update itself from 1.5 to 1.6, even upon Chrome restart, so I am removing and readding it manually: worked only then.
  2. Another high-level FYI, see my comment about the engine itself here: First ads via browser UI started to appear (+ ChatGPT "IQ degradation")
  3. Now that I have tested it in ver 1.6 (mine is: Chrome Ubuntu, in short, but then I have added "Luna - ChatGPT for Chrome" extension since):

A. No possibility of review of the recognized text either. (Tested twice.)

B. Something even worse happens: below is the ChatGPT talking to itself, i.e. it recognizes its own voice answers! (Absent pre ver. 1.6):

[Me asking about something related to bikes, skipping it] ChatGPT: Coughing after cycling can be a sign of various issues, including allergies, exposure to pollutants or irritants in the air, or a respiratory infection. However, it does not necessarily mean that you are going to fall ill. If you have a blocked nose, it may make breathing more difficult during exercise and lead to coughing. If your symptoms persist or worsen, it may be a good idea to consult a doctor. Additionally, it's always a good idea to take care of yourself and avoid intense physical activity when you are feeling unwell. 532 chars / 92 words Copy ChatGPT listening to itself: it's always a good idea to take care of yourself and avoid intense physical activity when you are feeling unwell Yes, that is correct. If you have symptoms such as coughing, a congested or runny nose, or any other signs of illness, it is best to avoid intense physical activity such as cycling, and focus on rest and recovery instead. This will help your body fight off the illness and return to full health more quickly. Additionally, engaging in physical activity when you are unwell can put extra strain on your body, potentially worsening your symptoms and making it take longer to recover. Copy 481 chars / 83 words ChatGPT listening to itself: yes that is correct if you have symptoms such as coughing a congested or runny nose or any other signs of illness it is best to avoid intense physical activity such as cycling and focus on rest and Recovery instead this will help your body fight the illness and get back to full health faster. In general, it's important to listen to your body and avoid pushing yourself too hard when you are sick. Taking care of yourself and giving yourself time to recover is crucial for maintaining good health.

(sic)

Hi,

The update was pending validation on Google Play. it's been approved so now everyone should have 1.6 automatically (it updated successfully on my PC this morning).

I haven't noticed any ads but I use ad blockers so I guess I wouldnt notice them. I should try again. Does that impact functionality of this extension?

RE: A. No possibility of review of the recognized text either. (Tested twice.) Did you try to disable autosend? It's a new feature in v1.6. Then you can review the text as much as you want and then when you're ready you can say the words.

RE: B. Something even worse happens: below is the ChatGPT talking to itself, i.e. it recognizes its own voice answers! (Absent pre ver. 1.6) I have observed this bug in certain conditions, but I fixed it under those particular conditions - can't remember what it was, something like after clicking the skip button or something. Right now, when I use the extension normally, like open the chat page, click Start, talk (with autosend) and hear the reply, the bug doesn't happen - at least for me. Could you indicate steps to reproduce? what buttons do you push, what settings do you use? I know this can happen but it's triggered by a particular scenario and I can't reproduce that right now.

Manamama commented 1 year ago

Ads: I have just added ###modal-newsletter block in my UOrigin and it should handle it for now. But there will be more as per their announcements :(.

Voice recognition

Did you try to disable autosend? It's a new feature in v1.6.

Silly me: I may have disabled it but then I did not press "Save". Also I wrongly assumed it was the default.

Re: Something even worse happens: below is the ChatGPT talking to itself Non-reproducible, after a notebook reboot. Also now, when now I use earphones for that. -> Let us assume it was a fluke

-> Safe to close by now. Ta for all!