Cohere: limit penalties

e8de36a0d019b16bf354afe8ed4e38aa9a3ea1d3

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +15 -0Showing whitespace changes
public/scripts/openai.js+15 -0
@@ -1372,6 +1372,11 @@ function tryParseStreamingError(response, decoded) {
1372 toastr.error(data.error.message || response.statusText, 'Chat Completion API');1372 toastr.error(data.error.message || response.statusText, 'Chat Completion API');
1373 throw new Error(data);1373 throw new Error(data);
1374 }1374 }
1375
1376 if (data.message) {
1377 toastr.error(data.message, 'Chat Completion API');
1378 throw new Error(data);
1379 }
1375 }1380 }
1376 catch {1381 catch {
1377 // No JSON. Do nothing.1382 // No JSON. Do nothing.
@@ -4324,6 +4329,16 @@ async function onModelChange() {
4324 $('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input');4329 $('#temp_openai').attr('max', oai_max_temp).val(oai_settings.temp_openai).trigger('input');
4325 }4330 }
43264331
4332 if (oai_settings.chat_completion_source === chat_completion_sources.COHERE) {
4333 oai_settings.pres_pen_openai = Math.min(Math.max(0, oai_settings.pres_pen_openai), 1);
4334 $('#pres_pen_openai').attr('max', 1).attr('min', 0).val(oai_settings.pres_pen_openai).trigger('input');
4335 oai_settings.freq_pen_openai = Math.min(Math.max(0, oai_settings.freq_pen_openai), 1);
4336 $('#freq_pen_openai').attr('max', 1).attr('min', 0).val(oai_settings.freq_pen_openai).trigger('input');
4337 } else {
4338 $('#pres_pen_openai').attr('max', 2).attr('min', 0).val(oai_settings.pres_pen_openai).trigger('input');
4339 $('#freq_pen_openai').attr('max', 2).attr('min', 0).val(oai_settings.freq_pen_openai).trigger('input');
4340 }
4341
4327 $('#openai_max_context_counter').attr('max', Number($('#openai_max_context').attr('max')));4342 $('#openai_max_context_counter').attr('max', Number($('#openai_max_context').attr('max')));
43284343
4329 saveSettingsDebounced();4344 saveSettingsDebounced();