Improved the internal messaging in closing che chatgpt web and api windows
This commit is contained in:
parent
3281d5c72d
commit
5fe74083ea
2 changed files with 12 additions and 11 deletions
|
|
@ -235,14 +235,15 @@ class MessagesArea extends HTMLElement {
|
|||
switch(promptData.action) {
|
||||
case "1": // do reply
|
||||
// console.log("[ThunderAI] (do reply) fullTextHTMLAtAssignment: " + fullTextHTMLAtAssignment);
|
||||
browser.runtime.sendMessage({command: "chatgpt_replyMessage", text: fullTextHTMLAtAssignment, tabId: promptData.tabId, mailMessageId: promptData.mailMessageId});
|
||||
browser.runtime.sendMessage({command: "chatgpt_close"});
|
||||
browser.runtime.sendMessage({command: "chatgpt_replyMessage", text: fullTextHTMLAtAssignment, tabId: promptData.tabId, mailMessageId: promptData.mailMessageId}).then(() => {
|
||||
browser.runtime.sendMessage({command: "chatgpt_close"});
|
||||
});
|
||||
break;
|
||||
case "2": // replace text
|
||||
// console.log("[ThunderAI] (replace text) fullTextHTMLAtAssignment: " + fullTextHTMLAtAssignment);
|
||||
browser.runtime.sendMessage({command: "chatgpt_replaceSelectedText", text: fullTextHTMLAtAssignment, tabId: promptData.tabId, mailMessageId: promptData.mailMessageId});
|
||||
//console.log(response);
|
||||
browser.runtime.sendMessage({command: "chatgpt_close"});
|
||||
browser.runtime.sendMessage({command: "chatgpt_replaceSelectedText", text: fullTextHTMLAtAssignment, tabId: promptData.tabId, mailMessageId: promptData.mailMessageId}).then(() => {
|
||||
browser.runtime.sendMessage({command: "chatgpt_close"});
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -167,9 +167,9 @@ function addCustomDiv(prompt_action,tabId,mailMessageId) {
|
|||
btn_ok.textContent = browser.i18n.getMessage("chatgpt_win_get_answer");
|
||||
btn_ok.onclick = async function() {
|
||||
const response = getSelectedHtml();
|
||||
browser.runtime.sendMessage({command: "chatgpt_replyMessage", text: response, tabId: tabId, mailMessageId: mailMessageId});
|
||||
//console.log(response);
|
||||
browser.runtime.sendMessage({command: "chatgpt_close"});
|
||||
browser.runtime.sendMessage({command: "chatgpt_replyMessage", text: response, tabId: tabId, mailMessageId: mailMessageId}).then(() => {
|
||||
browser.runtime.sendMessage({command: "chatgpt_close"});
|
||||
});
|
||||
};
|
||||
break;
|
||||
case "2": // replace text
|
||||
|
|
@ -178,9 +178,9 @@ function addCustomDiv(prompt_action,tabId,mailMessageId) {
|
|||
btn_ok.onclick = async function() {
|
||||
const response = getSelectedHtml();
|
||||
//console.log('replace text: '+tabId)
|
||||
browser.runtime.sendMessage({command: "chatgpt_replaceSelectedText", text: response, tabId: tabId, mailMessageId: mailMessageId});
|
||||
//console.log(response);
|
||||
browser.runtime.sendMessage({command: "chatgpt_close"});
|
||||
browser.runtime.sendMessage({command: "chatgpt_replaceSelectedText", text: response, tabId: tabId, mailMessageId: mailMessageId}).then(() => {
|
||||
browser.runtime.sendMessage({command: "chatgpt_close"});
|
||||
});
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue