Replace cloneDeep to native structuredclone and remove unused import

This commit is contained in:
kwaroran
2024-04-25 01:17:14 +09:00
parent cc744853d2
commit 11b1d4d4f3
22 changed files with 85 additions and 115 deletions

View File

@@ -2,11 +2,8 @@ import { get } from 'svelte/store'
import type { ScriptMode } from '../process/scripts'
//@ts-ignore
import WorkerUrl from './embedworker?worker&url'
import { DataBase, type Chat, type character, type Message } from '../storage/database'
import { DataBase, type Message } from '../storage/database'
import { selectedCharID } from '../stores'
import { add, cloneDeep } from 'lodash'
import { sleep } from '../util'
import { characterFormatUpdate } from '../characters'
import { setDatabase } from '../storage/database'
let worker = new Worker(WorkerUrl, {type: 'module'})
@@ -83,7 +80,7 @@ addWorkerFunction('getChat', async () => {
const db = get(DataBase)
const selectedChar = get(selectedCharID)
const char = db.characters[selectedChar]
return cloneDeep(char.chats[char.chatPage].message)
return structuredClone(char.chats[char.chatPage].message)
})
addWorkerFunction('setChat', async (data:Message[]) => {