From 0c2a9eef6c9bcc4788505092805b0b8f08736583 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Thu, 7 Mar 2024 00:08:23 +0900 Subject: [PATCH 1/7] Show supamemory by default --- src/lib/SideBars/CharConfig.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/SideBars/CharConfig.svelte b/src/lib/SideBars/CharConfig.svelte index 2a6c44ff..f8997736 100644 --- a/src/lib/SideBars/CharConfig.svelte +++ b/src/lib/SideBars/CharConfig.svelte @@ -667,7 +667,7 @@ - {#if currentChar.data.chats[currentChar.data.chatPage].supaMemoryData && currentChar.data.chats[currentChar.data.chatPage].supaMemoryData.length > 4} + {#if currentChar.data.chats[currentChar.data.chatPage].supaMemoryData && currentChar.data.chats[currentChar.data.chatPage].supaMemoryData.length > 4 || currentChar.data.supaMemory} {language.SuperMemory} {/if} @@ -840,7 +840,7 @@ {openHubUpload=false}}/> {/if} {:else} - {#if currentChar.data.chats[currentChar.data.chatPage].supaMemoryData && currentChar.data.chats[currentChar.data.chatPage].supaMemoryData.length > 4} + {#if currentChar.data.chats[currentChar.data.chatPage].supaMemoryData && currentChar.data.chats[currentChar.data.chatPage].supaMemoryData.length > 4 || currentChar.data.supaMemory} {language.SuperMemory} {/if} From 3c39c8fa5d3e46a30671f20c82ee861478fc5edd Mon Sep 17 00:00:00 2001 From: kwaroran Date: Thu, 7 Mar 2024 00:13:44 +0900 Subject: [PATCH 2/7] Add role CBS --- src/ts/parser.ts | 8 +++++++- src/ts/process/index.ts | 12 ++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/ts/parser.ts b/src/ts/parser.ts index 5dd86449..946abd1a 100644 --- a/src/ts/parser.ts +++ b/src/ts/parser.ts @@ -394,6 +394,7 @@ type matcherArg = { tokenizeAccurate?:boolean consistantChar?:boolean displaying?:boolean + role?:string } const matcher = (p1:string,matcherArg:matcherArg) => { if(p1.length > 100000){ @@ -635,6 +636,9 @@ const matcher = (p1:string,matcherArg:matcherArg) => { case 'axmodel':{ return db.subModel } + case 'role': { + return matcherArg.role ?? 'role' + } } const arra = p1.split("::") if(arra.length > 1){ @@ -824,7 +828,8 @@ export function risuChatParser(da:string, arg:{ var?:{[key:string]:string} tokenizeAccurate?:boolean consistantChar?:boolean - visualize?:boolean + visualize?:boolean, + role?:string } = {}):string{ const chatID = arg.chatID ?? -1 const db = arg.db ?? get(DataBase) @@ -870,6 +875,7 @@ export function risuChatParser(da:string, arg:{ var: arg.var ?? null, tokenizeAccurate: arg.tokenizeAccurate ?? false, displaying: arg.visualize ?? false, + role: arg.role } let pef = performance.now() while(pointer < da.length){ diff --git a/src/ts/process/index.ts b/src/ts/process/index.ts index f63977bd..04f12ec2 100644 --- a/src/ts/process/index.ts +++ b/src/ts/process/index.ts @@ -431,13 +431,13 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n let content = card.text if(card.type2 === 'globalNote'){ - content = (risuChatParser(currentChar.replaceGlobalNote?.replaceAll('{{original}}', content) || content, {chara:currentChar})) + content = (risuChatParser(currentChar.replaceGlobalNote?.replaceAll('{{original}}', content) || content, {chara: currentChar, role: card.role})) } else if(card.type2 === 'main'){ - content = (risuChatParser(content, {chara: currentChar})) + content = (risuChatParser(content, {chara: currentChar, role: card.role})) } else{ - content = risuChatParser(content, {chara: currentChar}) + content = risuChatParser(content, {chara: currentChar, role: card.role}) } const prompt:OpenAIChat ={ @@ -802,13 +802,13 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n let content = card.text if(card.type2 === 'globalNote'){ - content = (risuChatParser(currentChar.replaceGlobalNote?.replaceAll('{{original}}', content) || content, {chara:currentChar})) + content = (risuChatParser(currentChar.replaceGlobalNote?.replaceAll('{{original}}', content) || content, {chara:currentChar, role: card.role})) } else if(card.type2 === 'main'){ - content = (risuChatParser(content, {chara: currentChar})) + content = (risuChatParser(content, {chara: currentChar, role: card.role})) } else{ - content = risuChatParser(content, {chara: currentChar}) + content = risuChatParser(content, {chara: currentChar, role: card.role}) } const prompt:OpenAIChat ={ From 604ed576279798799b522d382047d0538fd82ac0 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Thu, 7 Mar 2024 00:16:40 +0900 Subject: [PATCH 3/7] Add role parameter to risuChatParser function --- src/ts/process/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ts/process/index.ts b/src/ts/process/index.ts index 04f12ec2..7d46ce71 100644 --- a/src/ts/process/index.ts +++ b/src/ts/process/index.ts @@ -537,7 +537,7 @@ export async function sendChat(chatProcessIndex = -1,arg:{chatAdditonalTokens?:n let index = 0 for(const msg of ms){ - let formatedChat = await processScript(nowChatroom,risuChatParser(msg.data, {chara: currentChar, rmVar: true}), 'editprocess') + let formatedChat = await processScript(nowChatroom,risuChatParser(msg.data, {chara: currentChar, rmVar: true, role: msg.role}), 'editprocess') let name = '' if(msg.role === 'char'){ if(msg.saying){ From 305812f35efe52ecf56b3d43d9ed0be90e9dcac7 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Thu, 7 Mar 2024 06:50:36 +0900 Subject: [PATCH 4/7] Add claude error handling --- src/ts/process/request.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts index 8eb3b001..36a05981 100644 --- a/src/ts/process/request.ts +++ b/src/ts/process/request.ts @@ -1617,6 +1617,15 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model' } break } + case 'error': { + if(e.data){ + text += "Error:" + JSON.parse(e.data).error?.message + controller.enqueue({ + "0": text + }) + } + break + } } } From 160384e8c6d28cfe5209496278df0b920a263b90 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Thu, 7 Mar 2024 07:20:59 +0900 Subject: [PATCH 5/7] Remove unused code for handling reconnect interval --- src/ts/process/request.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts index 36a05981..06deebdc 100644 --- a/src/ts/process/request.ts +++ b/src/ts/process/request.ts @@ -1629,9 +1629,6 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model' } } - if(e.type === 'reconnect-interval'){ - //TODO: handle reconnect interval - } }) const reader = res.body.getReader() while(true){ From d16e9e570883b83745ed1d41c3c178a51d3823a5 Mon Sep 17 00:00:00 2001 From: kwaroran Date: Thu, 7 Mar 2024 23:10:45 +0900 Subject: [PATCH 6/7] Remove unnecessary code block in requestChatDataMain function --- src/ts/process/request.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts index 06deebdc..ed8a6543 100644 --- a/src/ts/process/request.ts +++ b/src/ts/process/request.ts @@ -1626,7 +1626,6 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model' } break } - } } }) From 7be4fa7a02e8276e6fc24f25b330746cd7c2524b Mon Sep 17 00:00:00 2001 From: kwaroran Date: Thu, 7 Mar 2024 23:11:10 +0900 Subject: [PATCH 7/7] Update version to 1.82.1 --- src-tauri/tauri.conf.json | 2 +- src/ts/storage/database.ts | 2 +- version.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 20b7d352..e16be3f5 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "RisuAI", - "version": "1.82.0" + "version": "1.82.1" }, "tauri": { "allowlist": { diff --git a/src/ts/storage/database.ts b/src/ts/storage/database.ts index d7d0c3b8..2b8d6663 100644 --- a/src/ts/storage/database.ts +++ b/src/ts/storage/database.ts @@ -15,7 +15,7 @@ import type { OobaChatCompletionRequestParams } from '../model/ooba'; export const DataBase = writable({} as any as Database) export const loadedStore = writable(false) -export let appVer = "1.82.0" +export let appVer = "1.82.1" export let webAppSubVer = '' export function setDatabase(data:Database){ diff --git a/version.json b/version.json index 12e027f2..40b2f3df 100644 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{"version":"1.82.0"} \ No newline at end of file +{"version":"1.82.1"} \ No newline at end of file