diff --git a/src/lib/SideBars/Settings.svelte b/src/lib/SideBars/Settings.svelte
index da2f6de4..31478f47 100644
--- a/src/lib/SideBars/Settings.svelte
+++ b/src/lib/SideBars/Settings.svelte
@@ -98,6 +98,7 @@
+
{#if $DataBase.plugins.length > 0}
{/if}
@@ -107,12 +108,17 @@
+ {#if $DataBase.aiModel === 'palm2' || $DataBase.subModel === 'palm2'}
+ Palm2 {language.apiKey}
+
+ {/if}
{#if $DataBase.aiModel === 'gpt35' || $DataBase.aiModel === 'gpt4' || $DataBase.subModel === 'gpt4' || $DataBase.subModel === 'gpt35'}
OpenAI {language.apiKey}
@@ -411,7 +417,7 @@
{language.plugin}
{language.pluginWarn}
-
+
{#if $DataBase.plugins.length === 0}
No Plugins
diff --git a/src/ts/database.ts b/src/ts/database.ts
index 773f6027..7f79d3dd 100644
--- a/src/ts/database.ts
+++ b/src/ts/database.ts
@@ -408,6 +408,7 @@ export interface Database{
showMemoryLimit:boolean
roundIcons:boolean
useStreaming:boolean
+ palmAPI:string
}
diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts
index ae5881d6..20e47578 100644
--- a/src/ts/process/request.ts
+++ b/src/ts/process/request.ts
@@ -252,6 +252,78 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
}
break
}
+ case 'palm2':{
+ const body = {
+ "prompt": {
+ "text": stringlizeChat(formated, currentChar?.name ?? '')
+ },
+ "safetySettings":[
+ {
+ "category": "HARM_CATEGORY_UNSPECIFIED",
+ "threshold": "BLOCK_NONE"
+ },
+ {
+ "category": "HARM_CATEGORY_DEROGATORY",
+ "threshold": "BLOCK_NONE"
+ },
+ {
+ "category": "HARM_CATEGORY_TOXICITY",
+ "threshold": "BLOCK_NONE"
+ },
+ {
+ "category": "HARM_CATEGORY_VIOLENCE",
+ "threshold": "BLOCK_NONE"
+ },
+ {
+ "category": "HARM_CATEGORY_SEXUAL",
+ "threshold": "BLOCK_NONE"
+ },
+ {
+ "category": "HARM_CATEGORY_MEDICAL",
+ "threshold": "BLOCK_NONE"
+ },
+ {
+ "category": "HARM_CATEGORY_DANGEROUS",
+ "threshold": "BLOCK_NONE"
+ }
+ ],
+ "temperature": arg.temperature,
+ "maxOutputTokens": arg.maxTokens,
+ "candidate_count": 1
+ }
+ const res = await globalFetch(`https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=${db.palmAPI}`, {
+ body: body,
+ headers: {
+ "Content-Type": "application/json"
+ },
+ })
+
+ if(res.ok){
+ if(res.data.candidates){
+ let output:string = res.data.candidates[0].output
+ const ind = output.search(/(system note)|(user)|(assistant):/gi)
+ if(ind >= 0){
+ output = output.substring(0, ind)
+ }
+ return {
+ type: 'success',
+ result: output
+ }
+ }
+ else{
+ return {
+ type: 'fail',
+ result: `${JSON.stringify(res.data)}`
+ }
+ }
+ }
+ else{
+ return {
+ type: 'fail',
+ result: `${JSON.stringify(res.data)}`
+ }
+ }
+ }
default:{
return {
type: 'fail',