Fix var not updating
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { ParseMarkdown, risuChatParser } from "src/ts/parser";
|
import { ParseMarkdown, risuChatParser } from "src/ts/parser";
|
||||||
import { DataBase, type Database, type character, type groupChat } from "src/ts/storage/database";
|
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";
|
import { onDestroy } from "svelte";
|
||||||
|
|
||||||
let backgroundHTML = ''
|
let backgroundHTML = ''
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
|
|
||||||
{#if backgroundHTML}
|
{#if backgroundHTML}
|
||||||
{#key currentChar}
|
{#key $CurrentVariablePointer}
|
||||||
<div class="absolute top-0 left-0 w-full h-full">
|
<div class="absolute top-0 left-0 w-full h-full">
|
||||||
{#await ParseMarkdown(risuChatParser(backgroundHTML, {chara:currentChar}), currentChar, 'back') then md}
|
{#await ParseMarkdown(risuChatParser(backgroundHTML, {chara:currentChar}), currentChar, 'back') then md}
|
||||||
{@html md}
|
{@html md}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
import { get } from "svelte/store";
|
import { get } from "svelte/store";
|
||||||
import { capitalize, isEqual } from "lodash";
|
import { capitalize, isEqual } from "lodash";
|
||||||
import { sayTTS } from "src/ts/process/tts";
|
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 message = ''
|
||||||
export let name = ''
|
export let name = ''
|
||||||
export let largePortrait = false
|
export let largePortrait = false
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
$CurrentChat.message = msg
|
$CurrentChat.message = msg
|
||||||
}
|
}
|
||||||
|
|
||||||
function displaya(message:string){
|
function displaya(message:string, chatPointer?:any){
|
||||||
msgDisplay = risuChatParser(message, {chara: name, chatID: idx, rmVar: true, visualize: true})
|
msgDisplay = risuChatParser(message, {chara: name, chatID: idx, rmVar: true, visualize: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$: displaya(message)
|
$: displaya(message, $CurrentVariablePointer)
|
||||||
</script>
|
</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="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" >
|
<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:font-size="{0.875 * ($DataBase.zoomsize / 100)}rem"
|
||||||
style:line-height="{1.25 * ($DataBase.zoomsize / 100)}rem"
|
style:line-height="{1.25 * ($DataBase.zoomsize / 100)}rem"
|
||||||
>
|
>
|
||||||
{#key $CurrentVariablePointer}
|
{#await markParsing(msgDisplay, character, 'normal', idx, translated)}
|
||||||
{#await markParsing(msgDisplay, character, 'normal', idx, translated)}
|
{@html lastParsed}
|
||||||
{@html lastParsed}
|
{:then md}
|
||||||
{:then md}
|
{@html md}
|
||||||
{@html md}
|
{/await}
|
||||||
{/await}
|
|
||||||
{/key}
|
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -146,10 +146,11 @@ CurrentChat.subscribe((chat) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const variablePointer = get(CurrentVariablePointer)
|
const variablePointer = get(CurrentVariablePointer)
|
||||||
const currentState = chat.scriptstate
|
const currentState = structuredClone(chat?.scriptstate)
|
||||||
|
|
||||||
if(!isEqual(variablePointer, currentState)){
|
if(!isEqual(variablePointer, currentState)){
|
||||||
CurrentVariablePointer.set(currentState)
|
CurrentVariablePointer.set(currentState)
|
||||||
|
console.log(currentState)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user