if the chatgpt web interface loads slowly, show abutton to retry sending the prompt. see #122

This commit is contained in:
mic 2024-09-03 22:09:00 +02:00
parent 7a0173cd41
commit 319f289b84
5 changed files with 37 additions and 6 deletions

View file

@ -220,7 +220,7 @@
"description": ""
},
"chatgpt_textarea_not_found_error": {
"message": "Es gibt einen Fehler beim Senden der Eingabeaufforderung an ChatGPT. Bitte versuchen Sie es erneut. Wenn das Problem weiterhin besteht, überprüfen Sie bitte den <a href=\"$URL$\">Dienststatus</a>.",
"message": "Es scheint, dass die ChatGPT-Seite zu lange zum Laden braucht. Wenn sie fertig geladen ist, klicken Sie auf den Button rechts. Wenn das Problem weiterhin besteht, überprüfen Sie bitte den <a href=\"$URL$\">Dienststatus</a>.",
"description": "",
"placeholders": {
"url": {
@ -229,6 +229,10 @@
}
}
},
"chatgpt_btn_retry": {
"message": "Wiederholen",
"description": ""
},
"chatgpt_sendbutton_not_found_error": {
"message": "Klicken Sie auf die Schaltfläche „Senden“, um die Eingabeaufforderung zu übermitteln.",
"description": ""

View file

@ -220,7 +220,7 @@
"description": ""
},
"chatgpt_textarea_not_found_error": {
"message": "There is an error sending the prompt to ChatGPT, please retry. If the problem persists, please <a href=\"$URL$\">check the service status</a>.",
"message": "It seems that the ChatGPT page is taking too long to load. If it finishes loading, click the button on the right. If the problem persists, please <a href=\"$URL$\">check the service status</a>.",
"description": "",
"placeholders": {
"url": {
@ -229,6 +229,10 @@
}
}
},
"chatgpt_btn_retry": {
"message": "Retry",
"description": ""
},
"chatgpt_sendbutton_not_found_error": {
"message": "Click the send button to submit the prompt.",
"description": ""

View file

@ -220,7 +220,7 @@
"description": ""
},
"chatgpt_textarea_not_found_error": {
"message": "Il y a une erreur lors de l'envoi de la proposition à ChatGPT, veuillez réessayer. Si le problème persiste, veuillez <a href=\"$URL$\">vérifier le statut du service</a>.",
"message": "Il semble que la page ChatGPT mette trop de temps à charger. Si elle finit de charger, cliquez sur le bouton à droite. Si le problème persiste, veuillez <a href=\"$URL$\">vérifier le statut du service</a>.",
"description": "",
"placeholders": {
"url": {
@ -229,6 +229,10 @@
}
}
},
"chatgpt_btn_retry": {
"message": "Réessayer",
"description": ""
},
"chatgpt_sendbutton_not_found_error": {
"message": "Cliquez sur le bouton d'envoi pour soumettre la proposition.",
"description": ""

View file

@ -220,7 +220,7 @@
"description": ""
},
"chatgpt_textarea_not_found_error": {
"message": "C'è stato un errore nell'invio del prompt a ChatGPT, per favore riprova. Se il problema persiste, per favore <a href=\"$URL$\">controlla lo stato del servizio</a>.",
"message": "Sembra che la pagina di ChatGPT impieghi troppo tempo a caricarsi. Se finisce di caricarsi, clicca sul pulsante a destra. Se il problema persiste, per favore <a href=\"$URL$\">controlla lo stato del servizio</a>.",
"description": "",
"placeholders": {
"url": {
@ -229,6 +229,10 @@
}
}
},
"chatgpt_btn_retry": {
"message": "Riprova",
"description": ""
},
"chatgpt_sendbutton_not_found_error": {
"message": "Premi il pulsante per inviare il prompt a ChatGPT.",
"description": ""

View file

@ -288,7 +288,7 @@ async function doProceed(message, customText = ''){
}
//await chatgpt.isLoaded();
let send_result = await chatgpt_sendMsg(message.prompt+' '+customText,'click');
console.log(">>>>>>>>>>> send_result: " + send_result);
//console.log(">>>>>>>>>>> send_result: " + send_result);
switch(send_result){
case -1: // send button not found
let curr_msg = document.getElementById('mzta-curr_msg');
@ -308,12 +308,27 @@ async function doProceed(message, customText = ''){
curr_model_warn.style.display = 'inline-block';
document.getElementById('mzta-curr_msg').textContent = "";
document.getElementById('mzta-loading').style.display = 'none';
let btn_retry = document.createElement('button');
btn_retry.id="mzta-btn_retry";
btn_retry.classList.add('mzta-btn');
btn_retry.style.position = 'absolute';
btn_retry.style.top = '5px';
btn_retry.style.right = '5px';
btn_retry.textContent = browser.i18n.getMessage("chatgpt_btn_retry");
btn_retry.addEventListener('click', function() {
doRetry();
});
curr_model_warn.insertAdjacentElement('afterend', btn_retry);
break;
}
await chatgpt_isIdle();
operation_done();
}
function doRetry(){
doProceed(current_message);
}
function removeTagsAndReturnHTML(rootElement, removeTags, preserveTags) {
const fragment = document.createDocumentFragment();
@ -486,10 +501,10 @@ browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
alert(browser.i18n.getMessage("chatgpt_user_not_logged_in"));
}else{
current_action = message.action;
current_message = message;
addCustomDiv(message.action,message.tabId,message.mailMessageId);
(async () => {
if(mztaDoCustomText === 1){
current_message = message;
showCustomTextField();
} else {
await doProceed(message);