change palm naming in UI

This commit is contained in:
based 2023-12-14 11:14:41 +10:00
parent 875760eadf
commit 69e24c9686
7 changed files with 33 additions and 24 deletions

View File

@ -444,7 +444,7 @@
complete.</span> complete.</span>
</div> </div>
</div> </div>
<div class="range-block" data-source="openai,claude,windowai,openrouter,ai21,scale,palm"> <div class="range-block" data-source="openai,claude,windowai,openrouter,ai21,scale,makersuite">
<div class="range-block-title" data-i18n="Temperature"> <div class="range-block-title" data-i18n="Temperature">
Temperature Temperature
</div> </div>
@ -496,7 +496,7 @@
</div> </div>
</div> </div>
</div> </div>
<div data-newbie-hidden class="range-block" data-source="claude,openrouter,ai21,palm"> <div data-newbie-hidden class="range-block" data-source="claude,openrouter,ai21,makersuite">
<div class="range-block-title" data-i18n="Top K"> <div class="range-block-title" data-i18n="Top K">
Top K Top K
</div> </div>
@ -509,7 +509,7 @@
</div> </div>
</div> </div>
</div> </div>
<div data-newbie-hidden class="range-block" data-source="openai,claude,openrouter,ai21,scale,palm"> <div data-newbie-hidden class="range-block" data-source="openai,claude,openrouter,ai21,scale,makersuite">
<div class="range-block-title" data-i18n="Top-p"> <div class="range-block-title" data-i18n="Top-p">
Top P Top P
</div> </div>
@ -1585,7 +1585,7 @@
<option value="koboldhorde"><span data-i18n="KoboldAI Horde">KoboldAI Horde</span></option> <option value="koboldhorde"><span data-i18n="KoboldAI Horde">KoboldAI Horde</span></option>
<option value="novel"><span data-i18n="NovelAI">NovelAI</span></option> <option value="novel"><span data-i18n="NovelAI">NovelAI</span></option>
<option value="textgenerationwebui"><span data-i18n="Text Completion">Text Completion (ooba, Mancer, Aphrodite, TabbyAPI, KoboldCpp)</span></option> <option value="textgenerationwebui"><span data-i18n="Text Completion">Text Completion (ooba, Mancer, Aphrodite, TabbyAPI, KoboldCpp)</span></option>
<option value="openai"><span data-i18n="Chat Completion (OpenAI, Claude, Window/OpenRouter, Scale, AI21)">Chat Completion (OpenAI, Claude, Window, OpenRouter, Scale, AI21, PaLM)</span></option> <option value="openai"><span data-i18n="Chat Completion (OpenAI, Claude, Window/OpenRouter, Scale, AI21)">Chat Completion (OpenAI, Claude, Window, OpenRouter, Scale, AI21, Google MakerSuite)</span></option>
</select> </select>
</div> </div>
<div id="kobold_horde" style="position: relative;"> <!-- shows the kobold settings --> <div id="kobold_horde" style="position: relative;"> <!-- shows the kobold settings -->
@ -1833,7 +1833,7 @@
<option value="claude">Claude</option> <option value="claude">Claude</option>
<option value="scale">Scale</option> <option value="scale">Scale</option>
<option value="ai21">AI21</option> <option value="ai21">AI21</option>
<option value="palm">Google PaLM 2</option> <option value="makersuite">Google MakerSuite</option>
</select> </select>
<form id="openai_form" data-source="openai" action="javascript:void(null);" method="post" enctype="multipart/form-data"> <form id="openai_form" data-source="openai" action="javascript:void(null);" method="post" enctype="multipart/form-data">
<h4><span data-i18n="OpenAI API key">OpenAI API key</span></h4> <h4><span data-i18n="OpenAI API key">OpenAI API key</span></h4>
@ -2100,14 +2100,23 @@
</div> </div>
</form> </form>
<form id="palm_form" data-source="palm" action="javascript:void(null);" method="post" enctype="multipart/form-data"> <form id="palm_form" data-source="palm" action="javascript:void(null);" method="post" enctype="multipart/form-data">
<h4 data-i18n="PaLM API Key">PaLM API Key</h4> <h4 data-i18n="MakerSuite API Key">MakerSuite API Key</h4>
<div class="flex-container"> <div class="flex-container">
<input id="api_key_palm" name="api_key_palm" class="text_pole flex1" maxlength="500" value="" type="text" autocomplete="off"> <input id="api_key_makersuite" name="api_key_makersuite" class="text_pole flex1" maxlength="500" value="" type="text" autocomplete="off">
<div title="Clear your API key" data-i18n="[title]Clear your API key" class="menu_button fa-solid fa-circle-xmark clear-api-key" data-key="api_key_palm"></div> <div title="Clear your API key" data-i18n="[title]Clear your API key" class="menu_button fa-solid fa-circle-xmark clear-api-key" data-key="api_key_makersuite"></div>
</div> </div>
<div data-for="api_key_palm" class="neutral_warning"> <div data-for="api_key_makersuite" class="neutral_warning">
For privacy reasons, your API key will be hidden after you reload the page. For privacy reasons, your API key will be hidden after you reload the page.
</div> </div>
<div>
<h4 data-i18n="Google Model">Google Model</h4>
<select id="model_google_select">
<option value="gemini-pro">Gemini Pro</option>
<option value="gemini-pro-vision">Gemini Pro Vision</option>
<option value="text-bison-001">Bison Text</option>
<option value="chat-bison-001">Bison Chat</option>
</select>
</div>
<!-- Its only purpose is to trigger max context size check --> <!-- Its only purpose is to trigger max context size check -->
<select id="model_palm_select" class="displayNone"></select> <select id="model_palm_select" class="displayNone"></select>
</form> </form>

View File

@ -2557,7 +2557,7 @@ function getCharacterCardFields() {
} }
function isStreamingEnabled() { function isStreamingEnabled() {
const noStreamSources = [chat_completion_sources.SCALE, chat_completion_sources.AI21, chat_completion_sources.PALM]; const noStreamSources = [chat_completion_sources.SCALE, chat_completion_sources.AI21, chat_completion_sources.MAKERSUITE];
return ((main_api == 'openai' && oai_settings.stream_openai && !noStreamSources.includes(oai_settings.chat_completion_source)) return ((main_api == 'openai' && oai_settings.stream_openai && !noStreamSources.includes(oai_settings.chat_completion_source))
|| (main_api == 'kobold' && kai_settings.streaming_kobold && kai_flags.can_use_streaming) || (main_api == 'kobold' && kai_settings.streaming_kobold && kai_flags.can_use_streaming)
|| (main_api == 'novel' && nai_settings.streaming_novel) || (main_api == 'novel' && nai_settings.streaming_novel)
@ -5395,7 +5395,7 @@ function changeMainAPI() {
case chat_completion_sources.CLAUDE: case chat_completion_sources.CLAUDE:
case chat_completion_sources.OPENAI: case chat_completion_sources.OPENAI:
case chat_completion_sources.AI21: case chat_completion_sources.AI21:
case chat_completion_sources.PALM: case chat_completion_sources.MAKERSUITE:
default: default:
setupChatCompletionPromptManager(oai_settings); setupChatCompletionPromptManager(oai_settings);
break; break;
@ -7535,9 +7535,9 @@ async function connectAPISlash(_, text) {
source: 'ai21', source: 'ai21',
button: '#api_button_openai', button: '#api_button_openai',
}, },
'palm': { 'makersuite': {
selected: 'openai', selected: 'openai',
source: 'palm', source: 'makersuite',
button: '#api_button_openai', button: '#api_button_openai',
}, },
}; };

View File

@ -415,7 +415,7 @@ function RA_autoconnect(PrevApi) {
|| (oai_settings.chat_completion_source == chat_completion_sources.WINDOWAI) || (oai_settings.chat_completion_source == chat_completion_sources.WINDOWAI)
|| (secret_state[SECRET_KEYS.OPENROUTER] && oai_settings.chat_completion_source == chat_completion_sources.OPENROUTER) || (secret_state[SECRET_KEYS.OPENROUTER] && oai_settings.chat_completion_source == chat_completion_sources.OPENROUTER)
|| (secret_state[SECRET_KEYS.AI21] && oai_settings.chat_completion_source == chat_completion_sources.AI21) || (secret_state[SECRET_KEYS.AI21] && oai_settings.chat_completion_source == chat_completion_sources.AI21)
|| (secret_state[SECRET_KEYS.PALM] && oai_settings.chat_completion_source == chat_completion_sources.PALM) || (secret_state[SECRET_KEYS.MAKERSUITE] && oai_settings.chat_completion_source == chat_completion_sources.PALM)
) { ) {
$('#api_button_openai').trigger('click'); $('#api_button_openai').trigger('click');
} }

View File

@ -164,7 +164,7 @@ export const chat_completion_sources = {
SCALE: 'scale', SCALE: 'scale',
OPENROUTER: 'openrouter', OPENROUTER: 'openrouter',
AI21: 'ai21', AI21: 'ai21',
PALM: 'palm', MAKERSUITE: 'makersuite',
}; };
const prefixMap = selected_group ? { const prefixMap = selected_group ? {
@ -3255,10 +3255,10 @@ async function onConnectButtonClick(e) {
} }
if (oai_settings.chat_completion_source == chat_completion_sources.PALM) { if (oai_settings.chat_completion_source == chat_completion_sources.PALM) {
const api_key_palm = String($('#api_key_palm').val()).trim(); const api_key_makersuite = String($('#api_key_makersuite').val()).trim();
if (api_key_palm.length) { if (api_key_makersuite.length) {
await writeSecret(SECRET_KEYS.PALM, api_key_palm); await writeSecret(SECRET_KEYS.PALM, api_key_makersuite);
} }
if (!secret_state[SECRET_KEYS.PALM]) { if (!secret_state[SECRET_KEYS.PALM]) {

View File

@ -12,7 +12,7 @@ export const SECRET_KEYS = {
SCALE: 'api_key_scale', SCALE: 'api_key_scale',
AI21: 'api_key_ai21', AI21: 'api_key_ai21',
SCALE_COOKIE: 'scale_cookie', SCALE_COOKIE: 'scale_cookie',
PALM: 'api_key_palm', MAKERSUITE: 'api_key_makersuite',
SERPAPI: 'api_key_serpapi', SERPAPI: 'api_key_serpapi',
}; };
@ -26,7 +26,7 @@ const INPUT_MAP = {
[SECRET_KEYS.SCALE]: '#api_key_scale', [SECRET_KEYS.SCALE]: '#api_key_scale',
[SECRET_KEYS.AI21]: '#api_key_ai21', [SECRET_KEYS.AI21]: '#api_key_ai21',
[SECRET_KEYS.SCALE_COOKIE]: '#scale_cookie', [SECRET_KEYS.SCALE_COOKIE]: '#scale_cookie',
[SECRET_KEYS.PALM]: '#api_key_palm', [SECRET_KEYS.MAKERSUITE]: '#api_key_makersuite',
[SECRET_KEYS.APHRODITE]: '#api_key_aphrodite', [SECRET_KEYS.APHRODITE]: '#api_key_aphrodite',
[SECRET_KEYS.TABBY]: '#api_key_tabby', [SECRET_KEYS.TABBY]: '#api_key_tabby',
}; };

View File

@ -995,9 +995,9 @@ async function sendClaudeRequest(request, response) {
* @param {express.Response} response * @param {express.Response} response
*/ */
async function sendPalmRequest(request, response) { async function sendPalmRequest(request, response) {
const api_key_palm = readSecret(SECRET_KEYS.PALM); const api_key_makersuite = readSecret(SECRET_KEYS.PALM);
if (!api_key_palm) { if (!api_key_makersuite) {
console.log('Palm API key is missing.'); console.log('Palm API key is missing.');
return response.status(400).send({ error: true }); return response.status(400).send({ error: true });
} }
@ -1024,7 +1024,7 @@ async function sendPalmRequest(request, response) {
controller.abort(); controller.abort();
}); });
const generateResponse = await fetch(`https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=${api_key_palm}`, { const generateResponse = await fetch(`https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=${api_key_makersuite}`, {
body: JSON.stringify(body), body: JSON.stringify(body),
method: 'POST', method: 'POST',
headers: { headers: {

View File

@ -23,7 +23,7 @@ const SECRET_KEYS = {
SCALE_COOKIE: 'scale_cookie', SCALE_COOKIE: 'scale_cookie',
ONERING_URL: 'oneringtranslator_url', ONERING_URL: 'oneringtranslator_url',
DEEPLX_URL: 'deeplx_url', DEEPLX_URL: 'deeplx_url',
PALM: 'api_key_palm', PALM: 'api_key_makersuite',
SERPAPI: 'api_key_serpapi', SERPAPI: 'api_key_serpapi',
}; };