Merge branch 'main' into 2.1.0

This commit is contained in:
Mic 2024-08-28 21:48:44 +02:00 committed by GitHub
commit e4bfbcf0ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 33 additions and 5 deletions

View file

@ -13,6 +13,13 @@
<li><i>[ChatGPT API][Ollama API]</i> Added a status message to give feedback to the user about the current operation [<a href="https://github.com/micz/ThunderAI/issues/119">#119</a>].</li> <li><i>[ChatGPT API][Ollama API]</i> Added a status message to give feedback to the user about the current operation [<a href="https://github.com/micz/ThunderAI/issues/119">#119</a>].</li>
<li>Improved the internal messaging system between the background script and the chat windows [<a href="https://github.com/micz/ThunderAI/issues/117">#117</a>].</li> <li>Improved the internal messaging system between the background script and the chat windows [<a href="https://github.com/micz/ThunderAI/issues/117">#117</a>].</li>
<li>...</li> <li>...</li>
<h2>Version 2.0.7 - 21/08/2024</h2>
<ul>
<li><i>[ChatGPT Web]</i> Fixed an issue with automatically sending the prompt.</li>
</ul>
<h2>Version 2.0.6 - 19/08/2024</h2>
<ul>
<li>Some minor improvements.</li>
</ul> </ul>
<h2>Version 2.0.5 - 19/08/2024</h2> <h2>Version 2.0.5 - 19/08/2024</h2>
<ul> <ul>

View file

@ -28,8 +28,8 @@ let selectionChangeTimeout = null;
let isDragging = false; let isDragging = false;
async function chatgpt_sendMsg(msg, method ='') { // return -1 send button not found, -2 textarea not found async function chatgpt_sendMsg(msg, method ='') { // return -1 send button not found, -2 textarea not found
const textArea = document.querySelector('form textarea'), const textArea = document.querySelector('form textarea');
sendButton = document.querySelector('path[d*="M15.192 8.906a1.143"]')?.parentNode.parentNode // post-GPT-4o; let sendButton = document.querySelector('path[d*="M15.192 8.906a1.143"]')?.parentNode.parentNode // post-GPT-4o;
|| document.querySelector('[data-testid="send-button"]'); // pre-GPT-4o || document.querySelector('[data-testid="send-button"]'); // pre-GPT-4o
//check if the textarea has been found //check if the textarea has been found
if(!textArea) { if(!textArea) {
@ -42,10 +42,15 @@ async function chatgpt_sendMsg(msg, method ='') { // return -1 send button
return -1; return -1;
} }
const delaySend = setInterval(() => { const delaySend = setInterval(() => {
//console.log(">>>>>>>>>> sendButton disabled: " + sendButton?.hasAttribute('disabled'));
if (!sendButton?.hasAttribute('disabled')) { // send msg if (!sendButton?.hasAttribute('disabled')) { // send msg
method.toLowerCase() == 'click' ? sendButton.click() method.toLowerCase() == 'click' ? sendButton.click()
: textArea.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 13, bubbles: true })); : textArea.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 13, bubbles: true }));
clearInterval(delaySend); clearInterval(delaySend);
}else{
//console.error(">>>>>>>>>> The sendButton seems to be disabled! Trying again...");
sendButton = document.querySelector('path[d*="M15.192 8.906a1.143"]')?.parentNode.parentNode // post-GPT-4o;
|| document.querySelector('[data-testid="send-button"]');
} }
}, 25); }, 25);
return 0; //everything is ok return 0; //everything is ok
@ -283,6 +288,7 @@ async function doProceed(message, customText = ''){
} }
//await chatgpt.isLoaded(); //await chatgpt.isLoaded();
let send_result = await chatgpt_sendMsg(message.prompt+' '+customText,'click'); let send_result = await chatgpt_sendMsg(message.prompt+' '+customText,'click');
console.log(">>>>>>>>>>> send_result: " + send_result);
switch(send_result){ switch(send_result){
case -1: // send button not found case -1: // send button not found
let curr_msg = document.getElementById('mzta-curr_msg'); let curr_msg = document.getElementById('mzta-curr_msg');

View file

@ -43,9 +43,17 @@ let messageTabs = openTabs.filter(
tab => ["mail", "messageDisplay"].includes(tab.type) tab => ["mail", "messageDisplay"].includes(tab.type)
); );
for (let messageTab of messageTabs) { for (let messageTab of messageTabs) {
browser.tabs.executeScript(messageTab.id, { if((messageTab.url == undefined) || (["start.thunderbird.net","about:blank"].some(blockedUrl => messageTab.url.includes(blockedUrl)))) {
file: "js/mzta-compose-script.js" continue;
}) }
try {
await browser.tabs.executeScript(messageTab.id, {
file: "js/mzta-compose-script.js"
})
} catch (error) {
console.error("[ThunderAI] Error injecting message display script:", error);
console.error("[ThunderAI] Message tab:", messageTab.url);
}
} }
messenger.runtime.onMessage.addListener(async (message, sender, sendResponse) => { messenger.runtime.onMessage.addListener(async (message, sender, sendResponse) => {

View file

@ -17,6 +17,13 @@
<li><i>[ChatGPT API][Ollama API]</i> Added a status message to give feedback to the user about the current operation [<a href="https://github.com/micz/ThunderAI/issues/119">#119</a>].</li> <li><i>[ChatGPT API][Ollama API]</i> Added a status message to give feedback to the user about the current operation [<a href="https://github.com/micz/ThunderAI/issues/119">#119</a>].</li>
<li>Improved the internal messaging system between the background script and the chat windows [<a href="https://github.com/micz/ThunderAI/issues/117">#117</a>].</li> <li>Improved the internal messaging system between the background script and the chat windows [<a href="https://github.com/micz/ThunderAI/issues/117">#117</a>].</li>
<li>...</li> <li>...</li>
<h2>Version 2.0.7 - 21/08/2024</h2>
<ul>
<li><i>[ChatGPT Web]</i> Fixed an issue with automatically sending the prompt.</li>
</ul>
<h2>Version 2.0.6 - 19/08/2024</h2>
<ul>
<li>Some minor improvements.</li>
</ul> </ul>
<h2>Version 2.0.5 - 19/08/2024</h2> <h2>Version 2.0.5 - 19/08/2024</h2>
<ul> <ul>