Migrate all DataBase to DBState
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { DataBase } from "src/ts/storage/database.svelte";
|
||||
import { get } from "svelte/store";
|
||||
import { getDatabase } from "src/ts/storage/database.svelte";
|
||||
|
||||
export function getGenerationModelString(){
|
||||
const db = get(DataBase)
|
||||
const db = getDatabase()
|
||||
switch (db.aiModel){
|
||||
case 'reverse_proxy':
|
||||
return 'reverse_proxy-' + (db.reverseProxyOobaMode ? 'ooba' : db.proxyRequestModel)
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { DataBase, setDatabase } from "src/ts/storage/database.svelte"
|
||||
import { getDatabase, setDatabase } from "src/ts/storage/database.svelte"
|
||||
import type { OpenAIChat } from ".."
|
||||
import { get } from "svelte/store"
|
||||
import { globalFetch } from "src/ts/storage/globalApi"
|
||||
import { alertError, alertInput, alertNormal, alertWait } from "src/ts/alert"
|
||||
import { getUserName, sleep } from "src/ts/util"
|
||||
|
||||
export function stringlizeNAIChat(formated:OpenAIChat[], char:string, continued: boolean){
|
||||
const db = get(DataBase)
|
||||
const db = getDatabase()
|
||||
let seperator = db.NAIsettings.seperator.replaceAll("\\n","\n") || '\n'
|
||||
let starter = db.NAIsettings.starter.replaceAll("\\n","\n") || '⁂'
|
||||
let resultString:string[] = []
|
||||
@@ -109,7 +108,7 @@ export const novelLogin = async () => {
|
||||
|
||||
const data = r.data?.accessToken
|
||||
|
||||
const db = get(DataBase)
|
||||
const db = getDatabase()
|
||||
db.novelai.token = data
|
||||
|
||||
alertNormal('Logged in to NovelAI')
|
||||
|
||||
Reference in New Issue
Block a user