#1343 Add status check bypass
This commit is contained in:
parent
4c0b3fb7ae
commit
7afe9e6481
|
@ -1742,6 +1742,10 @@
|
||||||
<optgroup id="openai_external_category" label="External">
|
<optgroup id="openai_external_category" label="External">
|
||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
|
<label for="openai_bypass_status_check" class="checkbox_label">
|
||||||
|
<input id="openai_bypass_status_check" type="checkbox" />
|
||||||
|
<span data-i18n="Bypass API status check">Bypass API status check</span>
|
||||||
|
</label>
|
||||||
<label for="openai_show_external_models" class="checkbox_label">
|
<label for="openai_show_external_models" class="checkbox_label">
|
||||||
<input id="openai_show_external_models" type="checkbox" />
|
<input id="openai_show_external_models" type="checkbox" />
|
||||||
<span data-i18n="Show External models (provided by API)">Show "External" models (provided by API)</span>
|
<span data-i18n="Show External models (provided by API)">Show "External" models (provided by API)</span>
|
||||||
|
@ -4676,4 +4680,4 @@
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -223,6 +223,7 @@ const default_settings = {
|
||||||
use_alt_scale: false,
|
use_alt_scale: false,
|
||||||
squash_system_messages: false,
|
squash_system_messages: false,
|
||||||
image_inlining: false,
|
image_inlining: false,
|
||||||
|
bypass_status_check: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const oai_settings = {
|
const oai_settings = {
|
||||||
|
@ -270,6 +271,7 @@ const oai_settings = {
|
||||||
use_alt_scale: false,
|
use_alt_scale: false,
|
||||||
squash_system_messages: false,
|
squash_system_messages: false,
|
||||||
image_inlining: false,
|
image_inlining: false,
|
||||||
|
bypass_status_check: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let openai_setting_names;
|
let openai_setting_names;
|
||||||
|
@ -2209,6 +2211,7 @@ function loadOpenAISettings(data, settings) {
|
||||||
oai_settings.proxy_password = settings.proxy_password ?? default_settings.proxy_password;
|
oai_settings.proxy_password = settings.proxy_password ?? default_settings.proxy_password;
|
||||||
oai_settings.assistant_prefill = settings.assistant_prefill ?? default_settings.assistant_prefill;
|
oai_settings.assistant_prefill = settings.assistant_prefill ?? default_settings.assistant_prefill;
|
||||||
oai_settings.image_inlining = settings.image_inlining ?? default_settings.image_inlining;
|
oai_settings.image_inlining = settings.image_inlining ?? default_settings.image_inlining;
|
||||||
|
oai_settings.bypass_status_check = settings.bypass_status_check ?? default_settings.bypass_status_check;
|
||||||
|
|
||||||
oai_settings.prompts = settings.prompts ?? default_settings.prompts;
|
oai_settings.prompts = settings.prompts ?? default_settings.prompts;
|
||||||
oai_settings.prompt_order = settings.prompt_order ?? default_settings.prompt_order;
|
oai_settings.prompt_order = settings.prompt_order ?? default_settings.prompt_order;
|
||||||
|
@ -2230,6 +2233,7 @@ function loadOpenAISettings(data, settings) {
|
||||||
$('#openai_proxy_password').val(oai_settings.proxy_password);
|
$('#openai_proxy_password').val(oai_settings.proxy_password);
|
||||||
$('#claude_assistant_prefill').val(oai_settings.assistant_prefill);
|
$('#claude_assistant_prefill').val(oai_settings.assistant_prefill);
|
||||||
$('#openai_image_inlining').prop('checked', oai_settings.image_inlining);
|
$('#openai_image_inlining').prop('checked', oai_settings.image_inlining);
|
||||||
|
$('#openai_bypass_status_check').prop('checked', oai_settings.bypass_status_check);
|
||||||
|
|
||||||
$('#model_openai_select').val(oai_settings.openai_model);
|
$('#model_openai_select').val(oai_settings.openai_model);
|
||||||
$(`#model_openai_select option[value="${oai_settings.openai_model}"`).attr('selected', true);
|
$(`#model_openai_select option[value="${oai_settings.openai_model}"`).attr('selected', true);
|
||||||
|
@ -2354,8 +2358,12 @@ async function getStatusOpen() {
|
||||||
|
|
||||||
const responseData = await response.json();
|
const responseData = await response.json();
|
||||||
|
|
||||||
if (!('error' in responseData))
|
if (responseData.error && responseData.can_bypass && oai_settings.bypass_status_check) {
|
||||||
|
setOnlineStatus('Status check bypassed. Proceed with caution.');
|
||||||
|
}
|
||||||
|
if (!('error' in responseData)) {
|
||||||
setOnlineStatus('Valid');
|
setOnlineStatus('Valid');
|
||||||
|
}
|
||||||
if ('data' in responseData && Array.isArray(responseData.data)) {
|
if ('data' in responseData && Array.isArray(responseData.data)) {
|
||||||
saveModelList(responseData.data);
|
saveModelList(responseData.data);
|
||||||
}
|
}
|
||||||
|
@ -3504,6 +3512,11 @@ $(document).ready(async function () {
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#openai_bypass_status_check').on('input', function () {
|
||||||
|
oai_settings.bypass_status_check = !!$(this).prop('checked');
|
||||||
|
saveSettingsDebounced();
|
||||||
|
})
|
||||||
|
|
||||||
$('#chat_completion_source').on('change', function () {
|
$('#chat_completion_source').on('change', function () {
|
||||||
oai_settings.chat_completion_source = String($(this).find(":selected").val());
|
oai_settings.chat_completion_source = String($(this).find(":selected").val());
|
||||||
toggleChatCompletionForms();
|
toggleChatCompletionForms();
|
||||||
|
|
|
@ -2764,8 +2764,8 @@ app.post("/getstatus_openai", jsonParser, async function (request, response_gets
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('Access Token is incorrect.');
|
console.log('OpenAI status check failed. Either Access Token is incorrect or API endpoint is down.');
|
||||||
response_getstatus_openai.send({ error: true });
|
response_getstatus_openai.send({ error: true, can_bypass: true, data: { data: [] } });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|
Loading…
Reference in New Issue