diff --git a/public/scripts/openai.js b/public/scripts/openai.js index d94566314..e44ed30e6 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -1372,6 +1372,11 @@ function tryParseStreamingError(response, decoded) { toastr.error(data.error.message || response.statusText, 'Chat Completion API'); throw new Error(data); } + + if (data.message) { + toastr.error(data.message, 'Chat Completion API'); + throw new Error(data); + } } catch { // No JSON. Do nothing. @@ -4324,6 +4329,16 @@ async function onModelChange() { $('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input'); } + if (oai_settings.chat_completion_source === chat_completion_sources.COHERE) { + oai_settings.pres_pen_openai = Math.min(Math.max(0, oai_settings.pres_pen_openai), 1); + $('#pres_pen_openai').attr('max', 1).attr('min', 0).val(oai_settings.pres_pen_openai).trigger('input'); + oai_settings.freq_pen_openai = Math.min(Math.max(0, oai_settings.freq_pen_openai), 1); + $('#freq_pen_openai').attr('max', 1).attr('min', 0).val(oai_settings.freq_pen_openai).trigger('input'); + } else { + $('#pres_pen_openai').attr('max', 2).attr('min', 0).val(oai_settings.pres_pen_openai).trigger('input'); + $('#freq_pen_openai').attr('max', 2).attr('min', 0).val(oai_settings.freq_pen_openai).trigger('input'); + } + $('#openai_max_context_counter').attr('max', Number($('#openai_max_context').attr('max'))); saveSettingsDebounced();