Added a button to manually isnert the OpenAI Comp Model. Fixes #205

This commit is contained in:
mic 2024-12-25 20:15:44 +01:00
parent 4289f4eb0e
commit eb2c07b143
3 changed files with 22 additions and 0 deletions

View file

@ -874,5 +874,13 @@
"prefs_SurveyLinkText2": {
"message": "Click here, it only takes a minute!",
"description": ""
},
"prefs_OpenAIComp_ForceModel": {
"message": "Manually insert model",
"description": ""
},
"OpenAIComp_force_model_ask": {
"message": "Insert here the model name you want to use.",
"description": ""
}
}

View file

@ -239,6 +239,7 @@
<td>
<label>
<span>__MSG_OpenAIComp_Models__</span>
<br><button id="btnOpenAICompForceModel" class="btn_small">__MSG_prefs_OpenAIComp_ForceModel__</button></td>
</label>
</td>
<td>

View file

@ -276,6 +276,19 @@ document.addEventListener('DOMContentLoaded', async () => {
})
});
document.getElementById('btnOpenAICompForceModel').addEventListener('click', () => {
let modelName = prompt(browser.i18n.getMessage('OpenAIComp_force_model_ask')).trim();
if ((modelName !== null) && (modelName !== undefined) && (modelName !== '')) {
let select_openai_comp_model = document.getElementById('openai_comp_model');
let option = document.createElement('option');
option.value = modelName;
option.text = modelName;
select_openai_comp_model.appendChild(option);
select_openai_comp_model.value = modelName;
select_openai_comp_model.dispatchEvent(new Event('change', { bubbles: true }));
}
});
let conntype_select = document.getElementById("connection_type");
conntype_select.addEventListener("change", showConnectionOptions);
conntype_select.addEventListener("change", warn_ChatGPT_APIKeyEmpty);