diff --git a/_locales/en/messages.json b/_locales/en/messages.json index df826eff..82e2f576 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -656,7 +656,7 @@ "description": "" }, "prefs_OptionText_max_prompt_length_Info" : { - "message": "This is the maximum number of characters that can be used in a prompt. Otherwise, an error message will be displayed. The value is not editable for the ChatGPT Web Interface.", + "message": "This is the maximum number of characters that can be used in a prompt. Otherwise, an error message will be displayed. The value is not editable for the ChatGPT Web Interface. Set it to 0 to disable the check.", "description": "" }, "prefs_OptionText_chatgpt_web_model": { diff --git a/mzta-background.js b/mzta-background.js index 4be7c798..08f7846b 100644 --- a/mzta-background.js +++ b/mzta-background.js @@ -326,8 +326,12 @@ async function openChatGPT(promptText, action, curr_tabId, prompt_name = '', do_ //console.log(">>>>>>>>>>>>>>>> prefs: " + JSON.stringify(prefs)); // console.log(">>>>>>>>>>>>>>>> prompt_info: " + JSON.stringify(prompt_info)); taLog.log("Prompt length: " + promptText.length); - if(promptText.length > prefs.max_prompt_length){ - // Prompt too long for ChatGPT + let _max_prompt_length = prefs.max_prompt_length; + if(prefs.connection_type == 'chatgpt_web'){ + _max_prompt_length = prefs_default.max_prompt_length; + } + if((_max_prompt_length > 0) && (promptText.length > _max_prompt_length)){ + // Prompt too long let tabs = await browser.tabs.query({ active: true, currentWindow: true }); browser.tabs.sendMessage(curr_tabId, { command: "sendAlert", curr_tab_type: tabs[0].type, message: browser.i18n.getMessage('msg_prompt_too_long') }); return;