Migrate all DataBase to DBState

This commit is contained in:
kwaroran
2024-10-24 01:59:57 +09:00
parent 4e9190f1b5
commit b3fddb814e
65 changed files with 331 additions and 434 deletions

View File

@@ -4,8 +4,7 @@ import { requestChatData } from "../process/request";
import { checkCharOrder, globalFetch, isNodeServer, isTauri, saveAsset } from "../storage/globalApi";
import { tokenize } from "../tokenizer";
import { createBlankChar } from "../characters";
import { DataBase, setDatabase, type character } from "../storage/database.svelte";
import { get } from "svelte/store";
import { getDatabase, setDatabase, type character } from "../storage/database.svelte";
import { sleep } from "../util";
import { Capacitor } from "@capacitor/core";
@@ -306,7 +305,7 @@ async function createBotFromWeb() {
})
const d = (sel === 0) ? (await createBotFromWebMain(search)) : (await createBotByAI(search))
if(d.ok === 'creation'){
const db = get(DataBase)
const db = getDatabase()
const cha = d.data
const fm = await createFirstMsg(cha.desc)
if(fm.type === 'multiline' || fm.type === 'fail' || fm.type === 'streaming'){