mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
@ -3078,7 +3078,15 @@
|
||||
<div>
|
||||
<h4 data-i18n="AI21 Model">AI21 Model</h4>
|
||||
<select id="model_ai21_select">
|
||||
<optgroup label="Jamba 1.5">
|
||||
<optgroup label="Jamba (Latest)">
|
||||
<option value="jamba-mini">jamba-mini</option>
|
||||
<option value="jamba-large">jamba-large</option>
|
||||
</optgroup>
|
||||
<optgroup label="Jamba 1.6">
|
||||
<option value="jamba-1.6-mini">jamba-1.6-mini</option>
|
||||
<option value="jamba-1.6-large">jamba-1.6-large</option>
|
||||
</optgroup>
|
||||
<optgroup label="Jamba 1.5 (Deprecated)">
|
||||
<option value="jamba-1.5-mini">jamba-1.5-mini</option>
|
||||
<option value="jamba-1.5-large">jamba-1.5-large</option>
|
||||
</optgroup>
|
||||
|
@ -337,7 +337,7 @@ const default_settings = {
|
||||
openai_model: 'gpt-4-turbo',
|
||||
claude_model: 'claude-3-5-sonnet-20240620',
|
||||
google_model: 'gemini-1.5-pro',
|
||||
ai21_model: 'jamba-1.5-large',
|
||||
ai21_model: 'jamba-1.6-large',
|
||||
mistralai_model: 'mistral-large-latest',
|
||||
cohere_model: 'command-r-plus',
|
||||
perplexity_model: 'sonar-pro',
|
||||
@ -417,7 +417,7 @@ const oai_settings = {
|
||||
openai_model: 'gpt-4-turbo',
|
||||
claude_model: 'claude-3-5-sonnet-20240620',
|
||||
google_model: 'gemini-1.5-pro',
|
||||
ai21_model: 'jamba-1.5-large',
|
||||
ai21_model: 'jamba-1.6-large',
|
||||
mistralai_model: 'mistral-large-latest',
|
||||
cohere_model: 'command-r-plus',
|
||||
perplexity_model: 'sonar-pro',
|
||||
@ -3251,7 +3251,7 @@ function loadOpenAISettings(data, settings) {
|
||||
}
|
||||
|
||||
if (oai_settings.ai21_model.startsWith('j2-')) {
|
||||
oai_settings.ai21_model = 'jamba-1.5-large';
|
||||
oai_settings.ai21_model = 'jamba-1.6-large';
|
||||
}
|
||||
|
||||
if (settings.wrap_in_quotes !== undefined) oai_settings.wrap_in_quotes = !!settings.wrap_in_quotes;
|
||||
@ -4208,7 +4208,7 @@ async function onModelChange() {
|
||||
|
||||
if ($(this).is('#model_ai21_select')) {
|
||||
if (value === '' || value.startsWith('j2-')) {
|
||||
value = 'jamba-1.5-large';
|
||||
value = 'jamba-1.6-large';
|
||||
$('#model_ai21_select').val(value);
|
||||
}
|
||||
|
||||
@ -4485,7 +4485,7 @@ async function onModelChange() {
|
||||
if (oai_settings.chat_completion_source == chat_completion_sources.AI21) {
|
||||
if (oai_settings.max_context_unlocked) {
|
||||
$('#openai_max_context').attr('max', unlocked_max);
|
||||
} else if (oai_settings.ai21_model.includes('jamba-1.5') || oai_settings.ai21_model.includes('jamba-instruct')) {
|
||||
} else if (oai_settings.ai21_model.startsWith('jamba-')) {
|
||||
$('#openai_max_context').attr('max', max_256k);
|
||||
}
|
||||
|
||||
|
@ -499,6 +499,12 @@ async function sendMakerSuiteRequest(request, response) {
|
||||
async function sendAI21Request(request, response) {
|
||||
if (!request.body) return response.sendStatus(400);
|
||||
|
||||
const apiKey = readSecret(request.user.directories, SECRET_KEYS.AI21);
|
||||
if (!apiKey) {
|
||||
console.warn('AI21 API key is missing.');
|
||||
return response.status(400).send({ error: true });
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
console.debug(request.body.messages);
|
||||
request.socket.removeAllListeners('close');
|
||||
@ -520,7 +526,7 @@ async function sendAI21Request(request, response) {
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
'content-type': 'application/json',
|
||||
Authorization: `Bearer ${readSecret(request.user.directories, SECRET_KEYS.AI21)}`,
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
},
|
||||
body: JSON.stringify(body),
|
||||
signal: controller.signal,
|
||||
|
Reference in New Issue
Block a user