[chatgpt web] Now it is possible to specify the model to use and the temporary chat. see #169 and #171
This commit is contained in:
parent
ad69beff9c
commit
e40fc8163e
5 changed files with 54 additions and 3 deletions
|
|
@ -642,5 +642,21 @@
|
|||
"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.",
|
||||
"description": ""
|
||||
},
|
||||
"prefs_OptionText_chatgpt_web_model": {
|
||||
"message": "ChatGPT Web model",
|
||||
"description": ""
|
||||
},
|
||||
"prefs_OptionText_chatgpt_web_model_info": {
|
||||
"message": "This is the model that will be enforced for the ChatGPT Web Interface. If none is specified or an incorrect one is provided, the default model will be set by ChatGPT on the webpage.",
|
||||
"description": ""
|
||||
},
|
||||
"prefs_OptionText_chatgpt_web_tempchat": {
|
||||
"message": "ChatGPT Web temporary chat",
|
||||
"description": ""
|
||||
},
|
||||
"prefs_OptionText_chatgpt_web_tempchat_info": {
|
||||
"message": "If checked, the temporary chat will be used in the ChatGPT Web Interface.",
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ async function chatgpt_isIdle() {
|
|||
}}, 100);});}
|
||||
|
||||
function chatgpt_getRegenerateButton() {
|
||||
for (const mainSVG of document.querySelectorAll('main svg')) {
|
||||
for (const mainSVG of document.querySelectorAll('main svg.icon-md')) {
|
||||
if (mainSVG.querySelector('path[d^="M3.06957"]')) // regen icon found
|
||||
return mainSVG.parentNode.parentNode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ async function openChatGPT(promptText, action, curr_tabId, prompt_name = '', do_
|
|||
taLog.changeDebug(prefs.do_debug);
|
||||
prefs = checkScreenDimensions(prefs);
|
||||
//console.log(">>>>>>>>>>>>>>>> prefs: " + JSON.stringify(prefs));
|
||||
taLog.log("[ThunderAI] Prompt length: " + promptText.length);
|
||||
taLog.log("Prompt length: " + promptText.length);
|
||||
if(promptText.length > prefs.max_prompt_length){
|
||||
// Prompt too long for ChatGPT
|
||||
let tabs = await browser.tabs.query({ active: true, currentWindow: true });
|
||||
|
|
@ -259,9 +259,20 @@ async function openChatGPT(promptText, action, curr_tabId, prompt_name = '', do_
|
|||
// We are using the ChatGPT web interface
|
||||
|
||||
let rand_call_id = '_chatgptweb_' + generateCallID();
|
||||
let call_opt = '';
|
||||
|
||||
if(prefs.chatgpt_web_tempchat){
|
||||
call_opt += '&temporary-chat=true';
|
||||
}
|
||||
|
||||
if(prefs.chatgpt_web_model != ''){
|
||||
call_opt += '&model=' + encodeURIComponent(prefs.chatgpt_web_model).toLowerCase();
|
||||
}
|
||||
|
||||
taLog.log("[chatgpt_web] call_opt: " + call_opt);
|
||||
|
||||
let win_options = {
|
||||
url: "https://chatgpt.com?call_id=" + rand_call_id,
|
||||
url: "https://chatgpt.com?call_id=" + rand_call_id + call_opt,
|
||||
type: "popup",
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ export const prefs_default = {
|
|||
chatgpt_win_width: 700,
|
||||
default_chatgpt_lang: '',
|
||||
connection_type: 'chatgpt_web', //Other values: 'chatgpt_api', 'ollama_api', 'openai_comp_api'
|
||||
chatgpt_web_model: '',
|
||||
chatgpt_web_tempchat: false,
|
||||
chatgpt_api_key: '',
|
||||
chatgpt_model: '',
|
||||
ollama_host: '',
|
||||
|
|
|
|||
|
|
@ -110,6 +110,28 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="conntype_chatgpt_web">
|
||||
<td><label>
|
||||
<span>__MSG_prefs_OptionText_chatgpt_web_model__</span>
|
||||
</label></td>
|
||||
<td>
|
||||
<label>
|
||||
<input type="text" id="chatgpt_web_model" name="chatgpt_web_model" class="option-input" />
|
||||
<br>__MSG_prefs_OptionText_chatgpt_web_model_info__
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="conntype_chatgpt_web">
|
||||
<td><label>
|
||||
<span>__MSG_prefs_OptionText_chatgpt_web_tempchat__</span>
|
||||
</label></td>
|
||||
<td>
|
||||
<label>
|
||||
<input type="checkbox" id="chatgpt_web_tempchat" name="chatgpt_web_tempchat" class="option-input" />
|
||||
<span>__MSG_prefs_OptionText_chatgpt_web_tempchat_info__</span>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="conntype_chatgpt_web">
|
||||
<td><label>
|
||||
<span>__MSG_OpenChatGPTTab_Info__</span>
|
||||
|
|
|
|||
Loading…
Reference in a new issue