diff --git a/src/lang/en.ts b/src/lang/en.ts index 3aa497af..ea6d4cb2 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -430,4 +430,6 @@ export const languageEnglish = { supporterThanksDesc: "Thank you for your support!", donatorPatreonDesc:"For default, it will not be shown in the list for privacy. if you want to show your nickname, go to RisuAI's patreon page and press the link button.", useNamePrefix: "Use Name Prefix", + textAdventureNAI: "Run as Text Adventure", + appendNameNAI: "Append Name on NAI", } \ No newline at end of file diff --git a/src/lib/Setting/Pages/BotSettings.svelte b/src/lib/Setting/Pages/BotSettings.svelte index b9371294..fea308f5 100644 --- a/src/lib/Setting/Pages/BotSettings.svelte +++ b/src/lib/Setting/Pages/BotSettings.svelte @@ -208,11 +208,13 @@ NovelAI Bearer Token - +
+ +
+ +
+ +
{/if} {#if $DataBase.aiModel === "kobold" || $DataBase.subModel === "kobold"} diff --git a/src/ts/process/models/nai.ts b/src/ts/process/models/nai.ts index 0f2f6b71..fb56d4fb 100644 --- a/src/ts/process/models/nai.ts +++ b/src/ts/process/models/nai.ts @@ -13,8 +13,6 @@ export function stringlizeNAIChat(formated:OpenAIChat[], char:string, continued: let starter = db.NAIsettings.starter.replaceAll("\\n","\n") || '***\n[conversation: start]' let resultString:string[] = [] - console.log(formated) - for(const form of formated){ if(form.role === 'system'){ if(form.memo === 'NewChatExample' || form.memo === 'NewChat' || form.content === "[Start a new chat]"){ @@ -25,10 +23,23 @@ export function stringlizeNAIChat(formated:OpenAIChat[], char:string, continued: } } else if(form.name || form.role === 'assistant'){ - resultString.push((form.name ?? char) + ": " + form.content) + if(db.NAIappendName){ + resultString.push(form.content) + } + else{ + resultString.push((form.name ?? char) + ": " + form.content) + } } else if(form.role === 'user'){ - resultString.push(db.username + ": " + form.content) + let res = '' + if(db.NAIadventure){ + res += '> ' + } + if(db.NAIappendName){ + res += db.username + ": " + } + res += form.content + resultString.push(res) } else{ resultString.push(form.content) @@ -38,7 +49,7 @@ export function stringlizeNAIChat(formated:OpenAIChat[], char:string, continued: let res = resultString.join(seperator) if(!continued){ - res += `\n\n${char}:` + res += `${seperator}${char}:` } return res } diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts index 8051d618..91f767f7 100644 --- a/src/ts/process/request.ts +++ b/src/ts/process/request.ts @@ -381,6 +381,12 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model' }) } + let prefix = 'vanilla' + + if(db.NAIadventure){ + prefix = 'theme_textadventure' + } + const gen = db.NAIsettings const payload = { temperature:temperature, @@ -399,16 +405,18 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model' use_cache: false, use_string: true, return_full_text: false, - prefix: 'vanilla', + prefix: prefix, order: [2, 3, 0, 4, 1], typical_p: gen.typicalp, repetition_penalty_whitelist:[49256,49264,49231,49230,49287,85,49255,49399,49262,336,333,432,363,468,492,745,401,426,623,794,1096,2919,2072,7379,1259,2110,620,526,487,16562,603,805,761,2681,942,8917,653,3513,506,5301,562,5010,614,10942,539,2976,462,5189,567,2032,123,124,125,126,127,128,129,130,131,132,588,803,1040,49209,4,5,6,7,8,9,10,11,12], - stop_sequences: [[49287]], + stop_sequences: [[49287], [49405]], bad_words_ids: NovelAIBadWordIds, logit_bias_exp: logit_bias_exp } + + const body = { "input": proompt, diff --git a/src/ts/storage/database.ts b/src/ts/storage/database.ts index 1a80d85b..c286207e 100644 --- a/src/ts/storage/database.ts +++ b/src/ts/storage/database.ts @@ -472,6 +472,8 @@ export interface Database{ emotionProcesser:'submodel'|'embedding', showMenuChatList?:boolean, translatorType:'google'|'deepl'|'none', + NAIadventure?:boolean, + NAIappendName?:boolean, deeplOptions:{ key:string, freeApi:boolean