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 { sleep } from "src/ts/util";
import * as path from "@tauri-apps/api/path";
import { exists, readTextFile } from "@tauri-apps/plugin-fs";
import { alertClear, alertError, alertMd, alertWait } from "src/ts/alert";
import { get } from "svelte/store";
import { DataBase } from "src/ts/storage/database.svelte";
import { getDatabase } from "src/ts/storage/database.svelte";
let serverRunning = false;
export function checkLocalModel():Promise<string>{
@@ -130,7 +129,7 @@ export async function loadExllamaFull(){
async function runLocalModelOld(prompt:string){
const db = get(DataBase)
const db = getDatabase()
if(!serverRunning){
await loadExllamaFull()
@@ -273,7 +272,7 @@ export async function runGGUFModel(arg:{
export async function tokenizeGGUFModel(prompt:string):Promise<number[]> {
const key = await getLocalKey()
const db = get(DataBase)
const db = getDatabase()
const modelPath = db.aiModel.replace('local_', '')
const b = await fetch("http://localhost:10026/llamacpp/tokenize", {
method: "POST",