Move DBState to stores
This commit is contained in:
@@ -4,7 +4,7 @@ import { language } from "../lang"
|
||||
import { isNodeServer, isTauri } from "./globalApi"
|
||||
import { Capacitor } from "@capacitor/core"
|
||||
import { getDatabase, type MessageGenerationInfo } from "./storage/database.svelte"
|
||||
import { alertStore as alertStoreImported } from "./stores"
|
||||
import { alertStore as alertStoreImported } from "./stores.svelte"
|
||||
|
||||
export interface alertData{
|
||||
type: 'error'|'normal'|'none'|'ask'|'wait'|'selectChar'
|
||||
|
||||
@@ -6,7 +6,7 @@ import { language } from "src/lang"
|
||||
import { v4 as uuidv4, v4 } from 'uuid';
|
||||
import { characterFormatUpdate } from "./characters"
|
||||
import { AppendableBuffer, BlankWriter, checkCharOrder, downloadFile, isNodeServer, isTauri, loadAsset, LocalWriter, openURL, readImage, saveAsset, VirtualWriter } from "./globalApi"
|
||||
import { SettingsMenuIndex, ShowRealmFrameStore, selectedCharID, settingsOpen } from "./stores"
|
||||
import { SettingsMenuIndex, ShowRealmFrameStore, selectedCharID, settingsOpen } from "./stores.svelte"
|
||||
import { convertImage, hasher } from "./parser.svelte"
|
||||
import { CCardLib, type CharacterCardV3, type LorebookEntry } from '@risuai/ccardlib'
|
||||
import { reencodeImage } from "./process/files/image"
|
||||
|
||||
@@ -5,7 +5,7 @@ import { language } from "../lang";
|
||||
import { decode as decodeMsgpack } from "msgpackr";
|
||||
import { checkNullish, findCharacterbyId, getUserName, selectMultipleFile, selectSingleFile, sleep } from "./util";
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { MobileGUIStack, OpenRealmStore, selectedCharID } from "./stores";
|
||||
import { MobileGUIStack, OpenRealmStore, selectedCharID } from "./stores.svelte";
|
||||
import { checkCharOrder, downloadFile, getFileSrc } from "./globalApi";
|
||||
import { reencodeImage } from "./process/files/image";
|
||||
import { updateInlayScreen } from "./process/inlayScreen";
|
||||
|
||||
@@ -16,7 +16,7 @@ import {open} from '@tauri-apps/plugin-shell'
|
||||
import { setDatabase, type Database, defaultSdDataFunc, getDatabase } from "./storage/database.svelte";
|
||||
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import { checkRisuUpdate } from "./update";
|
||||
import { MobileGUI, botMakerMode, selectedCharID, loadedStore } from "./stores";
|
||||
import { MobileGUI, botMakerMode, selectedCharID, loadedStore } from "./stores.svelte";
|
||||
import { loadPlugins } from "./plugins/plugins";
|
||||
import { alertConfirm, alertError, alertNormal, alertNormalWait, alertSelect, alertTOS, alertWait } from "./alert";
|
||||
import { checkDriverInit, syncDrive } from "./drive/drive";
|
||||
@@ -32,12 +32,10 @@ import { saveDbKei } from "./kei/backup";
|
||||
import { Capacitor, CapacitorHttp } from '@capacitor/core';
|
||||
import * as CapFS from '@capacitor/filesystem'
|
||||
import { save } from "@tauri-apps/plugin-dialog";
|
||||
import type { RisuModule } from "./process/modules";
|
||||
import { listen } from '@tauri-apps/api/event'
|
||||
import { registerPlugin } from '@capacitor/core';
|
||||
import { language } from "src/lang";
|
||||
import { startObserveDom } from "./observer";
|
||||
import { removeDefaultHandler } from "src/main";
|
||||
import { updateGuisize } from "./gui/guisize";
|
||||
import { encodeCapKeySafe } from "./storage/mobileStorage";
|
||||
import { updateLorebooks } from "./characters";
|
||||
@@ -623,7 +621,6 @@ export async function getFetchData(id: string) {
|
||||
* Updates the error handling by removing the default handler and adding custom handlers for errors and unhandled promise rejections.
|
||||
*/
|
||||
function updateErrorHandling() {
|
||||
removeDefaultHandler();
|
||||
const errorHandler = (event: ErrorEvent) => {
|
||||
console.error(event.error);
|
||||
alertError(event.error);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { downloadFile } from "../globalApi";
|
||||
import { BufferToText, selectSingleFile } from "../util";
|
||||
import { alertError } from "../alert";
|
||||
import { isLite } from "../lite";
|
||||
import { CustomCSSStore, SafeModeStore } from "../stores";
|
||||
import { CustomCSSStore, SafeModeStore } from "../stores.svelte";
|
||||
|
||||
export interface ColorScheme{
|
||||
bgcolor: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { get } from "svelte/store"
|
||||
import { alertSelect, alertToast, doingAlert } from "./alert"
|
||||
import { changeToPreset as changeToPreset2, getDatabase } from "./storage/database.svelte"
|
||||
import { MobileGUIStack, MobileSideBar, openPersonaList, openPresetList, SafeModeStore, selectedCharID, settingsOpen } from "./stores"
|
||||
import { MobileGUIStack, MobileSideBar, openPersonaList, openPresetList, SafeModeStore, selectedCharID, settingsOpen } from "./stores.svelte"
|
||||
import { language } from "src/lang"
|
||||
import { updateTextThemeAndCSS } from "./gui/colorscheme"
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import DOMPurify from 'isomorphic-dompurify';
|
||||
import markdownit from 'markdown-it'
|
||||
import { getCurrentCharacter, DBState, type Database, type Message, type character, type customscript, type groupChat, type triggerscript } from './storage/database.svelte';
|
||||
import { getCurrentCharacter, type Database, type Message, type character, type customscript, type groupChat, type triggerscript } from './storage/database.svelte';
|
||||
import { DBState } from './stores.svelte';
|
||||
import { getFileSrc } from './globalApi';
|
||||
import { processScriptFull } from './process/scripts';
|
||||
import { get } from 'svelte/store';
|
||||
import css, { type CssAtRuleAST } from '@adobe/css-tools'
|
||||
import { SizeStore, selectedCharID } from './stores';
|
||||
import { SizeStore, selectedCharID } from './stores.svelte';
|
||||
import { calcString } from './process/infunctions';
|
||||
import { findCharacterbyId, getPersonaPrompt, getUserIcon, getUserName, parseKeyValue, sfc32, sleep, uuidtoNumber } from './util';
|
||||
import { getInlayImage } from './process/files/image';
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { ScriptMode } from '../process/scripts'
|
||||
//@ts-ignore
|
||||
import WorkerUrl from './embedworker?worker&url'
|
||||
import { getDatabase, type Message } from '../storage/database.svelte'
|
||||
import { selectedCharID } from '../stores'
|
||||
import { selectedCharID } from '../stores.svelte'
|
||||
import { setDatabase } from '../storage/database.svelte'
|
||||
|
||||
let worker = new Worker(WorkerUrl, {type: 'module'})
|
||||
|
||||
@@ -5,7 +5,7 @@ import { getDatabase, setDatabaseLite } from "../storage/database.svelte";
|
||||
import { checkNullish, selectSingleFile, sleep } from "../util";
|
||||
import type { OpenAIChat } from "../process/index.svelte";
|
||||
import { globalFetch } from "../globalApi";
|
||||
import { selectedCharID } from "../stores";
|
||||
import { selectedCharID } from "../stores.svelte";
|
||||
import { addAdditionalCharaJS } from "./embedscript";
|
||||
|
||||
export const customProviderStore = writable([] as string[])
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { get } from "svelte/store";
|
||||
import { getCurrentCharacter, getCurrentChat, getDatabase, setCurrentChat, setDatabase } from "../storage/database.svelte";
|
||||
import { selectedCharID } from "../stores";
|
||||
import { selectedCharID } from "../stores.svelte";
|
||||
import { alertInput, alertMd, alertNormal, alertSelect, alertToast } from "../alert";
|
||||
import { sayTTS } from "./tts";
|
||||
import { risuChatParser } from "../parser.svelte";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getDatabase, setDatabase } from 'src/ts/storage/database.svelte';
|
||||
import { selectedCharID } from 'src/ts/stores';
|
||||
import { selectedCharID } from 'src/ts/stores.svelte';
|
||||
import { get } from 'svelte/store';
|
||||
import { doingChat, sendChat } from '../index.svelte';
|
||||
import { downloadFile, isTauri } from 'src/ts/globalApi';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { alertConfirm, alertError, alertSelectChar } from "../alert";
|
||||
import { language } from "src/lang";
|
||||
import { get } from "svelte/store";
|
||||
import { getDatabase, setDatabase } from "../storage/database.svelte";
|
||||
import { selectedCharID } from "../stores";
|
||||
import { selectedCharID } from "../stores.svelte";
|
||||
|
||||
export async function addGroupChar(){
|
||||
let db = getDatabase()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { get, writable } from "svelte/store";
|
||||
import { type character, type MessageGenerationInfo, type Chat, DBState } from "../storage/database.svelte";
|
||||
import { CharEmotion, selectedCharID } from "../stores";
|
||||
import { type character, type MessageGenerationInfo, type Chat } from "../storage/database.svelte";
|
||||
import { DBState } from '../stores.svelte';
|
||||
import { CharEmotion, selectedCharID } from "../stores.svelte";
|
||||
import { ChatTokenizer, tokenize, tokenizeNum } from "../tokenizer";
|
||||
import { language } from "../../lang";
|
||||
import { alertError } from "../alert";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { get } from "svelte/store";
|
||||
import {selectedCharID} from '../stores'
|
||||
import { DBState, type Message, type loreBook } from "../storage/database.svelte";
|
||||
import {selectedCharID} from '../stores.svelte'
|
||||
import { type Message, type loreBook } from "../storage/database.svelte";
|
||||
import { DBState } from '../stores.svelte';
|
||||
import { tokenize } from "../tokenizer";
|
||||
import { checkNullish, selectSingleFile } from "../util";
|
||||
import { alertError, alertNormal } from "../alert";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { getChatVar, hasher, setChatVar, type simpleCharacterArgument } from "..
|
||||
import { LuaEngine, LuaFactory } from "wasmoon";
|
||||
import { getCurrentCharacter, getCurrentChat, getDatabase, setCurrentChat, setDatabase, type Chat, type character, type groupChat } from "../storage/database.svelte";
|
||||
import { get } from "svelte/store";
|
||||
import { ReloadGUIPointer, selectedCharID } from "../stores";
|
||||
import { ReloadGUIPointer, selectedCharID } from "../stores.svelte";
|
||||
import { alertError, alertInput, alertNormal } from "../alert";
|
||||
import { HypaProcesser } from "./memory/hypamemory";
|
||||
import { generateAIImage } from "./stableDiff";
|
||||
|
||||
@@ -8,7 +8,7 @@ import { convertExternalLorebook } from "./lorebook.svelte"
|
||||
import { decodeRPack, encodeRPack } from "../rpack/rpack_bg"
|
||||
import { convertImage } from "../parser.svelte"
|
||||
import { Capacitor } from "@capacitor/core"
|
||||
import { HideIconStore, moduleBackgroundEmbedding } from "../stores"
|
||||
import { HideIconStore, moduleBackgroundEmbedding } from "../stores.svelte"
|
||||
|
||||
export interface RisuModule{
|
||||
name: string
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { get } from "svelte/store";
|
||||
import { CharEmotion, selectedCharID } from "../stores";
|
||||
import { CharEmotion, selectedCharID } from "../stores.svelte";
|
||||
import { type character, type customscript, type groupChat, type Database, getDatabase } from "../storage/database.svelte";
|
||||
import { downloadFile } from "../globalApi";
|
||||
import { alertError, alertNormal } from "../alert";
|
||||
|
||||
@@ -3,7 +3,7 @@ import { getDatabase, type character } from "../storage/database.svelte"
|
||||
import { requestChatData } from "./request"
|
||||
import { alertError } from "../alert"
|
||||
import { globalFetch, readImage } from "../globalApi"
|
||||
import { CharEmotion } from "../stores"
|
||||
import { CharEmotion } from "../stores.svelte"
|
||||
import type { OpenAIChat } from "./index.svelte"
|
||||
import { processZip } from "./processzip"
|
||||
import { keiServerURL } from "../kei/kei"
|
||||
|
||||
@@ -3,7 +3,7 @@ import { getCurrentCharacter, getCurrentChat, getDatabase, type Chat, type chara
|
||||
import { tokenize } from "../tokenizer";
|
||||
import { getModuleTriggers } from "./modules";
|
||||
import { get } from "svelte/store";
|
||||
import { ReloadGUIPointer, selectedCharID } from "../stores";
|
||||
import { ReloadGUIPointer, selectedCharID } from "../stores.svelte";
|
||||
import { processMultiCommand } from "./command";
|
||||
import { parseKeyValue } from "../util";
|
||||
import { alertError, alertInput, alertNormal, alertSelect } from "../alert";
|
||||
|
||||
@@ -12,9 +12,6 @@ import { defaultColorScheme, type ColorScheme } from '../gui/colorscheme';
|
||||
import type { PromptItem, PromptSettings } from '../process/prompt';
|
||||
import type { OobaChatCompletionRequestParams } from '../model/ooba';
|
||||
|
||||
export const DBState = $state({
|
||||
db: {} as any as Database
|
||||
})
|
||||
export let appVer = "137.1.0"
|
||||
export let webAppSubVer = '-svelte5-exp'
|
||||
|
||||
@@ -1508,7 +1505,7 @@ import type { OnnxModelFiles } from '../process/transformers';
|
||||
import type { RisuModule } from '../process/modules';
|
||||
import type { HypaV2Data } from '../process/memory/hypav2';
|
||||
import { decodeRPack, encodeRPack } from '../rpack/rpack_bg';
|
||||
import { selectedCharID } from '../stores';
|
||||
import { DBState, selectedCharID } from '../stores.svelte';
|
||||
|
||||
export async function downloadPreset(id:number, type:'json'|'risupreset'|'return' = 'json'){
|
||||
saveCurrentPreset()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { writable, type Writable } from "svelte/store";
|
||||
import type { character, groupChat } from "./storage/database.svelte";
|
||||
import type { character, Database, groupChat } from "./storage/database.svelte";
|
||||
import type { simpleCharacterArgument } from "./parser.svelte";
|
||||
import type { alertData } from "./alert";
|
||||
|
||||
@@ -84,4 +84,7 @@ export function createSimpleCharacter(char:character|groupChat){
|
||||
}
|
||||
|
||||
updateSize()
|
||||
window.addEventListener("resize", updateSize);
|
||||
window.addEventListener("resize", updateSize);
|
||||
export const DBState = $state({
|
||||
db: {} as any as Database
|
||||
});
|
||||
@@ -2,7 +2,7 @@ import { v4 } from 'uuid';
|
||||
import { alertError, alertInput, alertNormal, alertStore, alertWait } from '../alert';
|
||||
import { get, writable } from 'svelte/store';
|
||||
import { setDatabase, type character, saveImage, type Chat, getCurrentChat, setCurrentChat, getDatabase } from '../storage/database.svelte';
|
||||
import { selectedCharID } from '../stores';
|
||||
import { selectedCharID } from '../stores.svelte';
|
||||
import { findCharacterIndexbyId, sleep } from '../util';
|
||||
import type { DataConnection, Peer } from 'peerjs';
|
||||
import { readImage } from '../globalApi';
|
||||
|
||||
@@ -6,7 +6,7 @@ import { alertError } from "../alert"
|
||||
import { requestChatData } from "../process/request"
|
||||
import { doingChat, type OpenAIChat } from "../process/index.svelte"
|
||||
import { applyMarkdownToNode, parseChatML, type simpleCharacterArgument } from "../parser.svelte"
|
||||
import { selectedCharID } from "../stores"
|
||||
import { selectedCharID } from "../stores.svelte"
|
||||
import { getModuleRegexScripts } from "../process/modules"
|
||||
import { getNodetextToSentence, sleep } from "../util"
|
||||
import { processScriptFull } from "../process/scripts"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { get, writable, type Writable } from "svelte/store"
|
||||
import type { Database, Message } from "./storage/database.svelte"
|
||||
import { getDatabase } from "./storage/database.svelte"
|
||||
import { selectedCharID } from "./stores"
|
||||
import { selectedCharID } from "./stores.svelte"
|
||||
import {open} from '@tauri-apps/plugin-dialog'
|
||||
import { readFile } from "@tauri-apps/plugin-fs"
|
||||
import { basename } from "@tauri-apps/api/path"
|
||||
|
||||
Reference in New Issue
Block a user