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

@@ -1,5 +1,5 @@
import { get } from "svelte/store"
import { DataBase, type character } from "../storage/database.svelte"
import { getDatabase, type character } from "../storage/database.svelte"
import { requestChatData } from "./request"
import { alertError } from "../alert"
import { globalFetch, readImage } from "../storage/globalApi"
@@ -8,7 +8,7 @@ import type { OpenAIChat } from "."
import { processZip } from "./processzip"
import { keiServerURL } from "../kei/kei"
export async function stableDiff(currentChar:character,prompt:string){
let db = get(DataBase)
let db = getDatabase()
if(db.sdProvider === ''){
alertError("Stable diffusion is not set in settings.")
@@ -56,7 +56,7 @@ export async function stableDiff(currentChar:character,prompt:string){
}
export async function generateAIImage(genPrompt:string, currentChar:character, neg:string, returnSdData:string):Promise<string|false>{
const db = get(DataBase)
const db = getDatabase()
console.log(db.sdProvider)
if(db.sdProvider === 'webui'){
@@ -490,7 +490,7 @@ export async function generateAIImage(genPrompt:string, currentChar:character, n
}
}
if(db.sdProvider === 'kei'){
const db = get(DataBase)
const db = getDatabase()
let auth = db?.account?.token
if(!auth){
db.account = JSON.parse(localStorage.getItem("fallbackRisuToken"))