Add reset button for max prompt length in options
This commit is contained in:
parent
75f83a486f
commit
c65bfb5337
2 changed files with 9 additions and 2 deletions
|
|
@ -451,6 +451,7 @@
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input type="number" id="max_prompt_length" name="max_prompt_length" class="option-input" />
|
<input type="number" id="max_prompt_length" name="max_prompt_length" class="option-input" />
|
||||||
|
<button type="button" id="reset_max_prompt_length" class="btn_small" style="margin-left:0.5em;">__MSG_reset_default__</button>
|
||||||
<br>__MSG_prefs_OptionText_max_prompt_length_Info__
|
<br>__MSG_prefs_OptionText_max_prompt_length_Info__
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,12 @@ function resetOpenAICompConfigs(){
|
||||||
let select_openai_comp_model = document.getElementById('openai_comp_services_shortcut');
|
let select_openai_comp_model = document.getElementById('openai_comp_services_shortcut');
|
||||||
select_openai_comp_model.value = 'custom';
|
select_openai_comp_model.value = 'custom';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetMaxPromptLength(){
|
||||||
|
let maxPromptLength = document.getElementById('max_prompt_length');
|
||||||
|
maxPromptLength.value = prefs_default.max_prompt_length;
|
||||||
|
browser.storage.sync.set({max_prompt_length: prefs_default.max_prompt_length});
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', async () => {
|
document.addEventListener('DOMContentLoaded', async () => {
|
||||||
await restoreOptions();
|
await restoreOptions();
|
||||||
|
|
@ -871,7 +876,8 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
document.getElementById('openai_comp_use_v1').dispatchEvent(new Event('change', { bubbles: true }));
|
document.getElementById('openai_comp_use_v1').dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
document.getElementById('openai_comp_chat_name').dispatchEvent(new Event('change', { bubbles: true }));
|
document.getElementById('openai_comp_chat_name').dispatchEvent(new Event('change', { bubbles: true }));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.getElementById('reset_max_prompt_length').addEventListener('click', resetMaxPromptLength);
|
||||||
|
|
||||||
}, { once: true });
|
}, { once: true });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue