From 0f3495043c2cee0616172a43b916ae0ba4fa6448 Mon Sep 17 00:00:00 2001 From: Mic Date: Sun, 31 Aug 2025 15:46:00 +0200 Subject: [PATCH] Added a message to explain to click on force completion after 7 seconds. see #419 --- _locales/en/messages.json | 4 ++++ js/mzta-chatgpt.js | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 1117df79..d77738c4 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -1632,5 +1632,9 @@ "OpenAIComp_ClearModelsList_Confirm": { "message": "Are you sure you want to clear the Models List? This action cannot be undone.", "description": "" + }, + "chatgpt_click_force_completion": { + "message": "It seems that it's not possible to get if ChatGPT has finished. Click here to force the completion of the job.", + "description": "" } } \ No newline at end of file diff --git a/js/mzta-chatgpt.js b/js/mzta-chatgpt.js index 822c4d32..c335b955 100644 --- a/js/mzta-chatgpt.js +++ b/js/mzta-chatgpt.js @@ -29,6 +29,7 @@ let current_tabId = null; let current_mailMessageId = null; let selectionChangeTimeout = null; let isDragging = false; +let delay_wait_completion = 7000; // milliseconds async function chatgpt_sendMsg(msg, method ='') { // return -1 send button not found, -2 textarea not found let textArea = document.getElementById('prompt-textarea') @@ -77,8 +78,8 @@ async function chatgpt_sendMsg(msg, method ='') { // return -1 send button async function chatgpt_isIdle() { return new Promise(resolve => { const intervalId = setInterval(() => { - if (chatgpt_getRegenerateButton() || do_force_completion) { - clearInterval(intervalId); resolve(true); + if (chatgpt_getRegenerateButton() || do_force_completion) { + clearInterval(intervalId); resolve(true); }}, 100);});} function chatgpt_getRegenerateButton() { @@ -132,6 +133,9 @@ function addCustomDiv(prompt_action,tabId,mailMessageId) { style.textContent += "#mzta-btn_close_diff{position:absolute;bottom:10px;left:50%;transform:translateX(-50%);}"; style.textContent += "#mzta-btn_change_reply_type{padding-left:4px;padding-right:10px;margin-left:0px;border-bottom-left-radius:0px;border-top-left-radius:0px;height:2.7em;}"; style.textContent += ".mzta-btn_reply{padding-right:4px;margin-right:0px;border-bottom-right-radius:0px;border-top-right-radius:0px;}"; + style.textContent += "#mzta-arrow-hint{display:none;position:fixed;bottom:30px;right:90px;width:20em;background: #c3cefeff;color: #111827;padding:10px 14px;border-radius:12px;box-shadow:0 4px 10px rgba(0,0,0,.2);font-size:14px;font-weight:bold;z-index:2000;pointer-events:none;}"; + style.textContent += "#mzta-arrow-hint .label{display:block;line-height:1.3;}"; + style.textContent += "#mzta-arrow-hint svg{position:absolute;bottom:-10px;right:-20px;width:40px;height:40px;}"; // Add