Fix var not updating

This commit is contained in:
kwaroran
2024-04-10 12:16:00 +09:00
parent 1d368ddc3c
commit 408bbbd2e6
3 changed files with 12 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
<script lang="ts">
import { ParseMarkdown, risuChatParser } from "src/ts/parser";
import { DataBase, type Database, type character, type groupChat } from "src/ts/storage/database";
import { selectedCharID } from "src/ts/stores";
import { CurrentVariablePointer, selectedCharID } from "src/ts/stores";
import { onDestroy } from "svelte";
let backgroundHTML = ''
@@ -42,7 +42,7 @@
{#if backgroundHTML}
{#key currentChar}
{#key $CurrentVariablePointer}
<div class="absolute top-0 left-0 w-full h-full">
{#await ParseMarkdown(risuChatParser(backgroundHTML, {chara:currentChar}), currentChar, 'back') then md}
{@html md}

View File

@@ -11,7 +11,7 @@
import { get } from "svelte/store";
import { capitalize, isEqual } from "lodash";
import { sayTTS } from "src/ts/process/tts";
import { getModelShortName } from "src/ts/model/names";
import { getModelShortName } from "src/ts/model/names";
export let message = ''
export let name = ''
export let largePortrait = false
@@ -68,7 +68,7 @@
$CurrentChat.message = msg
}
function displaya(message:string){
function displaya(message:string, chatPointer?:any){
msgDisplay = risuChatParser(message, {chara: name, chatID: idx, rmVar: true, visualize: true})
}
@@ -124,7 +124,7 @@
}
}
$: displaya(message)
$: displaya(message, $CurrentVariablePointer)
</script>
<div class="flex max-w-full justify-center risu-chat" style={isLastMemory ? `border-top:${$DataBase.memoryLimitThickness}px solid rgba(98, 114, 164, 0.7);` : ''}>
<div class="text-textcolor mt-1 ml-4 mr-4 mb-1 p-2 bg-transparent flex-grow border-t-gray-900 border-opacity-30 border-transparent flexium items-start max-w-full" >
@@ -228,13 +228,11 @@
style:font-size="{0.875 * ($DataBase.zoomsize / 100)}rem"
style:line-height="{1.25 * ($DataBase.zoomsize / 100)}rem"
>
{#key $CurrentVariablePointer}
{#await markParsing(msgDisplay, character, 'normal', idx, translated)}
{@html lastParsed}
{:then md}
{@html md}
{/await}
{/key}
{#await markParsing(msgDisplay, character, 'normal', idx, translated)}
{@html lastParsed}
{:then md}
{@html md}
{/await}
</span>
{/if}
</span>

View File

@@ -146,10 +146,11 @@ CurrentChat.subscribe((chat) => {
}
const variablePointer = get(CurrentVariablePointer)
const currentState = chat.scriptstate
const currentState = structuredClone(chat?.scriptstate)
if(!isEqual(variablePointer, currentState)){
CurrentVariablePointer.set(currentState)
console.log(currentState)
}
})