Migrate all DataBase to DBState
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Template } from '@huggingface/jinja';
|
||||
import type { OpenAIChat } from '..';
|
||||
import { get } from 'svelte/store';
|
||||
import { DataBase, getCurrentCharacter } from 'src/ts/storage/database.svelte';
|
||||
import { getCurrentCharacter, getDatabase } from 'src/ts/storage/database.svelte';
|
||||
import { getUserName } from 'src/ts/util';
|
||||
|
||||
export const chatTemplates = {
|
||||
@@ -29,7 +28,7 @@ export const applyChatTemplate = (messages:OpenAIChat[], arg:{
|
||||
type?: string
|
||||
custom?: string
|
||||
} = {}) => {
|
||||
const db = get(DataBase)
|
||||
const db = getDatabase()
|
||||
const currentChar = getCurrentCharacter()
|
||||
const type = arg.type ?? db.instructChatTemplate
|
||||
if(!type){
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { DataBase, setPreset, type botPreset, setDatabase } from "src/ts/storage/database.svelte";
|
||||
import { setPreset, type botPreset, setDatabase, getDatabase } from "src/ts/storage/database.svelte";
|
||||
import { defaultAutoSuggestPrefixOoba, defaultAutoSuggestPrompt, defaultAutoSuggestPromptOoba } from "src/ts/storage/defaultPrompts";
|
||||
import { get } from "svelte/store";
|
||||
import { prebuiltNAIpresets, prebuiltPresets } from "./templates";
|
||||
import { prebuiltPresets } from "./templates";
|
||||
import { alertConfirm, alertSelect } from "src/ts/alert";
|
||||
import { language } from "src/lang";
|
||||
|
||||
export async function setRecommended(model: string, ask:'ask'|'force') {
|
||||
const db = get(DataBase)
|
||||
const db = getDatabase()
|
||||
if(!(recommendedPresetExist(model))){
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { risuChatParser } from "src/ts/parser"
|
||||
import { DataBase } from "src/ts/storage/database.svelte"
|
||||
import { get } from "svelte/store"
|
||||
import { getDatabase } from "src/ts/storage/database.svelte"
|
||||
|
||||
export function convertInterfaceToSchema(int:string){
|
||||
if(!int.startsWith('interface ') && !int.startsWith('export interface ')){
|
||||
@@ -122,7 +121,7 @@ export function convertInterfaceToSchema(int:string){
|
||||
}
|
||||
|
||||
export function getOpenAIJSONSchema(){
|
||||
const db = get(DataBase)
|
||||
const db = getDatabase()
|
||||
const schema = {
|
||||
"name": "format",
|
||||
"strict": db.strictJsonSchema,
|
||||
|
||||
Reference in New Issue
Block a user