Merge branch 'staging' of https://github.com/Yokayo/SillyTavern into staging
| @@ -2800,6 +2800,8 @@ | ||
| 2800 | 2800 | <option value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option> |
| 2801 | 2801 | <option value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option> |
| 2802 | 2802 | <option value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option> |
| 2803 | + <option value="claude-3-5-haiku-latest">claude-3-5-haiku-latest</option> | |
| 2804 | + <option value="claude-3-5-haiku-20241022">claude-3-5-haiku-20241022</option> | |
| 2803 | 2805 | <option value="claude-3-opus-20240229">claude-3-opus-20240229</option> |
| 2804 | 2806 | <option value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option> |
| 2805 | 2807 | <option value="claude-3-haiku-20240307">claude-3-haiku-20240307</option> |
| @@ -46,6 +46,8 @@ | ||
| 46 | 46 | <option data-type="anthropic" value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option> |
| 47 | 47 | <option data-type="anthropic" value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option> |
| 48 | 48 | <option data-type="anthropic" value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option> |
| 49 | + <option data-type="anthropic" value="claude-3-5-haiku-latest">claude-3-5-haiku-latest</option> | |
| 50 | + <option data-type="anthropic" value="claude-3-5-haiku-20241022">claude-3-5-haiku-20241022</option> | |
| 49 | 51 | <option data-type="anthropic" value="claude-3-opus-20240229">claude-3-opus-20240229</option> |
| 50 | 52 | <option data-type="anthropic" value="claude-3-sonnet-20240229">claude-3-sonnet-20240229</option> |
| 51 | 53 | <option data-type="anthropic" value="claude-3-haiku-20240307">claude-3-haiku-20240307</option> |
| @@ -1813,6 +1813,10 @@ async function sendOpenAIRequest(type, messages, signal) { | ||
| 1813 | 1813 | biasCache = logit_bias; |
| 1814 | 1814 | } |
| 1815 | 1815 | |
| 1816 | + if (Object.keys(logit_bias).length === 0) { | |
| 1817 | + logit_bias = undefined; | |
| 1818 | + } | |
| 1819 | + | |
| 1816 | 1820 | if (isScale && oai_settings.use_alt_scale) { |
| 1817 | 1821 | return sendAltScaleRequest(messages, logit_bias, signal, type); |
| 1818 | 1822 | } |
| @@ -1046,20 +1046,9 @@ router.post('/generate', jsonParser, function (request, response) { | ||
| 1046 | 1046 | const responseText = await errorResponse.text(); |
| 1047 | 1047 | const errorData = tryParse(responseText); |
| 1048 | 1048 | |
| 1049 | - const statusMessages = { | |
| 1049 | + const message = errorResponse.statusText || 'Unknown error occurred'; | |
| 1050 | - 400: 'Bad request', | |
| 1051 | - 401: 'Unauthorized', | |
| 1052 | - 402: 'Credit limit reached', | |
| 1053 | - 403: 'Forbidden', | |
| 1054 | - 404: 'Not found', | |
| 1055 | - 429: 'Too many requests', | |
| 1056 | - 451: 'Unavailable for legal reasons', | |
| 1057 | - 502: 'Bad gateway', | |
| 1058 | - }; | |
| 1059 | - | |
| 1060 | - const message = errorData?.error?.message || statusMessages[errorResponse.status] || 'Unknown error occurred'; | |
| 1061 | 1050 | const quota_error = errorResponse.status === 429 && errorData?.error?.type === 'insufficient_quota'; |
| 1062 | 1051 | console.log(message, responseText); |
| 1063 | 1052 | |
| 1064 | 1053 | if (!response.headersSent) { |
| 1065 | 1054 | response.send({ error: { message }, quota_error: quota_error }); |