(WIP) PaLM API

This commit is contained in:
Cohee
2023-09-23 20:48:56 +03:00
parent 5275e0c904
commit a081f78bd8
8 changed files with 182 additions and 17 deletions

View File

@@ -2049,7 +2049,8 @@ function baseChatReplace(value, name1, name2) {
}
function isStreamingEnabled() {
return ((main_api == 'openai' && oai_settings.stream_openai && oai_settings.chat_completion_source !== chat_completion_sources.SCALE && oai_settings.chat_completion_source !== chat_completion_sources.AI21)
const noStreamSources = [chat_completion_sources.SCALE, chat_completion_sources.AI21, chat_completion_sources.PALM];
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 == 'novel' && nai_settings.streaming_novel)
|| (main_api == 'textgenerationwebui' && textgenerationwebui_settings.streaming));
@@ -4633,6 +4634,7 @@ function changeMainAPI() {
case chat_completion_sources.CLAUDE:
case chat_completion_sources.OPENAI:
case chat_completion_sources.AI21:
case chat_completion_sources.PALM:
default:
setupChatCompletionPromptManager(oai_settings);
break;
@@ -6762,7 +6764,12 @@ function connectAPISlash(_, text) {
selected: 'openai',
source: 'ai21',
button: '#api_button_openai',
}
},
'palm': {
selected: 'openai',
source: 'palm',
button: '#api_button_openai',
},
};
const apiConfig = apiMap[text];
@@ -6995,7 +7002,7 @@ jQuery(async function () {
}
registerSlashCommand('dupe', DupeChar, [], " duplicates the currently selected character", true, true);
registerSlashCommand('api', connectAPISlash, [], "(kobold, horde, novel, ooba, oai, claude, windowai, ai21) connect to an API", true, true);
registerSlashCommand('api', connectAPISlash, [], "(kobold, horde, novel, ooba, oai, claude, windowai, ai21, palm) connect to an API", true, true);
registerSlashCommand('impersonate', doImpersonate, ['imp'], "- calls an impersonation response", true, true);
registerSlashCommand('delchat', doDeleteChat, [], "- deletes the current chat", true, true);
registerSlashCommand('closechat', doCloseChat, [], "- closes the current chat", true, true);