Open Lufffya opened 1 year ago
Do you mean reading the response out loud, as audio?
I have been playing with this, I was able to get some basic JS working to find the most recent reply and read it aloud using the built in SpeechSynthesizer API.
~/.chatgpt/main.js
file:// Say command: read text aloud
function say(text) {
speechSynthesis.speak(new SpeechSynthesisUtterance(text))
}
// Find the most recent reply
function lastReply() {
const replies = document.getElementsByClassName('prose')
const last = replies[replies.length - 1]
return last.textContent
}
// Register a sayLast function to the global window so we can call it later.
window.sayLast = () => say(lastReply())
// Register hotkey Cmd+S (Ctrl+S on Windows) to start/stop
document.addEventListener('keydown', function (event) {
// Ctrl + S or Cmd + S hotkey
if ((event.ctrlKey || event.metaKey) && event.key === 's') {
if (speechSynthesis.speaking) {
speechSynthesis.cancel()
} else {
sayLast()
}
event.preventDefault() // Prevent the default action of saving the page
}
})
console.log('sayLast() 🔈 function installed, Cmd + S hotkey to activate')
Then in a conversation, I can press Cmd+S
to have the most recent answer read aloud.
Previous: Then in a conversation, I open the Dev Tools (Right click > Inspect Element
), switch to the Console
tab, and can invoke the sayLast()
function to have ChatGPT's most recent reply read aloud.
The hotkey works pretty well for me, but some other options:
Can voice engine pronounce bilingual text?Now I can only select on lingua in the setting
Can voice engine pronounce bilingual text?Now I can only select on lingua in the setting
It is a built-in browser API and does not seem to support multilingual synthesis.
it would be better also to use Edge TTS
Can I use ElevenLabs for the TTS?
https://api.elevenlabs.io/docs#/voices/Get_voices_v1_voices_get
There is "No Data" when I choose Set Speech Language. Dose anyone could tell me way?
There is "No Data" when I choose Set Speech Language. Dose anyone could tell me way?
Workaround: open developer tools, execute speechSynthesis.getVoices()
in the console and copy the voiceURI to the speech_lang
parameter in chat.conf.json
The workaround doesn't work on Ubuntu 23.04:
> speechSynthesis.getVoices()
> ReferenceError: Can't find variable: speechSynthesis
Any idea?
hello
Feature description
Can you add automatic reading function for chatgpt answers? As shown in the figure: I hope that after I say hello, there will be a reading button behind the chatgpt answer (Like those three). Click this button to automatically read the chatgpt answer(
Hello! How can I assist you today?
)Motivation
I just think it can be beneficial to learning, because chatgpt originally supports multiple languages. When I have to ask questions in an unskilled language, reading can help me understand better and will be more interesting. Thanks!!!
Alternatives
No response
Additional context
No response