Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problemas Talk to chatgtp #239

Open
Mary9523 opened this issue May 3, 2024 · 1 comment
Open

Problemas Talk to chatgtp #239

Mary9523 opened this issue May 3, 2024 · 1 comment

Comments

@Mary9523
Copy link

Mary9523 commented May 3, 2024

Hola, la extensión no me genera voz de la IA, intente actualizar chrome, instalar y desinstalar la extensión, pero no logro solucionarlo. Chatgtp, reconoce mi voz y responde pero responde solo escribiendo sin el sonido de la voz. ¿Qué puedo hacer?

@ionetodeleon
Copy link
Contributor

Holaaaa acá está el fix #238 lo subió @Xustyx.

Tendrias que modificar la función CN_CheckNewMessages() y CN_StartTTGPT() basicamente.

CN_CheckNewMessages():

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);
}

CN_StartTTGPT():

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//PEZAkcRgU6i85YACR0DlBXjIgAILcTDAFlTJq1IDRkYwLadS3pTAps7AngjQYEBJgQIJuiRVA07PbA3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wABMIjKTqtkwcCkZlnhNAYslK1XWemvUOWREqog9UlVVKq4lXKqqxT31dfTS7/////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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants