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/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} 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..7d46ce71 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 ={ @@ -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){ @@ -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 ={ diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts index 8eb3b001..ed8a6543 100644 --- a/src/ts/process/request.ts +++ b/src/ts/process/request.ts @@ -1617,12 +1617,17 @@ 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 + } } } - if(e.type === 'reconnect-interval'){ - //TODO: handle reconnect interval - } }) const reader = res.body.getReader() while(true){ 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