Add model to presets. Fix restoration on app load
This commit is contained in:
parent
aa0eecd17e
commit
fcfa15a5ad
|
@ -2950,7 +2950,7 @@
|
|||
</div>
|
||||
<h4 data-i18n="Select a Model">Select a Model</h4>
|
||||
<div class="flex-container">
|
||||
<select id="model_blockentropy_select" class="text_pole model_blockentropy_select"></select>
|
||||
<select id="model_blockentropy_select" class="text_pole"></select>
|
||||
</div>
|
||||
</form>
|
||||
<form id="custom_form" data-source="custom">
|
||||
|
|
|
@ -1662,9 +1662,9 @@ function saveModelList(data) {
|
|||
}
|
||||
|
||||
if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) {
|
||||
$('.model_blockentropy_select').empty();
|
||||
$('#model_blockentropy_select').empty();
|
||||
model_list.forEach((model) => {
|
||||
$('.model_blockentropy_select').append(
|
||||
$('#model_blockentropy_select').append(
|
||||
$('<option>', {
|
||||
value: model.id,
|
||||
text: model.id,
|
||||
|
@ -3037,6 +3037,7 @@ function loadOpenAISettings(data, settings) {
|
|||
oai_settings.cohere_model = settings.cohere_model ?? default_settings.cohere_model;
|
||||
oai_settings.perplexity_model = settings.perplexity_model ?? default_settings.perplexity_model;
|
||||
oai_settings.groq_model = settings.groq_model ?? default_settings.groq_model;
|
||||
oai_settings.blockentropy_model = settings.blockentropy_model ?? default_settings.blockentropy_model;
|
||||
oai_settings.zerooneai_model = settings.zerooneai_model ?? default_settings.zerooneai_model;
|
||||
oai_settings.custom_model = settings.custom_model ?? default_settings.custom_model;
|
||||
oai_settings.custom_url = settings.custom_url ?? default_settings.custom_url;
|
||||
|
@ -3115,6 +3116,7 @@ function loadOpenAISettings(data, settings) {
|
|||
$('#model_groq_select').val(oai_settings.groq_model);
|
||||
$(`#model_groq_select option[value="${oai_settings.groq_model}"`).attr('selected', true);
|
||||
$('#model_01ai_select').val(oai_settings.zerooneai_model);
|
||||
$('#model_blockentropy_select').val(oai_settings.blockentropy_model);
|
||||
$('#custom_model_id').val(oai_settings.custom_model);
|
||||
$('#custom_api_url_text').val(oai_settings.custom_url);
|
||||
$('#openai_max_context').val(oai_settings.openai_max_context);
|
||||
|
@ -3376,6 +3378,7 @@ async function saveOpenAIPreset(name, settings, triggerUi = true) {
|
|||
perplexity_model: settings.perplexity_model,
|
||||
groq_model: settings.groq_model,
|
||||
zerooneai_model: settings.zerooneai_model,
|
||||
blockentropy_model: settings.blockentropy_model,
|
||||
custom_model: settings.custom_model,
|
||||
custom_url: settings.custom_url,
|
||||
custom_include_body: settings.custom_include_body,
|
||||
|
@ -3813,6 +3816,7 @@ function onSettingsPresetChange() {
|
|||
perplexity_model: ['#model_perplexity_select', 'perplexity_model', false],
|
||||
groq_model: ['#model_groq_select', 'groq_model', false],
|
||||
zerooneai_model: ['#model_01ai_select', 'zerooneai_model', false],
|
||||
blockentropy_model: ['#model_blockentropy_select', 'blockentropy_model', false],
|
||||
custom_model: ['#custom_model_id', 'custom_model', false],
|
||||
custom_url: ['#custom_api_url_text', 'custom_url', false],
|
||||
custom_include_body: ['#custom_include_body', 'custom_include_body', false],
|
||||
|
@ -4624,6 +4628,9 @@ function toggleChatCompletionForms() {
|
|||
else if (oai_settings.chat_completion_source == chat_completion_sources.CUSTOM) {
|
||||
$('#model_custom_select').trigger('change');
|
||||
}
|
||||
else if (oai_settings.chat_completion_source == chat_completion_sources.BLOCKENTROPY) {
|
||||
$('#model_blockentropy_select').trigger('change');
|
||||
}
|
||||
$('[data-source]').each(function () {
|
||||
const validSources = $(this).data('source').split(',');
|
||||
$(this).toggle(validSources.includes(oai_settings.chat_completion_source));
|
||||
|
|
Loading…
Reference in New Issue