more logs added to chatgpt web itnerface
This commit is contained in:
parent
ccf866a003
commit
503462b9ca
2 changed files with 15 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue