feat: add updateGUI
This commit is contained in:
@@ -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 { CurrentVariablePointer, moduleBackgroundEmbedding, selectedCharID } from "src/ts/stores";
|
||||
import { CurrentVariablePointer, moduleBackgroundEmbedding, ReloadGUIPointer, selectedCharID } from "src/ts/stores";
|
||||
import { onDestroy } from "svelte";
|
||||
|
||||
let backgroundHTML = ''
|
||||
@@ -43,10 +43,12 @@
|
||||
|
||||
{#if backgroundHTML || $moduleBackgroundEmbedding}
|
||||
{#key $CurrentVariablePointer}
|
||||
<div class="absolute top-0 left-0 w-full h-full">
|
||||
{#await ParseMarkdown(risuChatParser((backgroundHTML || '') + ($moduleBackgroundEmbedding || ''), {chara:currentChar}), currentChar, 'back') then md}
|
||||
{@html md}
|
||||
{/await}
|
||||
</div>
|
||||
{#key $ReloadGUIPointer}
|
||||
<div class="absolute top-0 left-0 w-full h-full">
|
||||
{#await ParseMarkdown(risuChatParser((backgroundHTML || '') + ($moduleBackgroundEmbedding || ''), {chara:currentChar}), currentChar, 'back') then md}
|
||||
{@html md}
|
||||
{/await}
|
||||
</div>
|
||||
{/key}
|
||||
{/key}
|
||||
{/if}
|
||||
@@ -5,7 +5,7 @@
|
||||
import { alertConfirm, alertError, alertRequestData } from "../../ts/alert";
|
||||
import { language } from "../../lang";
|
||||
import { DataBase, type MessageGenerationInfo } from "../../ts/storage/database";
|
||||
import { CurrentCharacter, CurrentChat, CurrentVariablePointer, HideIconStore } from "../../ts/stores";
|
||||
import { CurrentCharacter, CurrentChat, CurrentVariablePointer, HideIconStore, ReloadGUIPointer } from "../../ts/stores";
|
||||
import { translateHTML } from "../../ts/translator/translator";
|
||||
import { risuChatParser } from "src/ts/process/scripts";
|
||||
import { get } from "svelte/store";
|
||||
@@ -276,14 +276,15 @@
|
||||
style:font-size="{0.875 * ($DataBase.zoomsize / 100)}rem"
|
||||
style:line-height="{($DataBase.lineHeight ?? 1.25) * ($DataBase.zoomsize / 100)}rem"
|
||||
>
|
||||
{#key $CurrentVariablePointer}
|
||||
{#await markParsing(msgDisplay, character, 'normal', idx, translated)}
|
||||
{@html lastParsed}
|
||||
{:then md}
|
||||
{@html md}
|
||||
{/await}
|
||||
{#key $ReloadGUIPointer}
|
||||
{#key $CurrentVariablePointer}
|
||||
{#await markParsing(msgDisplay, character, 'normal', idx, translated)}
|
||||
{@html lastParsed}
|
||||
{:then md}
|
||||
{@html md}
|
||||
{/await}
|
||||
{/key}
|
||||
{/key}
|
||||
|
||||
</span>
|
||||
{/if}
|
||||
</span>
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getChatVar, risuChatParser, setChatVar, type simpleCharacterArgument }
|
||||
import { LuaEngine, LuaFactory } from "wasmoon";
|
||||
import { DataBase, setDatabase, type Chat, type character, type groupChat } from "../storage/database";
|
||||
import { get } from "svelte/store";
|
||||
import { CurrentCharacter, CurrentChat, selectedCharID } from "../stores";
|
||||
import { CurrentCharacter, CurrentChat, CurrentVariablePointer, ReloadGUIPointer, selectedCharID } from "../stores";
|
||||
import { alertError, alertInput, alertNormal } from "../alert";
|
||||
import { HypaProcesser } from "./memory/hypamemory";
|
||||
import { generateAIImage } from "./stableDiff";
|
||||
@@ -191,6 +191,10 @@ export async function runLua(code:string, arg:{
|
||||
console.log(JSON.parse(value))
|
||||
})
|
||||
|
||||
luaEngine.global.set('updateGUI', () => {
|
||||
ReloadGUIPointer.set(get(ReloadGUIPointer) + 1)
|
||||
})
|
||||
|
||||
//Low Level Access
|
||||
luaEngine.global.set('similarity', async (id:string, source:string, value:string[]) => {
|
||||
if(!LuaLowLevelIds.has(id)){
|
||||
|
||||
@@ -38,6 +38,7 @@ export const CurrentShowMemoryLimit = writable(false) as Writable<boolean>
|
||||
export const ShowVN = writable(false)
|
||||
export const SettingsMenuIndex = writable(-1)
|
||||
export const CurrentVariablePointer = writable({} as {[key:string]: string|number|boolean})
|
||||
export const ReloadGUIPointer = writable(0)
|
||||
export const OpenRealmStore = writable(false)
|
||||
export const ShowRealmFrameStore = writable('')
|
||||
export const PlaygroundStore = writable(0)
|
||||
|
||||
Reference in New Issue
Block a user