Enhance ChatGPT Web model selection by adding event listeners for new model inputs and updating HTML structure for better integration in custom prompts

This commit is contained in:
mic 2025-05-02 00:10:59 +02:00
parent eb804860b9
commit a81b9daa54

View file

@ -347,8 +347,25 @@ document.addEventListener('DOMContentLoaded', async () => {
});
getChatGPTWebModelsList_HTML(ChatGPTWeb_models, 'chatgpt_web_models_list');
let formNewWebModelList = document.getElementById('chatgpt_web_models_list');
formNewWebModelList.querySelectorAll('.conntype_chatgpt_web_option').forEach(element => {
element.addEventListener("click", () => {
let el = document.getElementById("chatGPTWebModelNew");
el.value = element.textContent;
el.dispatchEvent(new Event('change'), { bubbles: true });
});
});
document.querySelectorAll('.id_output').forEach(element => {
getChatGPTWebModelsList_HTML(ChatGPTWeb_models, 'chatgpt_web_models_list_' + element.value);
let formWebModelList = document.getElementById('chatgpt_web_models_list_' + element.value);
formWebModelList.querySelectorAll('.conntype_chatgpt_web_option').forEach(element2 => {
element2.addEventListener("click", () => {
let el = document.getElementById("chatgpt_web_model_output_" + element.value);
el.value = element2.textContent;
el.dispatchEvent(new Event('change'), { bubbles: true });
});
});
});
}, { once: true });
@ -636,7 +653,7 @@ function loadPromptsList(values){
<div class="chatgpt_web_additional_info">
<span class="field_title_us">__MSG_prefs_OptionText_chatgpt_web_model__:</span>
<br>
<input type="text" class="input_additional chatgpt_web_model_output" tabindex="10" value="` + values.chatgpt_web_model + `">
<input type="text" id="chatgpt_web_model_output_` + values.id + `" class="input_additional chatgpt_web_model_output" tabindex="10" value="` + values.chatgpt_web_model + `">
<table class="chatgpt_web_models_list_table" title="__MSG_prefs_OptionText_chatgpt_web_model_tooltip__"><tr id="chatgpt_web_models_list_` + values.id + `"></tr></table>
<br><br>
<span class="field_title_us">__MSG_prefs_OptionText_chatgpt_web_project__:</span>