diff --git a/_locales/de/messages.json b/_locales/de/messages.json index d84756e8..3b4b343a 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -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 Dienststatus.", + "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 Dienststatus.", "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": "" diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ac3705c3..a1c66406 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -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 check the service status.", + "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 check the service status.", "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": "" diff --git a/_locales/fr/messages.json b/_locales/fr/messages.json index 89dd788e..749c17e4 100644 --- a/_locales/fr/messages.json +++ b/_locales/fr/messages.json @@ -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 vérifier le statut du service.", + "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 vérifier le statut du service.", "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": "" diff --git a/_locales/it/messages.json b/_locales/it/messages.json index bbaa3ed1..ac8d9028 100644 --- a/_locales/it/messages.json +++ b/_locales/it/messages.json @@ -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 controlla lo stato del servizio.", + "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 controlla lo stato del servizio.", "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": "" diff --git a/js/mzta-chatgpt.js b/js/mzta-chatgpt.js index 10c19ebf..89f46e7a 100644 --- a/js/mzta-chatgpt.js +++ b/js/mzta-chatgpt.js @@ -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);