Update version to 1.13.1 (#77)
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
},
|
||||
"package": {
|
||||
"productName": "RisuAI",
|
||||
"version": "1.13.1"
|
||||
"version": "1.13.2"
|
||||
},
|
||||
"tauri": {
|
||||
"allowlist": {
|
||||
|
||||
@@ -72,7 +72,11 @@ 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.**",
|
||||
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.",
|
||||
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 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 Prompt decides what prompt should be sent to summarize. if you leave it blank, it will use the default prompt. leaving blank is recommended.\n\n"
|
||||
+ "After it is all setup, you can able it in the setting of a character."
|
||||
},
|
||||
setup: {
|
||||
chooseProvider: "Choose AI Provider",
|
||||
@@ -244,8 +248,8 @@ export const languageEnglish = {
|
||||
creator: "Creator",
|
||||
CharVersion: "Character Version",
|
||||
Speech: "Speech",
|
||||
ToggleSuperMemory: "Toggle SupaMemory",
|
||||
SuperMemory:"SupaMemory",
|
||||
ToggleSuperMemory: "Toggle SuperMemory",
|
||||
SuperMemory:"SuperMemory",
|
||||
useExperimental: "Able Experimental Features",
|
||||
showMemoryLimit: "Show Memory Limit",
|
||||
roundIcons: "Round Icons",
|
||||
|
||||
@@ -229,8 +229,8 @@ export const languageKorean = {
|
||||
creator: "제작자",
|
||||
CharVersion: "캐릭터 버전",
|
||||
Speech: "음성",
|
||||
ToggleSuperMemory: "SupaMemory 토글",
|
||||
SuperMemory:"SupaMemory",
|
||||
ToggleSuperMemory: "슈퍼메모리 토글",
|
||||
SuperMemory:"슈퍼메모리",
|
||||
useExperimental: "실험적 요소 보이기",
|
||||
showMemoryLimit: "기억 한계치 보이기",
|
||||
roundIcons: "둥근 아이콘",
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<input class="text-neutral-200 mb-4 p-2 bg-transparent input-text focus:bg-selected text-sm" bind:value={$DataBase.elevenLabKey}>
|
||||
|
||||
|
||||
<span class="text-neutral-200 mt-4 text-lg font-bold">SupaMemory</span>
|
||||
<span class="text-neutral-200 mt-4 text-lg font-bold">{language.SuperMemory} <Help key="superMemory" /></span>
|
||||
<span class="text-neutral-200 mt-4">{language.SuperMemory} {language.model}</span>
|
||||
<select class="bg-transparent input-text mt-2 mb-2 text-gray-200 appearance-none text-sm" bind:value={$DataBase.supaMemoryType}>
|
||||
<option value="none" class="bg-darkbg appearance-none">None</option>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { cloneDeep } from 'lodash';
|
||||
|
||||
export const DataBase = writable({} as any as Database)
|
||||
export const loadedStore = writable(false)
|
||||
export let appVer = '1.13.1'
|
||||
export let appVer = '1.13.2'
|
||||
|
||||
|
||||
export function setDatabase(data:Database){
|
||||
|
||||
@@ -3,7 +3,7 @@ import { alertError, alertInput, alertNormal, alertSelect, alertStore } from "..
|
||||
import { DataBase, setDatabase, type Database } from "../database";
|
||||
import { forageStorage, getUnpargeables, isTauri } from "../globalApi";
|
||||
import pako from "pako";
|
||||
import { BaseDirectory, readBinaryFile, readDir, writeBinaryFile } from "@tauri-apps/api/fs";
|
||||
import { BaseDirectory, exists, readBinaryFile, readDir, writeBinaryFile } from "@tauri-apps/api/fs";
|
||||
import { language } from "../../lang";
|
||||
import { relaunch } from '@tauri-apps/api/process';
|
||||
import { open } from '@tauri-apps/api/shell';
|
||||
@@ -167,11 +167,16 @@ async function loadDrive(ACCESS_TOKEN:string) {
|
||||
let loadedForageKeys = false
|
||||
|
||||
async function checkImageExists(images:string) {
|
||||
if(!loadedForageKeys){
|
||||
foragekeys = await forageStorage.keys()
|
||||
loadedForageKeys = true
|
||||
if(isTauri){
|
||||
return await exists(`assets/` + images, {dir: BaseDirectory.AppData})
|
||||
}
|
||||
else{
|
||||
if(!loadedForageKeys){
|
||||
foragekeys = await forageStorage.keys()
|
||||
loadedForageKeys = true
|
||||
}
|
||||
return foragekeys.includes('assets/' + images)
|
||||
}
|
||||
return foragekeys.includes('assets/' + images)
|
||||
}
|
||||
const fileNames = files.map((d) => {
|
||||
return d.name
|
||||
|
||||
@@ -25,6 +25,7 @@ export async function supaMemory(chats:OpenAIChat[],currentTokens:number,maxCont
|
||||
}
|
||||
|
||||
let supaMemory = ''
|
||||
let lastId = ''
|
||||
|
||||
if(room.supaMemoryData && room.supaMemoryData.length > 4){
|
||||
const splited = room.supaMemoryData.split('\n')
|
||||
@@ -41,6 +42,7 @@ export async function supaMemory(chats:OpenAIChat[],currentTokens:number,maxCont
|
||||
}
|
||||
}
|
||||
if(chats[0].memo === id){
|
||||
lastId = id
|
||||
break
|
||||
}
|
||||
currentTokens -= (await tokenize(chats[0].content) + 1)
|
||||
@@ -64,35 +66,11 @@ export async function supaMemory(chats:OpenAIChat[],currentTokens:number,maxCont
|
||||
}
|
||||
}
|
||||
|
||||
let lastId = ''
|
||||
|
||||
while(currentTokens > maxContextTokens){
|
||||
const maxChunkSize = maxContextTokens > 3000 ? 1200 : Math.floor(maxContextTokens / 2.5)
|
||||
let chunkSize = 0
|
||||
let stringlizedChat = ''
|
||||
|
||||
while(true){
|
||||
const cont = chats[0]
|
||||
if(!cont){
|
||||
return {
|
||||
currentTokens: currentTokens,
|
||||
chats: chats,
|
||||
error: "Not Enough Chunks"
|
||||
}
|
||||
}
|
||||
const tokens = await tokenize(cont.content) + 1
|
||||
if((chunkSize + tokens) > maxChunkSize){
|
||||
lastId = cont.memo
|
||||
break
|
||||
}
|
||||
stringlizedChat += `${cont.role === 'assistant' ? char.type === 'group' ? '' : char.name : db.username}: ${cont.content}\n\n`
|
||||
chats.splice(0, 1)
|
||||
currentTokens -= tokens
|
||||
chunkSize += tokens
|
||||
}
|
||||
|
||||
async function summarize(stringlizedChat:string){
|
||||
|
||||
const supaPrompt = db.supaMemoryPrompt === '' ?
|
||||
"[Summarize the ongoing role story. It must also remove redundancy and unnecessary content from the prompt so that gpt3 and other sublanguage models]\n"
|
||||
"[Summarize the ongoing role story, including as many events from the past as possible, using assistant as a narrative helper;do not analyze. include all of the characters' names, statuses, thoughts, relationships, and attire. Be sure to include dialogue exchanges and context by referencing previous statements and reactions. assistant's summary should provide an objective overview of the story while also considering relevant past conversations and events. It must also remove redundancy and unnecessary content from the prompt so that gpt3 and other sublanguage models]\n"
|
||||
: db.supaMemoryPrompt
|
||||
|
||||
let result = ''
|
||||
@@ -109,7 +87,7 @@ export async function supaMemory(chats:OpenAIChat[],currentTokens:number,maxCont
|
||||
body: JSON.stringify({
|
||||
"model": db.supaMemoryType === 'curie' ? "text-curie-001" : "text-davinci-003",
|
||||
"prompt": promptbody,
|
||||
"max_tokens": 500,
|
||||
"max_tokens": 600,
|
||||
"temperature": 0
|
||||
})
|
||||
})
|
||||
@@ -147,12 +125,77 @@ export async function supaMemory(chats:OpenAIChat[],currentTokens:number,maxCont
|
||||
}
|
||||
result = da.result
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
while(currentTokens > maxContextTokens){
|
||||
const beforeToken = currentTokens
|
||||
let maxChunkSize = maxContextTokens > 3500 ? 1200 : Math.floor(maxContextTokens / 3)
|
||||
let summarized = false
|
||||
let chunkSize = 0
|
||||
let stringlizedChat = ''
|
||||
let spiceLen = 0
|
||||
while(true){
|
||||
const cont = chats[spiceLen]
|
||||
if(!cont){
|
||||
currentTokens = beforeToken
|
||||
stringlizedChat = ''
|
||||
chunkSize = 0
|
||||
spiceLen = 0
|
||||
if(summarized){
|
||||
if(maxChunkSize < 500){
|
||||
return {
|
||||
currentTokens: currentTokens,
|
||||
chats: chats,
|
||||
error: "Not Enough Tokens"
|
||||
}
|
||||
}
|
||||
maxChunkSize = maxChunkSize * 0.7
|
||||
}
|
||||
else{
|
||||
const result = await summarize(supaMemory)
|
||||
if(typeof(result) !== 'string'){
|
||||
return result
|
||||
}
|
||||
|
||||
console.log(currentTokens)
|
||||
currentTokens -= await tokenize(supaMemory)
|
||||
currentTokens += await tokenize(result + '\n\n')
|
||||
console.log(currentTokens)
|
||||
|
||||
supaMemory = result + '\n\n'
|
||||
summarized = true
|
||||
if(currentTokens <= maxContextTokens){
|
||||
break
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
const tokens = await tokenize(cont.content) + 1
|
||||
if((chunkSize + tokens) > maxChunkSize){
|
||||
lastId = cont.memo
|
||||
break
|
||||
}
|
||||
stringlizedChat += `${cont.role === 'assistant' ? char.type === 'group' ? '' : char.name : db.username}: ${cont.content}\n\n`
|
||||
spiceLen += 1
|
||||
currentTokens -= tokens
|
||||
chunkSize += tokens
|
||||
}
|
||||
chats.splice(0, spiceLen)
|
||||
|
||||
if(stringlizedChat !== ''){
|
||||
const result = await summarize(stringlizedChat)
|
||||
|
||||
if(typeof(result) !== 'string'){
|
||||
return result
|
||||
}
|
||||
|
||||
const tokenz = await tokenize(result + '\n\n') + 5
|
||||
currentTokens += tokenz
|
||||
supaMemory += result.replace(/\n+/g,'\n') + '\n\n'
|
||||
}
|
||||
|
||||
|
||||
|
||||
const tokenz = await tokenize(result + '\n\n') + 5
|
||||
currentTokens += tokenz
|
||||
supaMemory += result + '\n\n'
|
||||
}
|
||||
|
||||
chats.unshift({
|
||||
@@ -171,4 +214,5 @@ export async function supaMemory(chats:OpenAIChat[],currentTokens:number,maxCont
|
||||
currentTokens: currentTokens,
|
||||
chats: chats
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":"1.13.1"}
|
||||
{"version":"1.13.2"}
|
||||
Reference in New Issue
Block a user