commit
c128920e0e
7 changed files with 25 additions and 6 deletions
|
|
@ -694,5 +694,9 @@
|
|||
"prefs_OptionText_owl_warning": {
|
||||
"message": "It appears that at least one of your accounts is using the Owl for Exchange add-on. There is a known issue between Thunderbird and Owl, which is currently being addressed. At this time, you can use ThunderAI while composing emails, but not when reading them.",
|
||||
"description": ""
|
||||
},
|
||||
"prefs_OptionText_chatgpt_web_model_tooltip": {
|
||||
"message": "Click on a value to set it.",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
|
|
@ -246,6 +246,7 @@ function customTextBtnClick(args) {
|
|||
|
||||
function checkGPTModel(model) { //TODO
|
||||
if(model == '') return;
|
||||
doLog("checkGPTModel model: " + model);
|
||||
return new Promise((resolve, reject) => {
|
||||
// Set up an interval that shows the warning after 2 seconds
|
||||
const intervalId2 = setTimeout(() => {
|
||||
|
|
@ -260,8 +261,9 @@ function checkGPTModel(model) { //TODO
|
|||
|
||||
for(element of elements){
|
||||
// Check if the element exists and its content is '4' or '4o'
|
||||
doLog("checkGPTModel model found in DOM: " + element.textContent);
|
||||
if ((element && element.textContent === model)||(force_go)) {
|
||||
console.log("[ThunderAI] The GPT Model is now " + model);
|
||||
doLog("The GPT Model is now " + model);
|
||||
clearInterval(intervalId);
|
||||
clearTimeout(intervalId2);
|
||||
document.getElementById('mzta-model_warn').style.display = 'none';
|
||||
|
|
@ -269,7 +271,7 @@ function checkGPTModel(model) { //TODO
|
|||
resolve(model);
|
||||
break;
|
||||
} else if (!element) {
|
||||
console.error("[ThunderAI] Model string element not found! [" + model + "]");
|
||||
console.error("[ThunderAI | ChatGPT Web] Model string element not found! [" + model + "]");
|
||||
clearInterval(intervalId);
|
||||
reject("Model string element not found: " + model);
|
||||
}
|
||||
|
|
@ -302,6 +304,7 @@ function showCustomTextField(){
|
|||
|
||||
async function doProceed(message, customText = ''){
|
||||
let _gpt_model = mztaGPTModel;
|
||||
doLog("doProceed _gpt_model: " + JSON.stringify(_gpt_model));
|
||||
if(_gpt_model != ''){
|
||||
await checkGPTModel(_gpt_model);
|
||||
}
|
||||
|
|
@ -524,6 +527,12 @@ function selectContentOnClick(event) {
|
|||
}
|
||||
}
|
||||
|
||||
function doLog(msg){
|
||||
if(mztaDoDebug == 1){
|
||||
console.log("[ThunderAI | ChatGPT Web] " + msg);
|
||||
}
|
||||
}
|
||||
|
||||
function run(){
|
||||
if(!checkLoggedIn()){
|
||||
// User not logged in
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ export function getGPTWebModelString(model) {
|
|||
case 'gpt-4o-mini':
|
||||
return '4o mini';
|
||||
default:
|
||||
return '4o';
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"manifest_version": 2,
|
||||
"name": "ThunderAI",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"version": "2.3.2",
|
||||
"version": "2.3.2_i176_v1",
|
||||
"author": "Mic (m@micz.it)",
|
||||
"homepage_url": "https://micz.it/thunderbird-addon-thunderai/",
|
||||
"browser_specific_settings": {
|
||||
|
|
|
|||
|
|
@ -288,6 +288,9 @@ async function openChatGPT(promptText, action, curr_tabId, prompt_name = '', do_
|
|||
taLog.log("ChatGPT web interface script started...");
|
||||
|
||||
let _gpt_model = getGPTWebModelString(prefs.chatgpt_web_model);
|
||||
|
||||
taLog.log("prefs.chatgpt_web_model: " + prefs.chatgpt_web_model);
|
||||
taLog.log("_gpt_model: " + _gpt_model);
|
||||
|
||||
let pre_script = `let mztaWinId = `+ createdTab.windowId +`;
|
||||
let mztaStatusPageDesc="`+ browser.i18n.getMessage("prefs_status_page") +`";
|
||||
|
|
@ -297,6 +300,7 @@ async function openChatGPT(promptText, action, curr_tabId, prompt_name = '', do_
|
|||
let mztaPromptName="[`+ i18nConditionalGet(prompt_name) +`]";
|
||||
let mztaPhDefVal="`+(prefs.placeholders_use_default_value?'1':'0')+`";
|
||||
let mztaGPTModel="`+ _gpt_model +`";
|
||||
let mztaDoDebug="`+(prefs.do_debug?'1':'0')+`";
|
||||
`;
|
||||
|
||||
taLog.log("Waiting 1 sec");
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@
|
|||
<tr class="conntype_chatgpt_web">
|
||||
<td><label>
|
||||
<span>__MSG_prefs_OptionText_chatgpt_web_model__</span>
|
||||
<br><table><tr><td><i style="font-size:smaller;"><nobr>__MSG_AllowedValues__:</nobr></i></td><td><i style="font-size:smaller;"> <nobr class="conntype_chatgpt_web_option">gpt-4o</nobr> <nobr class="conntype_chatgpt_web_option">gpt-4o-mini</nobr> <nobr class="conntype_chatgpt_web_option">gpt-4</nobr> <nobr class="conntype_chatgpt_web_option">o1-mini</nobr> <nobr class="conntype_chatgpt_web_option">o1-preview</nobr></i></td></tr></table>
|
||||
<br><table title="__MSG_prefs_OptionText_chatgpt_web_model_tooltip__"><tr><td><i style="font-size:smaller;"><nobr>__MSG_AllowedValues__:</nobr></i></td><td><i style="font-size:smaller;"> <nobr class="conntype_chatgpt_web_option">gpt-4o</nobr> <nobr class="conntype_chatgpt_web_option">gpt-4o-mini</nobr> <nobr class="conntype_chatgpt_web_option">gpt-4</nobr> <nobr class="conntype_chatgpt_web_option">o1-mini</nobr> <nobr class="conntype_chatgpt_web_option">o1-preview</nobr></i></td></tr></table>
|
||||
</label></td>
|
||||
<td>
|
||||
<label>
|
||||
|
|
|
|||
|
|
@ -228,7 +228,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
});
|
||||
document.querySelectorAll(".conntype_chatgpt_web_option").forEach(element => {
|
||||
element.addEventListener("click", () => {
|
||||
document.getElementById("chatgpt_web_model").value = element.textContent;
|
||||
let el = document.getElementById("chatgpt_web_model");
|
||||
el.value = element.textContent;
|
||||
el.dispatchEvent(new Event('change'), { bubbles: true });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue