Refactor svelte/legacy functions to svelte 5 syntax

This commit is contained in:
kwaroran
2024-10-23 21:03:34 +09:00
parent f078292843
commit 9add01cda2
24 changed files with 201 additions and 216 deletions

View File

@@ -1,6 +1,4 @@
<script lang="ts">
import { run } from 'svelte/legacy';
import { language } from "../../lang";
import { tokenizeAccurate } from "../../ts/tokenizer";
import { DataBase, saveImage as saveAsset, type Database, type character, type groupChat } from "../../ts/storage/database";
@@ -126,7 +124,7 @@
let assetFilePath:string[] = $state([])
let licensed = $state((currentChar.type === 'character') ? currentChar.data.license : '')
run(() => {
$effect.pre(() => {
if(database.characters[$selectedCharID].chaId === currentChar.data.chaId){
database.characters[$selectedCharID] = currentChar.data
}
@@ -156,10 +154,10 @@
onDestroy(unsub);
run(() => {
$effect.pre(() => {
licensed = (currentChar.type === 'character') ? currentChar.data.license : ''
});
run(() => {
$effect.pre(() => {
if (currentChar.data.ttsMode === 'novelai' && (currentChar.data as character).naittsConfig === undefined) {
(currentChar.data as character).naittsConfig = {
customvoice: false,
@@ -168,7 +166,7 @@
};
}
});
run(() => {
$effect.pre(() => {
if (currentChar.data.ttsMode === 'gptsovits' && (currentChar.data as character).gptSoVitsConfig === undefined) {
(currentChar.data as character).gptSoVitsConfig = {
url: '',
@@ -199,7 +197,7 @@
description:string
}[] = $state([])
run(() => {
$effect.pre(() => {
if (currentChar.data.ttsMode === 'fishspeech' && (currentChar.data as character).fishSpeechConfig === undefined) {
(currentChar.data as character).fishSpeechConfig = {
model: {
@@ -213,7 +211,7 @@
}
});
run(() => {
$effect.pre(() => {
if(currentChar.type === 'group' && ($CharConfigSubMenu === 4 || $CharConfigSubMenu === 5)){
$CharConfigSubMenu = 0
}

View File

@@ -1,6 +1,4 @@
<script lang="ts">
import { preventDefault } from 'svelte/legacy';
import {
CharEmotion,
DynamicGUI,