Migrate to svelte 5

This commit is contained in:
kwaroran
2024-10-23 02:31:37 +09:00
parent e434c7ab96
commit c7330719ad
120 changed files with 2398 additions and 2033 deletions

View File

@@ -1,9 +1,9 @@
import { parseChatML, risuChatParser } from "../parser";
import { DataBase, type Chat, type character } from "../storage/database";
import { DataBase, getCurrentCharacter, getCurrentChat, type Chat, type character } from "../storage/database";
import { tokenize } from "../tokenizer";
import { getModuleTriggers } from "./modules";
import { get } from "svelte/store";
import { CurrentCharacter, CurrentChat, ReloadGUIPointer, selectedCharID } from "../stores";
import { ReloadGUIPointer, selectedCharID } from "../stores";
import { processMultiCommand } from "./command";
import { parseKeyValue } from "../util";
import { alertError, alertInput, alertNormal, alertSelect } from "../alert";
@@ -157,7 +157,7 @@ export async function runTrigger(char:character,mode:triggerMode, arg:{
let stopSending = arg.stopSending ?? false
const CharacterlowLevelAccess = char.lowLevelAccess ?? false
let sendAIprompt = false
const currentChat = get(CurrentChat)
const currentChat = getCurrentChat()
let additonalSysPrompt:additonalSysPrompt = arg.additonalSysPrompt ?? {
start:'',
historyend: '',
@@ -190,7 +190,7 @@ export async function runTrigger(char:character,mode:triggerMode, arg:{
function setVar(key:string, value:string){
const selectedCharId = get(selectedCharID)
const currentCharacter = get(CurrentCharacter)
const currentCharacter = getCurrentCharacter()
const db = get(DataBase)
varChanged = true
chat.scriptstate ??= {}
@@ -517,7 +517,7 @@ export async function runTrigger(char:character,mode:triggerMode, arg:{
if(triggerCodeResult.stopSending){
stopSending = true
}
chat = get(CurrentChat)
chat = getCurrentChat()
break
}
}
@@ -535,7 +535,7 @@ export async function runTrigger(char:character,mode:triggerMode, arg:{
caculatedTokens += await tokenize(additonalSysPrompt.promptend)
}
if(varChanged){
const currentChat = get(CurrentChat)
const currentChat = getCurrentChat()
currentChat.scriptstate = chat.scriptstate
ReloadGUIPointer.set(get(ReloadGUIPointer) + 1)
}