diff --git a/src/lang/en.ts b/src/lang/en.ts index 9865f012..87f93c7a 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -48,7 +48,7 @@ export const languageEnglish = { loreName: "name of the lore. it dosen't effects the Ai.", loreActivationKey: "If one of the activation key exists in context, the lore will be activated and prompt will go in. seperated by commas.", loreorder: "If insert Order is higher, it will effect the model more, and it will more lessly cuted when activated lore are many.", - bias:"bias is a key-value data which modifies the likelihood of string appearing.\nit can be -100 to 100, higher values will be more likely to appear, and lower values will be more unlikely to appear \nWarning: if the tokenizer is wrong, it not work properly.", + bias:"bias is a key-value data which modifies the likelihood of string appearing.\nit can be -100 to 100, higher values will be more likely to appear, and lower values will be more unlikely to appear. \nAdditionaly, if its set to -101, it would work as 'strong ban word' for some models. \nWarning: if the tokenizer is wrong, it not work properly.", emotion: "Emotion Images option shows image depending at character's emotion which is analized by character's response. you must input emotion name as words *(like joy, happy, fear and etc.)* .emotion named **neutral** will be default emotion if it exists. must be more then 3 images to work properly.", imggen: "After analyzing the chat, apply the prompt to {{slot}}.", regexScript: "Regex Script is a custom script that replaces string that matches IN to OUT.\n\nThere four type options." diff --git a/src/lang/ko.ts b/src/lang/ko.ts index e80c1263..8cc9213d 100644 --- a/src/lang/ko.ts +++ b/src/lang/ko.ts @@ -175,7 +175,7 @@ export const languageKorean = { loreName: "로어의 이름입니다. AI에 영향을 주지 않습니다.", loreActivationKey: "활성화 키 중 하나가 컨텍스트에 존재하면 해당 로어가 활성화됩니다. 쉼표로 구분된 활성화를 구분하세요.", loreorder: "순서가 높을수록 모델에 더 많은 영향을 미치며, 활성화된 로어가 많을 때 잘리지 않습니다.", - bias:"바이어스는 문자열이 나타날 가능성을 수정하는 키-값 데이터로, -100에서 100까지 가능하며 값이 클수록 나타날 가능성이 높고, 값이 작을수록 나타날 가능성이 낮습니다 \n경고: 토큰라이저가 잘못되면 제대로 작동하지 않습니다.", + bias:"바이어스는 문자열이 나타날 가능성을 수정하는 키-값 데이터로, -100에서 100까지 가능하며 값이 클수록 나타날 가능성이 높고, 값이 작을수록 나타날 가능성이 낮습니다 \n경고: 토크나이저가 잘못되면 제대로 작동하지 않습니다. 추가적으로, -101로 설정하면 일부 모델에서는 '강력한 단어 밴'으로 작동합니다", emotion: "감정 이미지 옵션은 캐릭터의 반응으로 분석된 캐릭터의 감정에 따라 이미지를 표시합니다. 감정 이름은 단어 *(예시: joy, happy, fear 등)* 로 입력해야 하며, **neutral** 이라는 이름의 감정이 존재하면 기본 감정이 됩니다. 제대로 작동하려면 이미지가 3개 이상이어야 합니다.", imggen: "채팅을 분석한 후 프롬프트를 {{slot}}에 적용합니다.", experimental: "실험적 기능입니다. 불안정할 수 있습니다.", diff --git a/src/lib/Setting/Pages/BotSettings.svelte b/src/lib/Setting/Pages/BotSettings.svelte index 120e99d3..30b85cc8 100644 --- a/src/lib/Setting/Pages/BotSettings.svelte +++ b/src/lib/Setting/Pages/BotSettings.svelte @@ -484,11 +484,11 @@ {language.formatingOrder} {/if} - + - - + + - -
Bias{language.value}Bias{language.value}
+ - + +
+ {#if !$DataBase.promptTemplate}
diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts index f04809e7..87e276fe 100644 --- a/src/ts/process/request.ts +++ b/src/ts/process/request.ts @@ -9,7 +9,7 @@ import { sleep } from "../util"; import { createDeep } from "./deepai"; import { hubURL } from "../characterCards"; import { NovelAIBadWordIds, stringlizeNAIChat } from "./models/nai"; -import { tokenizeNum } from "../tokenizer"; +import { strongBan, tokenizeNum } from "../tokenizer"; import { runLocalModel } from "./models/local"; import { risuChatParser } from "../parser"; import { SignatureV4 } from "@smithy/signature-v4"; @@ -230,10 +230,15 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model' for(let i=0;i?@[\\]^_`{|}~“”‘’«»「」…–―※" + let unbanChars:number[] = [] + + for(const char of banChars){ + unbanChars.push((await tokenizeNum(char))[0]) + } + + + for(const char of banChars){ + for(const alt of charAlt){ + let fchar = char + + const encoded = await tokenizeNum(alt + fchar) + if(encoded.length > 0){ + if(!unbanChars.includes(encoded[0])){ + bias[encoded[0]] = -100 + } + } + const encoded2 = await tokenizeNum(fchar + alt) + if(encoded2.length > 0){ + if(!unbanChars.includes(encoded2[0])){ + bias[encoded2[0]] = -100 + } + } + } + } + console.log('strongBan', performance.now() - performace) + console.log('added', Object.keys(bias).length - length) + localStorage.setItem('strongBan_' + data, JSON.stringify(bias)) + return bias } \ No newline at end of file