Merge branch 'kwaroran:dev' into dev
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "RisuAI",
|
"productName": "RisuAI",
|
||||||
"version": "1.21.2"
|
"version": "1.22.2"
|
||||||
},
|
},
|
||||||
"tauri": {
|
"tauri": {
|
||||||
"allowlist": {
|
"allowlist": {
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ export const languageEnglish = {
|
|||||||
scenario: "A brief description about character's scenario. \n\n**It is not recommended to use this option. Describe it in character description instead.**",
|
scenario: "A brief description about character's scenario. \n\n**It is not recommended to use this option. Describe it in character description instead.**",
|
||||||
utilityBot: "When activated, it ignores main prompt. \n\n**It is not recommended to use this option. Modifiy system prompt instead.**",
|
utilityBot: "When activated, it ignores main prompt. \n\n**It is not recommended to use this option. Modifiy system prompt instead.**",
|
||||||
loreSelective: "If Selective mode is toggled, both Activation Key and Secondary key should have a match to activate the lore.",
|
loreSelective: "If Selective mode is toggled, both Activation Key and Secondary key should have a match to activate the lore.",
|
||||||
|
loreRandomActivation: "If Use Probability Condition is abled, if the lore's other conditions are all met, the lore will be activated with a set probability which is set by 'Probability' each time a chat is sent.",
|
||||||
additionalAssets: "Additional assets to display in your chat. \n\n - use `{{raw::<asset name>}}` to use as path.\n - use `{{img::<asset name>}}` to use as image",
|
additionalAssets: "Additional assets to display in your chat. \n\n - use `{{raw::<asset name>}}` to use as path.\n - use `{{img::<asset name>}}` to use as image",
|
||||||
superMemory: "SuperMemory makes your character memorize more by giving summarized data to AI.\n\n"
|
superMemory: "SuperMemory makes your character memorize more by giving summarized data to AI.\n\n"
|
||||||
+ "SuperMemory model is a model that summarizes that text. davinci is recommended, and Auxiliary models are not recommended unless it is an unfiltered model with over 2000 tokens with great summarizing skill.\n\n"
|
+ "SuperMemory model is a model that summarizes that text. davinci is recommended, and Auxiliary models are not recommended unless it is an unfiltered model with over 2000 tokens with great summarizing skill.\n\n"
|
||||||
@@ -294,5 +295,7 @@ export const languageEnglish = {
|
|||||||
orderByOrder: "Talk by Order",
|
orderByOrder: "Talk by Order",
|
||||||
removeFromGroup: "Do you really want to remove {{char}} from group?",
|
removeFromGroup: "Do you really want to remove {{char}} from group?",
|
||||||
talkness: "Talkativeness",
|
talkness: "Talkativeness",
|
||||||
active: "Active"
|
active: "Active",
|
||||||
|
loreRandomActivation: "Use Probability Condition",
|
||||||
|
activationProbability: "Probability"
|
||||||
}
|
}
|
||||||
@@ -273,5 +273,7 @@ export const languageKorean = {
|
|||||||
orderByOrder: "순서대로 말하기",
|
orderByOrder: "순서대로 말하기",
|
||||||
removeFromGroup: "정말로 {{char}}을 그룹에서 삭제시키겠습니까?",
|
removeFromGroup: "정말로 {{char}}을 그룹에서 삭제시키겠습니까?",
|
||||||
talkness: "대화량",
|
talkness: "대화량",
|
||||||
active: "활성화"
|
active: "활성화",
|
||||||
|
loreRandomActivation: "확률 조건 사용",
|
||||||
|
activationProbability: "발동 확률"
|
||||||
}
|
}
|
||||||
@@ -39,9 +39,20 @@
|
|||||||
{#if value.selective}
|
{#if value.selective}
|
||||||
<span class="text-neutral-200 mt-6">{language.SecondaryKeys}</span>
|
<span class="text-neutral-200 mt-6">{language.SecondaryKeys}</span>
|
||||||
<span class="text-xs text-gray-500">{language.activationKeysInfo}</span>
|
<span class="text-xs text-gray-500">{language.activationKeysInfo}</span>
|
||||||
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected text-sm" bind:value={value.secondkey}>
|
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected text-sm" bind:value={value.activationPercent} min="0" max="100">
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if !(value.activationPercent === undefined || value.activationPercent === null)}
|
||||||
|
<span class="text-neutral-200 mt-6">{language.activationProbability}</span>
|
||||||
|
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected text-sm" bind:value={value.activationPercent} on:change={() => {
|
||||||
|
if(isNaN(value.activationPercent) || !value.activationPercent || value.activationPercent < 0){
|
||||||
|
value.activationPercent = 0
|
||||||
|
}
|
||||||
|
if(value.activationPercent > 100){
|
||||||
|
value.activationPercent = 100
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
{/if}
|
||||||
<span class="text-neutral-200 mt-4">{language.insertOrder} <Help key="loreorder"/></span>
|
<span class="text-neutral-200 mt-4">{language.insertOrder} <Help key="loreorder"/></span>
|
||||||
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected text-sm" bind:value={value.insertorder} type="number" min={0} max={1000}>
|
<input class="text-neutral-200 p-2 bg-transparent input-text focus:bg-selected text-sm" bind:value={value.insertorder} type="number" min={0} max={1000}>
|
||||||
<span class="text-neutral-200 mt-4">{language.prompt}</span>
|
<span class="text-neutral-200 mt-4">{language.prompt}</span>
|
||||||
@@ -50,10 +61,18 @@
|
|||||||
<Check bind:check={value.alwaysActive}/>
|
<Check bind:check={value.alwaysActive}/>
|
||||||
<span>{language.alwaysActive}</span>
|
<span>{language.alwaysActive}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center mt-2 mb-6">
|
<div class="flex items-center mt-2">
|
||||||
<Check bind:check={value.selective}/>
|
<Check bind:check={value.selective}/>
|
||||||
<span>{language.selective} <Help key="loreSelective"/></span>
|
<span>{language.selective} <Help key="loreSelective"/></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-center mt-2 mb-6">
|
||||||
|
{#if value.activationPercent === undefined || value.activationPercent === null}
|
||||||
|
<Check check={false} onChange={() => {value.activationPercent = 50}}/>
|
||||||
|
{:else}
|
||||||
|
<Check check={true} onChange={() => {value.activationPercent = null}}/>
|
||||||
|
{/if}
|
||||||
|
<span>{language.loreRandomActivation} <Help key="loreRandomActivation"/></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -382,7 +382,8 @@ async function importSpecv2(card:CharacterCardV2, img?:Uint8Array):Promise<boole
|
|||||||
mode: "normal",
|
mode: "normal",
|
||||||
alwaysActive: book.constant ?? false,
|
alwaysActive: book.constant ?? false,
|
||||||
selective: book.selective ?? false,
|
selective: book.selective ?? false,
|
||||||
extentions: {...book.extensions, risu_case_sensitive: book.case_sensitive}
|
extentions: {...book.extensions, risu_case_sensitive: book.case_sensitive},
|
||||||
|
activationPercent: book.extensions?.risu_activationPercent
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,18 +451,26 @@ export async function exportSpecV2(char:character) {
|
|||||||
|
|
||||||
let charBook:charBookEntry[] = []
|
let charBook:charBookEntry[] = []
|
||||||
for(const lore of char.globalLore){
|
for(const lore of char.globalLore){
|
||||||
|
let ext:{
|
||||||
|
risu_case_sensitive?: boolean;
|
||||||
|
risu_activationPercent?: number
|
||||||
|
} = cloneDeep(lore.extentions ?? {})
|
||||||
|
|
||||||
|
let caseSensitive = ext.risu_case_sensitive ?? false
|
||||||
|
ext.risu_activationPercent = lore.activationPercent
|
||||||
|
|
||||||
charBook.push({
|
charBook.push({
|
||||||
keys: lore.key.split(',').map(r => r.trim()),
|
keys: lore.key.split(',').map(r => r.trim()),
|
||||||
secondary_keys: lore.selective ? lore.secondkey.split(',').map(r => r.trim()) : undefined,
|
secondary_keys: lore.selective ? lore.secondkey.split(',').map(r => r.trim()) : undefined,
|
||||||
content: lore.content,
|
content: lore.content,
|
||||||
extensions: lore.extentions ?? {},
|
extensions: ext,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
insertion_order: lore.insertorder,
|
insertion_order: lore.insertorder,
|
||||||
constant: lore.alwaysActive,
|
constant: lore.alwaysActive,
|
||||||
selective:lore.selective,
|
selective:lore.selective,
|
||||||
name: lore.comment,
|
name: lore.comment,
|
||||||
comment: lore.comment,
|
comment: lore.comment,
|
||||||
case_sensitive: lore.extentions?.risu_case_sensitive
|
case_sensitive: caseSensitive,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ export type GroupOrder = {
|
|||||||
|
|
||||||
export function groupOrder(chars:GroupOrder[], input:string):GroupOrder[] {
|
export function groupOrder(chars:GroupOrder[], input:string):GroupOrder[] {
|
||||||
let order:GroupOrder[] = [];
|
let order:GroupOrder[] = [];
|
||||||
|
let ids:string[] = []
|
||||||
if (input) {
|
if (input) {
|
||||||
const words = getWords(input)
|
const words = getWords(input)
|
||||||
|
|
||||||
@@ -66,6 +67,7 @@ export function groupOrder(chars:GroupOrder[], input:string):GroupOrder[] {
|
|||||||
|
|
||||||
if (charNameChunks.includes(word)) {
|
if (charNameChunks.includes(word)) {
|
||||||
order.push(char);
|
order.push(char);
|
||||||
|
ids.push(char.id)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,15 +76,15 @@ export function groupOrder(chars:GroupOrder[], input:string):GroupOrder[] {
|
|||||||
|
|
||||||
const shuffled = shuffle(chars)
|
const shuffled = shuffle(chars)
|
||||||
for (const char of shuffled) {
|
for (const char of shuffled) {
|
||||||
if(order.includes(char)){
|
if(ids.includes(char.id)){
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO
|
const chance = char.talkness ?? 0.5
|
||||||
const chance = 0.5
|
|
||||||
|
|
||||||
if (chance >= Math.random()) {
|
if (chance >= Math.random()) {
|
||||||
order.push(char);
|
order.push(char);
|
||||||
|
ids.push(char.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
talkness: nowChatroom.characterActive[i] ? nowChatroom.characterTalks[i] : -1,
|
talkness: nowChatroom.characterActive[i] ? nowChatroom.characterTalks[i] : -1,
|
||||||
index: i
|
index: i
|
||||||
}
|
}
|
||||||
|
}).filter((v) => {
|
||||||
|
return v.talkness > 0
|
||||||
})
|
})
|
||||||
if(!nowChatroom.orderByOrder){
|
if(!nowChatroom.orderByOrder){
|
||||||
order = groupOrder(order, lastMessage?.data).filter((v) => {
|
order = groupOrder(order, lastMessage?.data).filter((v) => {
|
||||||
@@ -207,7 +209,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n
|
|||||||
return (unformated[key] as OpenAIChat[]).map((d) => {
|
return (unformated[key] as OpenAIChat[]).map((d) => {
|
||||||
return d.content
|
return d.content
|
||||||
}).join('\n\n')
|
}).join('\n\n')
|
||||||
}).join('\n\n')) + db.maxResponse) + 100
|
}).join('\n\n')) + db.maxResponse) + 130
|
||||||
|
|
||||||
|
|
||||||
const examples = exampleMessage(currentChar)
|
const examples = exampleMessage(currentChar)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { get } from "svelte/store";
|
|||||||
import {selectedCharID} from '../stores'
|
import {selectedCharID} from '../stores'
|
||||||
import { DataBase, setDatabase, type loreBook } from "../storage/database";
|
import { DataBase, setDatabase, type loreBook } from "../storage/database";
|
||||||
import { tokenize } from "../tokenizer";
|
import { tokenize } from "../tokenizer";
|
||||||
import { selectSingleFile } from "../util";
|
import { checkNullish, selectSingleFile } from "../util";
|
||||||
import { alertError, alertNormal } from "../alert";
|
import { alertError, alertNormal } from "../alert";
|
||||||
import { language } from "../../lang";
|
import { language } from "../../lang";
|
||||||
import { downloadFile } from "../storage/globalApi";
|
import { downloadFile } from "../storage/globalApi";
|
||||||
@@ -80,6 +80,16 @@ export async function loadLoreBookPrompt(){
|
|||||||
for (const lore of fullLore){
|
for (const lore of fullLore){
|
||||||
if(lore){
|
if(lore){
|
||||||
if(lore.key.length > 1 || lore.alwaysActive){
|
if(lore.key.length > 1 || lore.alwaysActive){
|
||||||
|
if(!checkNullish(lore.activationPercent)){
|
||||||
|
let activationPercent = lore.activationPercent
|
||||||
|
if(isNaN(activationPercent) || !activationPercent || activationPercent < 0){
|
||||||
|
activationPercent = 0
|
||||||
|
}
|
||||||
|
if(activationPercent < (Math.random() * 100)){
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
formatedLore.push({
|
formatedLore.push({
|
||||||
keys: lore.alwaysActive ? 'always' : (lore.key ?? '').replace(rmRegex, '').toLocaleLowerCase().split(',').filter((a) => {
|
keys: lore.alwaysActive ? 'always' : (lore.key ?? '').replace(rmRegex, '').toLocaleLowerCase().split(',').filter((a) => {
|
||||||
return a.length > 1
|
return a.length > 1
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { defaultAutoSuggestPrompt, defaultJailbreak, defaultMainPrompt } from '.
|
|||||||
|
|
||||||
export const DataBase = writable({} as any as Database)
|
export const DataBase = writable({} as any as Database)
|
||||||
export const loadedStore = writable(false)
|
export const loadedStore = writable(false)
|
||||||
export let appVer = '1.21.2'
|
export let appVer = '1.22.2'
|
||||||
|
|
||||||
export function setDatabase(data:Database){
|
export function setDatabase(data:Database){
|
||||||
if(checkNullish(data.characters)){
|
if(checkNullish(data.characters)){
|
||||||
@@ -283,6 +283,7 @@ export interface loreBook{
|
|||||||
extentions?:{
|
extentions?:{
|
||||||
risu_case_sensitive:boolean
|
risu_case_sensitive:boolean
|
||||||
}
|
}
|
||||||
|
activationPercent?:number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface character{
|
export interface character{
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":"1.21.2"}
|
{"version":"1.22.2"}
|
||||||
Reference in New Issue
Block a user