Merge branch 'staging' of https://github.com/Yokayo/SillyTavern into staging
This commit is contained in:
commit
88ad22196c
|
@ -2800,6 +2800,8 @@
|
||||||
<option value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option>
|
<option value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option>
|
||||||
<option value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option>
|
<option value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option>
|
||||||
<option value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option>
|
<option value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option>
|
||||||
|
<option value="claude-3-5-haiku-latest">claude-3-5-haiku-latest</option>
|
||||||
|
<option value="claude-3-5-haiku-20241022">claude-3-5-haiku-20241022</option>
|
||||||
<option value="claude-3-opus-20240229">claude-3-opus-20240229</option>
|
<option value="claude-3-opus-20240229">claude-3-opus-20240229</option>
|
||||||
<option value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option>
|
<option value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option>
|
||||||
<option value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
|
<option value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
|
||||||
|
|
|
@ -46,6 +46,8 @@
|
||||||
<option data-type="anthropic" value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option>
|
<option data-type="anthropic" value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option>
|
||||||
<option data-type="anthropic" value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option>
|
<option data-type="anthropic" value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option>
|
||||||
<option data-type="anthropic" value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option>
|
<option data-type="anthropic" value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option>
|
||||||
|
<option data-type="anthropic" value="claude-3-5-haiku-latest">claude-3-5-haiku-latest</option>
|
||||||
|
<option data-type="anthropic" value="claude-3-5-haiku-20241022">claude-3-5-haiku-20241022</option>
|
||||||
<option data-type="anthropic" value="claude-3-opus-20240229">claude-3-opus-20240229</option>
|
<option data-type="anthropic" value="claude-3-opus-20240229">claude-3-opus-20240229</option>
|
||||||
<option data-type="anthropic" value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option>
|
<option data-type="anthropic" value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option>
|
||||||
<option data-type="anthropic" value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
|
<option data-type="anthropic" value="claude-3-haiku-20240307">claude-3-haiku-20240307</option>
|
||||||
|
|
|
@ -1813,6 +1813,10 @@ async function sendOpenAIRequest(type, messages, signal) {
|
||||||
biasCache = logit_bias;
|
biasCache = logit_bias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Object.keys(logit_bias).length === 0) {
|
||||||
|
logit_bias = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
if (isScale && oai_settings.use_alt_scale) {
|
if (isScale && oai_settings.use_alt_scale) {
|
||||||
return sendAltScaleRequest(messages, logit_bias, signal, type);
|
return sendAltScaleRequest(messages, logit_bias, signal, type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1046,20 +1046,9 @@ router.post('/generate', jsonParser, function (request, response) {
|
||||||
const responseText = await errorResponse.text();
|
const responseText = await errorResponse.text();
|
||||||
const errorData = tryParse(responseText);
|
const errorData = tryParse(responseText);
|
||||||
|
|
||||||
const statusMessages = {
|
const message = errorResponse.statusText || 'Unknown error occurred';
|
||||||
400: 'Bad request',
|
|
||||||
401: 'Unauthorized',
|
|
||||||
402: 'Credit limit reached',
|
|
||||||
403: 'Forbidden',
|
|
||||||
404: 'Not found',
|
|
||||||
429: 'Too many requests',
|
|
||||||
451: 'Unavailable for legal reasons',
|
|
||||||
502: 'Bad gateway',
|
|
||||||
};
|
|
||||||
|
|
||||||
const message = errorData?.error?.message || statusMessages[errorResponse.status] || 'Unknown error occurred';
|
|
||||||
const quota_error = errorResponse.status === 429 && errorData?.error?.type === 'insufficient_quota';
|
const quota_error = errorResponse.status === 429 && errorData?.error?.type === 'insufficient_quota';
|
||||||
console.log(message);
|
console.log(message, responseText);
|
||||||
|
|
||||||
if (!response.headersSent) {
|
if (!response.headersSent) {
|
||||||
response.send({ error: { message }, quota_error: quota_error });
|
response.send({ error: { message }, quota_error: quota_error });
|
||||||
|
|
Loading…
Reference in New Issue