Update prompt length validation message and logic. see #380
This commit is contained in:
parent
6e2b5f268d
commit
0de4dd27c8
2 changed files with 7 additions and 3 deletions
|
|
@ -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": {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue