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,8 +1,6 @@
import localforage from "localforage";
import { selectSingleFile } from "../../util";
import { v4 } from "uuid";
import { DataBase } from "../../storage/database.svelte";
import { get } from "svelte/store";
import { getDatabase } from "../../storage/database.svelte";
import { checkImageType } from "../../parser";
const inlayStorage = localforage.createInstance({
@@ -85,7 +83,7 @@ export async function getInlayImage(id: string){
}
export function supportsInlayImage(){
const db = get(DataBase)
const db = getDatabase()
return db.aiModel.startsWith('gptv') || db.aiModel === 'gemini-pro-vision' || db.aiModel.startsWith('claude-3') || db.aiModel.startsWith('gpt4_turbo') || db.aiModel.startsWith('gpt5') || db.aiModel.startsWith('gpt4o') ||
(db.aiModel === 'reverse_proxy' && (
db.proxyRequestModel?.startsWith('gptv') || db.proxyRequestModel === 'gemini-pro-vision' || db.proxyRequestModel?.startsWith('claude-3') || db.proxyRequestModel.startsWith('gpt4_turbo') ||

View File

@@ -1,4 +1,4 @@
import { DataBase, setDatabase } from 'src/ts/storage/database.svelte';
import { getDatabase, setDatabase } from 'src/ts/storage/database.svelte';
import { selectedCharID } from 'src/ts/stores';
import { get } from 'svelte/store';
import { doingChat, sendChat } from '..';
@@ -19,7 +19,7 @@ async function sendPofile(arg:sendFileArg){
let note = ''
let speaker = ''
let parseMode = 0
const db = get(DataBase)
const db = getDatabase()
let currentChar = db.characters[get(selectedCharID)]
let currentChat = currentChar.chats[currentChar.chatPage]
const lines = arg.file.split('\n')