Move DBState to stores

This commit is contained in:
kwaroran
2024-10-26 21:17:46 +09:00
parent 92f1ed0528
commit da907f4fc2
84 changed files with 183 additions and 156 deletions

View File

@@ -1,7 +1,8 @@
<script>
import { onMount, createEventDispatcher } from 'svelte';
import { EditIcon, LanguagesIcon } from "lucide-svelte";
import { DBState } from "../../ts/storage/database.svelte";
import { DBState } from 'src/ts/stores.svelte';
import CodeMirror from 'codemirror';
import 'codemirror/lib/codemirror.css';

View File

@@ -1,7 +1,8 @@
<script lang="ts">
import { ParseMarkdown, risuChatParser } from "src/ts/parser.svelte";
import { DBState, type character, type groupChat } from "src/ts/storage/database.svelte";
import { moduleBackgroundEmbedding, ReloadGUIPointer, selectedCharID } from "src/ts/stores";
import { type character, type groupChat } from "src/ts/storage/database.svelte";
import { DBState } from 'src/ts/stores.svelte';
import { moduleBackgroundEmbedding, ReloadGUIPointer, selectedCharID } from "src/ts/stores.svelte";
let backgroundHTML = $derived(DBState.db?.characters?.[$selectedCharID]?.backgroundHTML)
let currentChar:character|groupChat = $state()

View File

@@ -4,8 +4,9 @@
import AutoresizeArea from "../UI/GUI/TextAreaResizable.svelte";
import { alertConfirm, alertError, alertRequestData } from "../../ts/alert";
import { language } from "../../lang";
import { DBState, type MessageGenerationInfo } from "../../ts/storage/database.svelte";
import { HideIconStore, ReloadGUIPointer, selectedCharID } from "../../ts/stores";
import { type MessageGenerationInfo } from "../../ts/storage/database.svelte";
import { DBState } from 'src/ts/stores.svelte';
import { HideIconStore, ReloadGUIPointer, selectedCharID } from "../../ts/stores.svelte";
import { translateHTML } from "../../ts/translator/translator";
import { risuChatParser } from "src/ts/process/scripts";
import { get, type Unsubscriber } from "svelte/store";

View File

@@ -1,7 +1,8 @@
<script lang="ts">
import { getCustomBackground, getEmotion } from "../../ts/util";
import { DBState } from "../../ts/storage/database.svelte";
import { CharEmotion, ShowVN, selectedCharID } from "../../ts/stores";
import { DBState } from 'src/ts/stores.svelte';
import { CharEmotion, ShowVN, selectedCharID } from "../../ts/stores.svelte";
import ResizeBox from './ResizeBox.svelte'
import DefaultChatScreen from "./DefaultChatScreen.svelte";
import defaultWallpaper from '../../etc/bg.jpg'

View File

@@ -3,9 +3,10 @@
import Suggestion from './Suggestion.svelte';
import AdvancedChatEditor from './AdvancedChatEditor.svelte';
import { CameraIcon, DatabaseIcon, DicesIcon, GlobeIcon, ImagePlusIcon, LanguagesIcon, Laugh, MenuIcon, MicOffIcon, PackageIcon, Plus, RefreshCcwIcon, ReplyIcon, Send, StepForwardIcon } from "lucide-svelte";
import { selectedCharID, PlaygroundStore, UserIconProtrait, createSimpleCharacter } from "../../ts/stores";
import { selectedCharID, PlaygroundStore, UserIconProtrait, createSimpleCharacter } from "../../ts/stores.svelte";
import Chat from "./Chat.svelte";
import { DBState, type Message, type character, type groupChat } from "../../ts/storage/database.svelte";
import { type Message, type character, type groupChat } from "../../ts/storage/database.svelte";
import { DBState } from 'src/ts/stores.svelte';
import { getCharImage } from "../../ts/characters";
import { chatProcessStage, doingChat, sendChat } from "../../ts/process/index.svelte";
import { findCharacterbyId, messageForm, sleep } from "../../ts/util";

View File

@@ -1,6 +1,7 @@
<script>
import { DBState } from '../../ts/storage/database.svelte';
import { CharEmotion } from '../../ts/stores';
import { DBState } from 'src/ts/stores.svelte';
import { CharEmotion } from '../../ts/stores.svelte';
import { getEmotion } from '../../ts/util';
</script>

View File

@@ -1,10 +1,11 @@
<script>
import { CharEmotion, ViewBoxsize } from '../../ts/stores';
import { CharEmotion, ViewBoxsize } from '../../ts/stores.svelte';
import { onMount } from 'svelte';
import EmotionBox from './EmotionBox.svelte';
import TransitionImage from './TransitionImage.svelte';
import { getEmotion } from '../../ts/util';
import { DBState } from '../../ts/storage/database.svelte';
import { DBState } from 'src/ts/stores.svelte';
let box = $state();
let isResizing = false;

View File

@@ -1,8 +1,9 @@
<script lang="ts">
import { requestChatData } from "src/ts/process/request";
import { doingChat, type OpenAIChat } from "../../ts/process/index.svelte";
import { DBState, setDatabase, type character, type Message, type groupChat, type Database } from "../../ts/storage/database.svelte";
import { selectedCharID } from "../../ts/stores";
import { setDatabase, type character, type Message, type groupChat, type Database } from "../../ts/storage/database.svelte";
import { DBState } from 'src/ts/stores.svelte';
import { selectedCharID } from "../../ts/stores.svelte";
import { translate } from "src/ts/translator/translator";
import { CopyIcon, LanguagesIcon, RefreshCcwIcon } from "lucide-svelte";
import { alertConfirm } from "src/ts/alert";