Merge branch 'main' into main
This commit is contained in:
@@ -15,7 +15,7 @@ export function getPatchNote(version: string){
|
|||||||
if(patchNote.version.split(".")[1] === version.split(".")[1] && patchNote.version.split(".")[0] === version.split(".")[0]){
|
if(patchNote.version.split(".")[1] === version.split(".")[1] && patchNote.version.split(".")[0] === version.split(".")[0]){
|
||||||
return patchNote
|
return patchNote
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
version: version.split(".")[0] + "." + version.split(".")[1],
|
version: version.split(".")[0] + "." + version.split(".")[1],
|
||||||
content: ""
|
content: ""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -516,4 +516,17 @@ export const languageEnglish = {
|
|||||||
licenseDesc: "You can choose license for the downloaders to limit the usages of your card's prompt.",
|
licenseDesc: "You can choose license for the downloaders to limit the usages of your card's prompt.",
|
||||||
passwordDesc: "You can set a password to protect your card from unauthorized access.",
|
passwordDesc: "You can set a password to protect your card from unauthorized access.",
|
||||||
largePersonaPortrait: "Persona Portrait",
|
largePersonaPortrait: "Persona Portrait",
|
||||||
|
module: "Module",
|
||||||
|
modules: "Modules",
|
||||||
|
noModules: "No modules has been installed.",
|
||||||
|
createModule: "Create Module",
|
||||||
|
basicInfo: "Basic Info",
|
||||||
|
moduleContent: "Module Content",
|
||||||
|
confirmRemoveModuleFeature: "Do you really want to remove this feature? This action cannot be undone.",
|
||||||
|
editModule: "Edit Module",
|
||||||
|
importModule: "Import Module",
|
||||||
|
download: "Download",
|
||||||
|
edit: "Edit",
|
||||||
|
enableGlobal: "Enable Globally",
|
||||||
|
chatModulesInfo: "You can enable or disable modules for this chat.",
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,9 @@
|
|||||||
import BackgroundDom from "./BackgroundDom.svelte";
|
import BackgroundDom from "./BackgroundDom.svelte";
|
||||||
import SideBarArrow from "../UI/GUI/SideBarArrow.svelte";
|
import SideBarArrow from "../UI/GUI/SideBarArrow.svelte";
|
||||||
import VisualNovelMain from "../VisualNovel/VisualNovelMain.svelte";
|
import VisualNovelMain from "../VisualNovel/VisualNovelMain.svelte";
|
||||||
|
import ModuleChatMenu from "../Setting/Pages/Module/ModuleChatMenu.svelte";
|
||||||
let openChatList = false
|
let openChatList = false
|
||||||
|
let openModuleList = false
|
||||||
|
|
||||||
const wallPaper = `background: url(${defaultWallpaper})`
|
const wallPaper = `background: url(${defaultWallpaper})`
|
||||||
const externalStyles =
|
const externalStyles =
|
||||||
@@ -40,7 +42,7 @@
|
|||||||
<ResizeBox />
|
<ResizeBox />
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
<DefaultChatScreen customStyle={bgImg.length > 2 ? `${externalStyles}`: ''} bind:openChatList/>
|
<DefaultChatScreen customStyle={bgImg.length > 2 ? `${externalStyles}`: ''} bind:openChatList bind:openModuleList/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{:else if $DataBase.theme === 'waifu'}
|
{:else if $DataBase.theme === 'waifu'}
|
||||||
@@ -55,7 +57,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
<div class="h-full w-2xl" style:width="{42 * ($DataBase.waifuWidth / 100)}rem" class:halfwp={$selectedCharID >= 0 && $CurrentCharacter.viewScreen !== 'none'}>
|
<div class="h-full w-2xl" style:width="{42 * ($DataBase.waifuWidth / 100)}rem" class:halfwp={$selectedCharID >= 0 && $CurrentCharacter.viewScreen !== 'none'}>
|
||||||
<DefaultChatScreen customStyle={`${externalStyles}backdrop-filter: blur(4px);`} bind:openChatList/>
|
<DefaultChatScreen customStyle={`${externalStyles}backdrop-filter: blur(4px);`} bind:openChatList bind:openModuleList/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{:else if $DataBase.theme === 'waifuMobile'}
|
{:else if $DataBase.theme === 'waifuMobile'}
|
||||||
@@ -66,7 +68,7 @@
|
|||||||
class:per33={$selectedCharID >= 0 && $CurrentCharacter.viewScreen !== 'none'}
|
class:per33={$selectedCharID >= 0 && $CurrentCharacter.viewScreen !== 'none'}
|
||||||
class:h-full={!($selectedCharID >= 0 && $CurrentCharacter.viewScreen !== 'none')}
|
class:h-full={!($selectedCharID >= 0 && $CurrentCharacter.viewScreen !== 'none')}
|
||||||
>
|
>
|
||||||
<DefaultChatScreen customStyle={`${externalStyles}backdrop-filter: blur(4px);`} bind:openChatList/>
|
<DefaultChatScreen customStyle={`${externalStyles}backdrop-filter: blur(4px);`} bind:openChatList bind:openModuleList/>
|
||||||
</div>
|
</div>
|
||||||
{#if $selectedCharID >= 0}
|
{#if $selectedCharID >= 0}
|
||||||
{#if $CurrentCharacter.viewScreen !== 'none'}
|
{#if $CurrentCharacter.viewScreen !== 'none'}
|
||||||
@@ -79,6 +81,8 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{#if openChatList}
|
{#if openChatList}
|
||||||
<ChatList close={() => {openChatList = false}}/>
|
<ChatList close={() => {openChatList = false}}/>
|
||||||
|
{:else if openModuleList}
|
||||||
|
<ModuleChatMenu close={() => {openModuleList = false}}/>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Suggestion from './Suggestion.svelte';
|
import Suggestion from './Suggestion.svelte';
|
||||||
import { CameraIcon, DatabaseIcon, DicesIcon, GlobeIcon, ImagePlusIcon, LanguagesIcon, Laugh, MenuIcon, MicOffIcon, RefreshCcwIcon, ReplyIcon, Send, StepForwardIcon } from "lucide-svelte";
|
import { CameraIcon, DatabaseIcon, DicesIcon, GlobeIcon, ImagePlusIcon, LanguagesIcon, Laugh, MenuIcon, MicOffIcon, PackageIcon, RefreshCcwIcon, ReplyIcon, Send, StepForwardIcon } from "lucide-svelte";
|
||||||
import { CurrentCharacter, CurrentChat, CurrentUsername, selectedCharID, CurrentUserIcon, CurrentShowMemoryLimit,CurrentSimpleCharacter } from "../../ts/stores";
|
import { CurrentCharacter, CurrentChat, CurrentUsername, selectedCharID, CurrentUserIcon, CurrentShowMemoryLimit,CurrentSimpleCharacter } from "../../ts/stores";
|
||||||
import Chat from "./Chat.svelte";
|
import Chat from "./Chat.svelte";
|
||||||
import { DataBase, type Message, type character, type groupChat } from "../../ts/storage/database";
|
import { DataBase, type Message, type character, type groupChat } from "../../ts/storage/database";
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
let doingChatInputTranslate = false
|
let doingChatInputTranslate = false
|
||||||
let currentCharacter:character|groupChat = $CurrentCharacter
|
let currentCharacter:character|groupChat = $CurrentCharacter
|
||||||
let toggleStickers:boolean = false
|
let toggleStickers:boolean = false
|
||||||
|
export let openModuleList = false
|
||||||
export let openChatList:boolean = false
|
export let openChatList:boolean = false
|
||||||
|
|
||||||
async function send(){
|
async function send(){
|
||||||
@@ -582,7 +583,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if openMenu}
|
{#if openMenu}
|
||||||
<div class="absolute right-2 bottom-16 p-5 bg-darkbg flex flex-col gap-3 text-textcolor" on:click={(e) => {
|
<div class="absolute right-2 bottom-16 p-5 bg-darkbg flex flex-col gap-3 text-textcolor rounded-md" on:click={(e) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
}}>
|
}}>
|
||||||
{#if $CurrentCharacter.type === 'group'}
|
{#if $CurrentCharacter.type === 'group'}
|
||||||
@@ -664,9 +665,15 @@
|
|||||||
<ReplyIcon />
|
<ReplyIcon />
|
||||||
<span class="ml-2">{language.autoSuggest}</span>
|
<span class="ml-2">{language.autoSuggest}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center cursor-pointer hover:text-green-500 transition-colors" on:click={reroll}>
|
|
||||||
<RefreshCcwIcon />
|
|
||||||
<span class="ml-2">{language.reroll}</span>
|
<div class="flex items-center cursor-pointer hover:text-green-500 transition-colors" on:click={() => {
|
||||||
|
$CurrentChat.modules ??= []
|
||||||
|
openModuleList = true
|
||||||
|
openMenu = false
|
||||||
|
}}>
|
||||||
|
<PackageIcon />
|
||||||
|
<span class="ml-2">{language.modules}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
80
src/lib/Setting/Pages/Module/ModuleChatMenu.svelte
Normal file
80
src/lib/Setting/Pages/Module/ModuleChatMenu.svelte
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { CheckCircle2Icon, Globe, XIcon } from "lucide-svelte";
|
||||||
|
import { language } from "src/lang";
|
||||||
|
import Button from "src/lib/UI/GUI/Button.svelte";
|
||||||
|
import { DataBase } from "src/ts/storage/database";
|
||||||
|
import { CurrentChat } from "src/ts/stores";
|
||||||
|
import { SettingsMenuIndex, settingsOpen } from "src/ts/stores";
|
||||||
|
export let close = () => {}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="absolute w-full h-full z-40 bg-black bg-opacity-50 flex justify-center items-center">
|
||||||
|
<div class="bg-darkbg p-4 break-any rounded-md flex flex-col max-w-3xl w-full max-h-full overflow-y-auto">
|
||||||
|
<div class="flex items-center text-textcolor">
|
||||||
|
<h2 class="mt-0 mb-0 text-lg">{language.modules}</h2>
|
||||||
|
<div class="flex-grow flex justify-end">
|
||||||
|
<button class="text-textcolor2 hover:text-green-500 mr-2 cursor-pointer items-center" on:click={close}>
|
||||||
|
<XIcon size={24}/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span class="text-sm text-textcolor2">{language.chatModulesInfo}</span>
|
||||||
|
|
||||||
|
<div class="contain w-full max-w-full mt-4 flex flex-col border-selected border-1 rounded-md">
|
||||||
|
{#if $DataBase.modules.length === 0}
|
||||||
|
<div class="text-textcolor2 p-3">{language.noModules}</div>
|
||||||
|
{:else}
|
||||||
|
{#each $DataBase.modules as rmodule, i}
|
||||||
|
{#if i !== 0}
|
||||||
|
<div class="border-t-1 border-selected"></div>
|
||||||
|
{/if}
|
||||||
|
<div class="pl-3 pt-3 text-left flex">
|
||||||
|
<span class="text-lg">{rmodule.name}</span>
|
||||||
|
<div class="flex-grow flex justify-end">
|
||||||
|
{#if $DataBase.enabledModules.includes(rmodule.id)}
|
||||||
|
<button class="mr-2 cursor-pointer text-blue-500">
|
||||||
|
<Globe size={18}/>
|
||||||
|
</button>
|
||||||
|
{:else}
|
||||||
|
<button class={(!$CurrentChat.modules.includes(rmodule.id)) ?
|
||||||
|
"text-textcolor2 hover:text-green-500 mr-2 cursor-pointer" :
|
||||||
|
"mr-2 cursor-pointer text-blue-500"
|
||||||
|
} on:click={async (e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
if($CurrentChat.modules.includes(rmodule.id)){
|
||||||
|
$CurrentChat.modules.splice($CurrentChat.modules.indexOf(rmodule.id), 1)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$CurrentChat.modules.push(rmodule.id)
|
||||||
|
}
|
||||||
|
$CurrentChat.modules = $CurrentChat.modules
|
||||||
|
}}>
|
||||||
|
<CheckCircle2Icon size={18}/>
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1 mb-3 pl-3">
|
||||||
|
<span class="text-sm text-textcolor2">{rmodule.description || 'No description provided'}</span>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Button className="mt-4 flex-grow-0" size="sm" on:click={() => {
|
||||||
|
$SettingsMenuIndex = 14
|
||||||
|
$settingsOpen = true
|
||||||
|
close()
|
||||||
|
}}>{language.edit}</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.break-any{
|
||||||
|
word-break: normal;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
153
src/lib/Setting/Pages/Module/ModuleMenu.svelte
Normal file
153
src/lib/Setting/Pages/Module/ModuleMenu.svelte
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<script type="ts" lang="ts">
|
||||||
|
import { language } from "src/lang";
|
||||||
|
import TextAreaInput from "src/lib/UI/GUI/TextAreaInput.svelte";
|
||||||
|
import TextInput from "src/lib/UI/GUI/TextInput.svelte";
|
||||||
|
import LoreBookData from "src/lib/SideBars/LoreBook/LoreBookData.svelte";
|
||||||
|
import type { RisuModule } from "src/ts/process/modules";
|
||||||
|
import { PlusIcon } from "lucide-svelte";
|
||||||
|
import { alertConfirm } from "src/ts/alert";
|
||||||
|
import RegexList from "src/lib/SideBars/Scripts/RegexList.svelte";
|
||||||
|
import TriggerList from "src/lib/SideBars/Scripts/TriggerList.svelte";
|
||||||
|
|
||||||
|
|
||||||
|
export let currentModule:RisuModule
|
||||||
|
|
||||||
|
|
||||||
|
async function toggleLorebook(){
|
||||||
|
if(!Array.isArray(currentModule.lorebook)){
|
||||||
|
currentModule.lorebook = []
|
||||||
|
}
|
||||||
|
else if(currentModule.lorebook.length > 0){
|
||||||
|
const conf = await alertConfirm(language.confirmRemoveModuleFeature)
|
||||||
|
if(conf){
|
||||||
|
currentModule.lorebook = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
currentModule.lorebook = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toggleRegex(){
|
||||||
|
if(!Array.isArray(currentModule.regex)){
|
||||||
|
currentModule.regex = []
|
||||||
|
}
|
||||||
|
else if(currentModule.regex.length > 0){
|
||||||
|
const conf = await alertConfirm(language.confirmRemoveModuleFeature)
|
||||||
|
if(conf){
|
||||||
|
currentModule.regex = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
currentModule.regex = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toggleTrigger(){
|
||||||
|
if(!Array.isArray(currentModule.trigger)){
|
||||||
|
currentModule.trigger = []
|
||||||
|
}
|
||||||
|
else if(currentModule.trigger.length > 0){
|
||||||
|
const conf = await alertConfirm(language.confirmRemoveModuleFeature)
|
||||||
|
if(conf){
|
||||||
|
currentModule.trigger = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
currentModule.trigger = undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addLorebook(){
|
||||||
|
if(Array.isArray(currentModule.lorebook)){
|
||||||
|
currentModule.lorebook.push({
|
||||||
|
key: '',
|
||||||
|
comment: `New Lore`,
|
||||||
|
content: '',
|
||||||
|
mode: 'normal',
|
||||||
|
insertorder: 100,
|
||||||
|
alwaysActive: false,
|
||||||
|
secondkey: "",
|
||||||
|
selective: false
|
||||||
|
})
|
||||||
|
|
||||||
|
currentModule.lorebook = currentModule.lorebook
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addRegex(){
|
||||||
|
if(Array.isArray(currentModule.regex)){
|
||||||
|
currentModule.regex.push({
|
||||||
|
comment: "",
|
||||||
|
in: "",
|
||||||
|
out: "",
|
||||||
|
type: "editinput"
|
||||||
|
})
|
||||||
|
|
||||||
|
currentModule.regex = currentModule.regex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addTrigger(){
|
||||||
|
if(Array.isArray(currentModule.trigger)){
|
||||||
|
currentModule.trigger.push({
|
||||||
|
conditions: [],
|
||||||
|
type: 'start',
|
||||||
|
comment: '',
|
||||||
|
effect: []
|
||||||
|
})
|
||||||
|
|
||||||
|
currentModule.trigger = currentModule.trigger
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<span class="mt-4 text-xl">{language.basicInfo}</span>
|
||||||
|
<TextInput bind:value={currentModule.name} additionalClass="mt-1" placeholder={language.name}/>
|
||||||
|
<TextInput bind:value={currentModule.description} additionalClass="mt-1" placeholder={language.description} size="sm"/>
|
||||||
|
<span class="mt-6 text-xl">{language.moduleContent}</span>
|
||||||
|
<div class="grid grid-cols-2 border-selected border rounded-md">
|
||||||
|
<button class={(!Array.isArray(currentModule.lorebook)) ? 'p-4' : "p-4 bg-selected rounded-tl-md"} on:click={toggleLorebook}>
|
||||||
|
{language.loreBook}
|
||||||
|
</button>
|
||||||
|
<button class={(!Array.isArray(currentModule.regex)) ? 'p-4' : "p-4 bg-selected rounded-tr-md"} on:click={toggleRegex}>
|
||||||
|
{language.regexScript}
|
||||||
|
</button>
|
||||||
|
<button class={(!Array.isArray(currentModule.trigger)) ? 'p-4' : "p-4 bg-selected rounded-tr-md"} on:click={toggleTrigger}>
|
||||||
|
{language.triggerScript}
|
||||||
|
</button>
|
||||||
|
<button class="p-4">
|
||||||
|
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if (Array.isArray(currentModule.lorebook))}
|
||||||
|
<span class="mt-8 text-xl">{language.loreBook}</span>
|
||||||
|
<div class="border border-selected p-2 flex flex-col rounded-md mt-2">
|
||||||
|
{#each currentModule.lorebook as lore, i}
|
||||||
|
<LoreBookData bind:value={currentModule.lorebook[i]} idx={i} onRemove={() => {
|
||||||
|
currentModule.lorebook.splice(i, 1)
|
||||||
|
currentModule.lorebook = currentModule.lorebook
|
||||||
|
}}/>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
<button on:click={() => {addLorebook()}} class="hover:text-textcolor cursor-pointer">
|
||||||
|
<PlusIcon />
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if (Array.isArray(currentModule.regex))}
|
||||||
|
<span class="mt-8 text-xl">{language.regexScript}</span>
|
||||||
|
<RegexList bind:value={currentModule.regex}/>
|
||||||
|
<button on:click={() => {addRegex()}} class="hover:text-textcolor cursor-pointer">
|
||||||
|
<PlusIcon />
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
{#if (Array.isArray(currentModule.trigger))}
|
||||||
|
<span class="mt-8 text-xl">{language.triggerScript}</span>
|
||||||
|
<TriggerList bind:value={currentModule.trigger}/>
|
||||||
|
<button on:click={() => {addTrigger()}} class="hover:text-textcolor cursor-pointer">
|
||||||
|
<PlusIcon />
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
109
src/lib/Setting/Pages/Module/ModuleSettings.svelte
Normal file
109
src/lib/Setting/Pages/Module/ModuleSettings.svelte
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { language } from "src/lang";
|
||||||
|
import { DataBase } from "src/ts/storage/database";
|
||||||
|
import Button from "src/lib/UI/GUI/Button.svelte";
|
||||||
|
import ModuleMenu from "src/lib/Setting/Pages/Module/ModuleMenu.svelte";
|
||||||
|
import { exportModule, type RisuModule } from "src/ts/process/modules";
|
||||||
|
import { DownloadIcon, Edit, TrashIcon, Globe } from "lucide-svelte";
|
||||||
|
import { v4 } from "uuid";
|
||||||
|
import { tooltip } from "src/ts/gui/tooltip";
|
||||||
|
import { alertConfirm } from "src/ts/alert";
|
||||||
|
let tempModule:RisuModule = {
|
||||||
|
name: '',
|
||||||
|
description: '',
|
||||||
|
id: v4(),
|
||||||
|
}
|
||||||
|
let mode = 0
|
||||||
|
let editModuleIndex = -1
|
||||||
|
</script>
|
||||||
|
{#if mode === 0}
|
||||||
|
<h2 class="mb-2 text-2xl font-bold mt-2">{language.modules}</h2>
|
||||||
|
|
||||||
|
<div class="contain w-full max-w-full mt-4 flex flex-col border-selected border-1 rounded-md">
|
||||||
|
{#if $DataBase.modules.length === 0}
|
||||||
|
<div class="text-textcolor2 p-3">{language.noModules}</div>
|
||||||
|
{:else}
|
||||||
|
{#each $DataBase.modules as rmodule, i}
|
||||||
|
{#if i !== 0}
|
||||||
|
<div class="border-t-1 border-selected"></div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="pl-3 pt-3 text-left flex">
|
||||||
|
<span class="text-lg">{rmodule.name}</span>
|
||||||
|
<div class="flex-grow flex justify-end">
|
||||||
|
<button class={(!$DataBase.enabledModules.includes(rmodule.id)) ?
|
||||||
|
"text-textcolor2 hover:text-green-500 mr-2 cursor-pointer" :
|
||||||
|
"mr-2 cursor-pointer text-blue-500"
|
||||||
|
} use:tooltip={language.enableGlobal} on:click={async (e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
if($DataBase.enabledModules.includes(rmodule.id)){
|
||||||
|
$DataBase.enabledModules.splice($DataBase.enabledModules.indexOf(rmodule.id), 1)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$DataBase.enabledModules.push(rmodule.id)
|
||||||
|
}
|
||||||
|
$DataBase.enabledModules = $DataBase.enabledModules
|
||||||
|
}}>
|
||||||
|
<Globe size={18}/>
|
||||||
|
</button>
|
||||||
|
<button class="text-textcolor2 hover:text-green-500 mr-2 cursor-pointer" use:tooltip={language.download} on:click={async (e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
exportModule(rmodule)
|
||||||
|
}}>
|
||||||
|
<DownloadIcon size={18}/>
|
||||||
|
</button>
|
||||||
|
<button class="text-textcolor2 hover:text-green-500 mr-2 cursor-pointer" use:tooltip={language.edit} on:click={async (e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
|
||||||
|
tempModule = rmodule
|
||||||
|
editModuleIndex = i
|
||||||
|
mode = 2
|
||||||
|
}}>
|
||||||
|
<Edit size={18}/>
|
||||||
|
</button>
|
||||||
|
<button class="text-textcolor2 hover:text-green-500 mr-2 cursor-pointer" use:tooltip={language.remove} on:click={async (e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
const d = await alertConfirm(`${language.removeConfirm}` + rmodule.name)
|
||||||
|
if(d){
|
||||||
|
$DataBase.modules.splice(i, 1)
|
||||||
|
$DataBase.modules = $DataBase.modules
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
<TrashIcon size={18}/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt-1 mb-3 pl-3">
|
||||||
|
<span class="text-sm text-textcolor2">{rmodule.description || 'No description provided'}</span>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<Button className="mt-2" on:click={() => {
|
||||||
|
tempModule = {
|
||||||
|
name: '',
|
||||||
|
description: '',
|
||||||
|
id: v4(),
|
||||||
|
}
|
||||||
|
mode = 1
|
||||||
|
}}>{language.createModule}</Button>
|
||||||
|
<Button className="mt-2">{language.importModule}</Button>
|
||||||
|
{:else if mode === 1}
|
||||||
|
<h2 class="mb-2 text-2xl font-bold mt-2">{language.createModule}</h2>
|
||||||
|
<ModuleMenu bind:currentModule={tempModule}/>
|
||||||
|
{#if tempModule.name !== ''}
|
||||||
|
<Button className="mt-6" on:click={() => {
|
||||||
|
$DataBase.modules.push(tempModule)
|
||||||
|
mode = 0
|
||||||
|
}}>{language.editModule}</Button>
|
||||||
|
{/if}
|
||||||
|
{:else if mode === 2}
|
||||||
|
<h2 class="mb-2 text-2xl font-bold mt-2">{language.editModule}</h2>
|
||||||
|
<ModuleMenu bind:currentModule={tempModule}/>
|
||||||
|
{#if tempModule.name !== ''}
|
||||||
|
<Button className="mt-6" on:click={() => {
|
||||||
|
$DataBase.modules[editModuleIndex] = tempModule
|
||||||
|
mode = 0
|
||||||
|
}}>{language.createModule}</Button>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { AccessibilityIcon, ActivityIcon, AlignLeft, BookIcon, BotIcon, BoxIcon, CodeIcon, ContactIcon, DiamondIcon, FolderIcon, LanguagesIcon, MonitorIcon, Sailboat, ScrollTextIcon, UserIcon, XCircleIcon } from "lucide-svelte";
|
import { AccessibilityIcon, ActivityIcon, AlignLeft, BookIcon, PackageIcon, BotIcon, BoxIcon, CodeIcon, ContactIcon, DiamondIcon, FolderIcon, LanguagesIcon, MonitorIcon, Sailboat, ScrollTextIcon, UserIcon, XCircleIcon } from "lucide-svelte";
|
||||||
import { language } from "src/lang";
|
import { language } from "src/lang";
|
||||||
import DisplaySettings from "./Pages/DisplaySettings.svelte";
|
import DisplaySettings from "./Pages/DisplaySettings.svelte";
|
||||||
import UserSettings from "./Pages/UserSettings.svelte";
|
import UserSettings from "./Pages/UserSettings.svelte";
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
import PluginSettings from "./Pages/PluginSettings.svelte";
|
import PluginSettings from "./Pages/PluginSettings.svelte";
|
||||||
import FilesSettings from "./Pages/FilesSettings.svelte";
|
import FilesSettings from "./Pages/FilesSettings.svelte";
|
||||||
import AdvancedSettings from "./Pages/AdvancedSettings.svelte";
|
import AdvancedSettings from "./Pages/AdvancedSettings.svelte";
|
||||||
import { settingsOpen } from "src/ts/stores";
|
import { SettingsMenuIndex, settingsOpen } from "src/ts/stores";
|
||||||
import Botpreset from "./botpreset.svelte";
|
import Botpreset from "./botpreset.svelte";
|
||||||
import Communities from "./Pages/Communities.svelte";
|
import Communities from "./Pages/Communities.svelte";
|
||||||
import GlobalLoreBookSettings from "./Pages/GlobalLoreBookSettings.svelte";
|
import GlobalLoreBookSettings from "./Pages/GlobalLoreBookSettings.svelte";
|
||||||
@@ -18,126 +18,135 @@
|
|||||||
import AccessibilitySettings from "./Pages/AccessibilitySettings.svelte";
|
import AccessibilitySettings from "./Pages/AccessibilitySettings.svelte";
|
||||||
import PersonaSettings from "./Pages/PersonaSettings.svelte";
|
import PersonaSettings from "./Pages/PersonaSettings.svelte";
|
||||||
import PromptSettings from "./Pages/PromptSettings.svelte";
|
import PromptSettings from "./Pages/PromptSettings.svelte";
|
||||||
import { DataBase } from "src/ts/storage/database";
|
|
||||||
import ThanksPage from "./Pages/ThanksPage.svelte";
|
import ThanksPage from "./Pages/ThanksPage.svelte";
|
||||||
let selected = -1
|
import ModuleSettings from "./Pages/Module/ModuleSettings.svelte";
|
||||||
|
|
||||||
let openPresetList = false
|
let openPresetList = false
|
||||||
let openLoreList = false
|
let openLoreList = false
|
||||||
if(window.innerWidth >= 700){
|
if(window.innerWidth >= 900 && $SettingsMenuIndex === -1){
|
||||||
selected = 1
|
$SettingsMenuIndex = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<div class="h-full w-full flex justify-center setting-bg">
|
<div class="h-full w-full flex justify-center setting-bg">
|
||||||
<div class="h-full max-w-screen-lg w-full flex relative">
|
<div class="h-full max-w-screen-lg w-full flex relative">
|
||||||
{#if window.innerWidth >= 700 || selected === -1}
|
{#if window.innerWidth >= 700 || $SettingsMenuIndex === -1}
|
||||||
<div class="flex h-full flex-col p-4 pt-8 bg-darkbg gap-2 overflow-y-auto relative"
|
<div class="flex h-full flex-col p-4 pt-8 bg-darkbg gap-2 overflow-y-auto relative"
|
||||||
class:w-full={window.innerWidth < 700}>
|
class:w-full={window.innerWidth < 700}>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 1 || selected === 13}
|
class:text-textcolor={$SettingsMenuIndex === 1 || $SettingsMenuIndex === 13}
|
||||||
class:text-textcolor2={selected !== 1 && selected !== 13}
|
class:text-textcolor2={$SettingsMenuIndex !== 1 && $SettingsMenuIndex !== 13}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 1
|
$SettingsMenuIndex = 1
|
||||||
|
|
||||||
}}>
|
}}>
|
||||||
<BotIcon />
|
<BotIcon />
|
||||||
<span>{language.chatBot}</span>
|
<span>{language.chatBot}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 12}
|
class:text-textcolor={$SettingsMenuIndex === 12}
|
||||||
class:text-textcolor2={selected !== 12}
|
class:text-textcolor2={$SettingsMenuIndex !== 12}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 12
|
$SettingsMenuIndex = 12
|
||||||
}}>
|
}}>
|
||||||
<ContactIcon />
|
<ContactIcon />
|
||||||
<span>{language.persona}</span>
|
<span>{language.persona}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 2}
|
class:text-textcolor={$SettingsMenuIndex === 2}
|
||||||
class:text-textcolor2={selected !== 2}
|
class:text-textcolor2={$SettingsMenuIndex !== 2}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 2
|
$SettingsMenuIndex = 2
|
||||||
}}>
|
}}>
|
||||||
<Sailboat />
|
<Sailboat />
|
||||||
<span>{language.otherBots}</span>
|
<span>{language.otherBots}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 3}
|
class:text-textcolor={$SettingsMenuIndex === 3}
|
||||||
class:text-textcolor2={selected !== 3}
|
class:text-textcolor2={$SettingsMenuIndex !== 3}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 3
|
$SettingsMenuIndex = 3
|
||||||
}}>
|
}}>
|
||||||
<MonitorIcon />
|
<MonitorIcon />
|
||||||
<span>{language.display}</span>
|
<span>{language.display}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 10}
|
class:text-textcolor={$SettingsMenuIndex === 10}
|
||||||
class:text-textcolor2={selected !== 10}
|
class:text-textcolor2={$SettingsMenuIndex !== 10}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 10
|
$SettingsMenuIndex = 10
|
||||||
}}>
|
}}>
|
||||||
<LanguagesIcon />
|
<LanguagesIcon />
|
||||||
<span>{language.language}</span>
|
<span>{language.language}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 11}
|
class:text-textcolor={$SettingsMenuIndex === 11}
|
||||||
class:text-textcolor2={selected !== 11}
|
class:text-textcolor2={$SettingsMenuIndex !== 11}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 11
|
$SettingsMenuIndex = 11
|
||||||
}}>
|
}}>
|
||||||
<AccessibilityIcon />
|
<AccessibilityIcon />
|
||||||
<span>{language.accessibility}</span>
|
<span>{language.accessibility}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 8}
|
class:text-textcolor={$SettingsMenuIndex === 8}
|
||||||
class:text-textcolor2={selected !== 8}
|
class:text-textcolor2={$SettingsMenuIndex !== 8}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 8
|
$SettingsMenuIndex = 8
|
||||||
}}>
|
}}>
|
||||||
<BookIcon />
|
<BookIcon />
|
||||||
<span>{language.globalLoreBook}</span>
|
<span>{language.globalLoreBook}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 9}
|
class:text-textcolor={$SettingsMenuIndex === 9}
|
||||||
class:text-textcolor2={selected !== 9}
|
class:text-textcolor2={$SettingsMenuIndex !== 9}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 9
|
$SettingsMenuIndex = 9
|
||||||
}}>
|
}}>
|
||||||
<AlignLeft />
|
<AlignLeft />
|
||||||
<span>{language.globalRegexScript}</span>
|
<span>{language.globalRegexScript}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 4}
|
class:text-textcolor={$SettingsMenuIndex === 14}
|
||||||
class:text-textcolor2={selected !== 4}
|
class:text-textcolor2={$SettingsMenuIndex !== 14}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 4
|
$SettingsMenuIndex = 14
|
||||||
|
}}>
|
||||||
|
<PackageIcon />
|
||||||
|
<span>{language.modules}</span>
|
||||||
|
</button>
|
||||||
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
|
class:text-textcolor={$SettingsMenuIndex === 4}
|
||||||
|
class:text-textcolor2={$SettingsMenuIndex !== 4}
|
||||||
|
on:click={() => {
|
||||||
|
$SettingsMenuIndex = 4
|
||||||
}}>
|
}}>
|
||||||
<CodeIcon />
|
<CodeIcon />
|
||||||
<span>{language.plugin}</span>
|
<span>{language.plugin}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 0}
|
class:text-textcolor={$SettingsMenuIndex === 0}
|
||||||
class:text-textcolor2={selected !== 0}
|
class:text-textcolor2={$SettingsMenuIndex !== 0}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 0
|
$SettingsMenuIndex = 0
|
||||||
}}>
|
}}>
|
||||||
<UserIcon />
|
<UserIcon />
|
||||||
<span>{language.account} & {language.files}</span>
|
<span>{language.account} & {language.files}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 6}
|
class:text-textcolor={$SettingsMenuIndex === 6}
|
||||||
class:text-textcolor2={selected !== 6}
|
class:text-textcolor2={$SettingsMenuIndex !== 6}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 6
|
$SettingsMenuIndex = 6
|
||||||
}}>
|
}}>
|
||||||
<ActivityIcon />
|
<ActivityIcon />
|
||||||
<span>{language.advancedSettings}</span>
|
<span>{language.advancedSettings}</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="flex gap-2 items-center hover:text-textcolor"
|
<button class="flex gap-2 items-center hover:text-textcolor"
|
||||||
class:text-textcolor={selected === 77}
|
class:text-textcolor={$SettingsMenuIndex === 77}
|
||||||
class:text-textcolor2={selected !== 77}
|
class:text-textcolor2={$SettingsMenuIndex !== 77}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
selected = 77
|
$SettingsMenuIndex = 77
|
||||||
}}>
|
}}>
|
||||||
<BoxIcon />
|
<BoxIcon />
|
||||||
<span>{language.supporterThanks}</span>
|
<span>{language.supporterThanks}</span>
|
||||||
@@ -149,42 +158,44 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if window.innerWidth >= 700 || selected !== -1}
|
{#if window.innerWidth >= 700 || $SettingsMenuIndex !== -1}
|
||||||
{#key selected}
|
{#key $SettingsMenuIndex}
|
||||||
<div class="flex-grow py-6 px-4 bg-bgcolor flex flex-col text-textcolor overflow-y-auto relative">
|
<div class="flex-grow py-6 px-4 bg-bgcolor flex flex-col text-textcolor overflow-y-auto relative">
|
||||||
{#if selected === 0}
|
{#if $SettingsMenuIndex === 0}
|
||||||
<UserSettings />
|
<UserSettings />
|
||||||
{:else if selected === 1}
|
{:else if $SettingsMenuIndex === 1}
|
||||||
<BotSettings bind:openPresetList goPromptTemplate={() => {
|
<BotSettings bind:openPresetList goPromptTemplate={() => {
|
||||||
selected = 13
|
$SettingsMenuIndex = 13
|
||||||
}} />
|
}} />
|
||||||
{:else if selected === 2}
|
{:else if $SettingsMenuIndex === 2}
|
||||||
<OtherBotSettings />
|
<OtherBotSettings />
|
||||||
{:else if selected === 3}
|
{:else if $SettingsMenuIndex === 3}
|
||||||
<DisplaySettings />
|
<DisplaySettings />
|
||||||
{:else if selected === 4}
|
{:else if $SettingsMenuIndex === 4}
|
||||||
<PluginSettings />
|
<PluginSettings />
|
||||||
{:else if selected === 5}
|
{:else if $SettingsMenuIndex === 5}
|
||||||
<FilesSettings />
|
<FilesSettings />
|
||||||
{:else if selected === 6}
|
{:else if $SettingsMenuIndex === 6}
|
||||||
<AdvancedSettings />
|
<AdvancedSettings />
|
||||||
{:else if selected === 7}
|
{:else if $SettingsMenuIndex === 7}
|
||||||
<Communities />
|
<Communities />
|
||||||
{:else if selected === 8}
|
{:else if $SettingsMenuIndex === 8}
|
||||||
<GlobalLoreBookSettings bind:openLoreList />
|
<GlobalLoreBookSettings bind:openLoreList />
|
||||||
{:else if selected === 9}
|
{:else if $SettingsMenuIndex === 9}
|
||||||
<GlobalRegex/>
|
<GlobalRegex/>
|
||||||
{:else if selected === 10}
|
{:else if $SettingsMenuIndex === 10}
|
||||||
<LanguageSettings/>
|
<LanguageSettings/>
|
||||||
{:else if selected === 11}
|
{:else if $SettingsMenuIndex === 11}
|
||||||
<AccessibilitySettings/>
|
<AccessibilitySettings/>
|
||||||
{:else if selected === 12}
|
{:else if $SettingsMenuIndex === 12}
|
||||||
<PersonaSettings/>
|
<PersonaSettings/>
|
||||||
{:else if selected === 13}
|
{:else if $SettingsMenuIndex === 14}
|
||||||
|
<ModuleSettings/>
|
||||||
|
{:else if $SettingsMenuIndex === 13}
|
||||||
<PromptSettings onGoBack={() => {
|
<PromptSettings onGoBack={() => {
|
||||||
selected = 1
|
$SettingsMenuIndex = 1
|
||||||
}}/>
|
}}/>
|
||||||
{:else if selected === 77}
|
{:else if $SettingsMenuIndex === 77}
|
||||||
<ThanksPage/>
|
<ThanksPage/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@@ -194,7 +205,7 @@
|
|||||||
settingsOpen.set(false)
|
settingsOpen.set(false)
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
selected = -1
|
$SettingsMenuIndex = -1
|
||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
<XCircleIcon />
|
<XCircleIcon />
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="contain w-full max-w-full mt-4 flex flex-col p-3 border-selected border-1 bg-darkbg rounded-md" bind:this={ele}>
|
<div class="contain w-full max-w-full mt-2 flex flex-col p-3 border-selected border-1 bg-darkbg rounded-md" bind:this={ele}>
|
||||||
{#if value.length === 0}
|
{#if value.length === 0}
|
||||||
<div class="text-textcolor2">No Scripts</div>
|
<div class="text-textcolor2">No Scripts</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="contain w-full max-w-full mt-4 flex flex-col p-3 border-selected border-1 bg-darkbg rounded-md" bind:this={ele}>
|
<div class="contain w-full max-w-full mt-2 flex flex-col p-3 border-selected border-1 bg-darkbg rounded-md" bind:this={ele}>
|
||||||
{#if value.length === 0}
|
{#if value.length === 0}
|
||||||
<div class="text-textcolor2">No Scripts</div>
|
<div class="text-textcolor2">No Scripts</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -126,10 +126,11 @@
|
|||||||
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gptvi4_1106')}}>GPT-4 Turbo 1106 Vision</button>
|
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gptvi4_1106')}}>GPT-4 Turbo 1106 Vision</button>
|
||||||
{#if showUnrec}
|
{#if showUnrec}
|
||||||
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt35_16k')}}>GPT-3.5 Turbo 16K</button>
|
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt35_16k')}}>GPT-3.5 Turbo 16K</button>
|
||||||
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt4_0301')}}>GPT-4 0301</button>
|
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt4_0314')}}>GPT-4 0314</button>
|
||||||
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt4_0613')}}>GPT-4 0613</button>
|
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt4_0613')}}>GPT-4 0613</button>
|
||||||
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt4_32k_0613')}}>GPT-4 32K 0613</button>
|
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt4_32k_0613')}}>GPT-4 32K 0613</button>
|
||||||
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt4_1106')}}>GPT-4 Turbo 1106</button>
|
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt4_1106')}}>GPT-4 Turbo 1106</button>
|
||||||
|
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt35_0125')}}>GPT-3.5 Turbo 0125</button>
|
||||||
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt35_1106')}}>GPT-3.5 Turbo 1106</button>
|
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt35_1106')}}>GPT-3.5 Turbo 1106</button>
|
||||||
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt35_0613')}}>GPT-3.5 Turbo 0613</button>
|
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt35_0613')}}>GPT-3.5 Turbo 0613</button>
|
||||||
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt35_16k_0613')}}>GPT-3.5 Turbo 16K 0613</button>
|
<button class="p-2 hover:text-green-500" on:click={() => {changeModel('gpt35_16k_0613')}}>GPT-3.5 Turbo 16K 0613</button>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { alertError, alertNormal } from "../alert";
|
|||||||
import { language } from "../../lang";
|
import { language } from "../../lang";
|
||||||
import { downloadFile } from "../storage/globalApi";
|
import { downloadFile } from "../storage/globalApi";
|
||||||
import { HypaProcesser } from "./memory/hypamemory";
|
import { HypaProcesser } from "./memory/hypamemory";
|
||||||
|
import { getModuleLorebooks } from "./modules";
|
||||||
|
|
||||||
export function addLorebook(type:number) {
|
export function addLorebook(type:number) {
|
||||||
let selectedID = get(selectedCharID)
|
let selectedID = get(selectedCharID)
|
||||||
@@ -71,12 +72,12 @@ export async function loadLoreBookPrompt(){
|
|||||||
const characterLore = char.globalLore ?? []
|
const characterLore = char.globalLore ?? []
|
||||||
const chatLore = char.chats[page].localLore ?? []
|
const chatLore = char.chats[page].localLore ?? []
|
||||||
const globalLore = db.loreBook[db.loreBookPage]?.data ?? []
|
const globalLore = db.loreBook[db.loreBookPage]?.data ?? []
|
||||||
const fullLore = characterLore.concat(chatLore.concat(globalLore))
|
const moduleLorebook = getModuleLorebooks()
|
||||||
|
const fullLore = characterLore.concat(chatLore).concat(moduleLorebook).concat(globalLore)
|
||||||
const currentChat = char.chats[page].message
|
const currentChat = char.chats[page].message
|
||||||
const loreDepth = char.loreSettings?.scanDepth ?? db.loreBookDepth
|
const loreDepth = char.loreSettings?.scanDepth ?? db.loreBookDepth
|
||||||
const loreToken = char.loreSettings?.tokenBudget ?? db.loreBookToken
|
const loreToken = char.loreSettings?.tokenBudget ?? db.loreBookToken
|
||||||
const fullWordMatching = char.loreSettings?.fullWordMatching ?? false
|
const fullWordMatching = char.loreSettings?.fullWordMatching ?? false
|
||||||
|
|
||||||
if(char.lorePlus){
|
if(char.lorePlus){
|
||||||
return await loadLoreBookPlusPrompt()
|
return await loadLoreBookPlusPrompt()
|
||||||
}
|
}
|
||||||
|
|||||||
120
src/ts/process/modules.ts
Normal file
120
src/ts/process/modules.ts
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
import { language } from "src/lang"
|
||||||
|
import { alertError, alertNormal } from "../alert"
|
||||||
|
import { DataBase, type customscript, type loreBook, type triggerscript } from "../storage/database"
|
||||||
|
import { downloadFile } from "../storage/globalApi"
|
||||||
|
import { get } from "svelte/store"
|
||||||
|
import { CurrentChat } from "../stores"
|
||||||
|
import { selectSingleFile } from "../util"
|
||||||
|
import { v4 } from "uuid"
|
||||||
|
|
||||||
|
export interface RisuModule{
|
||||||
|
name: string
|
||||||
|
description: string
|
||||||
|
lorebook?: loreBook[]
|
||||||
|
regex?: customscript[]
|
||||||
|
cjs?: string
|
||||||
|
trigger?: triggerscript[]
|
||||||
|
id: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function exportModule(module:RisuModule){
|
||||||
|
await downloadFile(module.name + '.json', JSON.stringify({
|
||||||
|
...module,
|
||||||
|
type: 'risuModule'
|
||||||
|
}, null, 2))
|
||||||
|
alertNormal(language.successExport)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function importModule(){
|
||||||
|
const f = await selectSingleFile(['json'])
|
||||||
|
if(!f){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const file = f.data
|
||||||
|
try {
|
||||||
|
const importedModule = JSON.parse(Buffer.from(file).toString())
|
||||||
|
if(importedModule.type === 'risuModule'){
|
||||||
|
const db = get(DataBase)
|
||||||
|
if(
|
||||||
|
(!importedModule.name)
|
||||||
|
|| (!importedModule.description)
|
||||||
|
|| (!importedModule.id)
|
||||||
|
){
|
||||||
|
alertError(language.errors.noData)
|
||||||
|
}
|
||||||
|
importedModule.id = v4()
|
||||||
|
db.modules.push(importedModule)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
alertNormal(language.errors.noData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getModuleById(id:string){
|
||||||
|
const db = get(DataBase)
|
||||||
|
for(let i=0;i<db.modules.length;i++){
|
||||||
|
if(db.modules[i].id === id){
|
||||||
|
return db.modules[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getModuleLorebooks() {
|
||||||
|
const currentChat = get(CurrentChat)
|
||||||
|
const db = get(DataBase)
|
||||||
|
if (!currentChat) return []
|
||||||
|
const moduleIds = currentChat.modules ?? []
|
||||||
|
moduleIds.concat(db.enabledModules)
|
||||||
|
let lorebooks: loreBook[] = []
|
||||||
|
for (const moduleId of moduleIds) {
|
||||||
|
const module = getModuleById(moduleId)
|
||||||
|
if(!module){
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (module.lorebook) {
|
||||||
|
lorebooks = lorebooks.concat(module.lorebook)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lorebooks
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export function getModuleTriggers() {
|
||||||
|
const currentChat = get(CurrentChat)
|
||||||
|
const db = get(DataBase)
|
||||||
|
if (!currentChat) return []
|
||||||
|
const moduleIds = currentChat.modules ?? []
|
||||||
|
moduleIds.concat(db.enabledModules)
|
||||||
|
let triggers: triggerscript[] = []
|
||||||
|
for (const moduleId of moduleIds) {
|
||||||
|
const module = getModuleById(moduleId)
|
||||||
|
if(!module){
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (module.trigger) {
|
||||||
|
triggers = triggers.concat(module.trigger)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return triggers
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getModuleRegexScripts() {
|
||||||
|
const currentChat = get(CurrentChat)
|
||||||
|
const db = get(DataBase)
|
||||||
|
if (!currentChat) return []
|
||||||
|
const moduleIds = currentChat.modules ?? []
|
||||||
|
moduleIds.concat(db.enabledModules)
|
||||||
|
let customscripts: customscript[] = []
|
||||||
|
for (const moduleId of moduleIds) {
|
||||||
|
const module = getModuleById(moduleId)
|
||||||
|
if(!module){
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (module.regex) {
|
||||||
|
customscripts = customscripts.concat(module.regex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return customscripts
|
||||||
|
}
|
||||||
@@ -152,9 +152,10 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
case 'gpt4_32k_0613':
|
case 'gpt4_32k_0613':
|
||||||
case 'gpt4_1106':
|
case 'gpt4_1106':
|
||||||
case 'gpt4_0125':
|
case 'gpt4_0125':
|
||||||
|
case 'gpt35_0125':
|
||||||
case 'gpt35_1106':
|
case 'gpt35_1106':
|
||||||
case 'gpt35_0301':
|
case 'gpt35_0301':
|
||||||
case 'gpt4_0301':
|
case 'gpt4_0314':
|
||||||
case 'gptvi4_1106':
|
case 'gptvi4_1106':
|
||||||
case 'openrouter':
|
case 'openrouter':
|
||||||
case 'mistral-tiny':
|
case 'mistral-tiny':
|
||||||
@@ -405,9 +406,10 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
: requestModel === "gpt4_1106" ? 'gpt-4-1106-preview'
|
: requestModel === "gpt4_1106" ? 'gpt-4-1106-preview'
|
||||||
: requestModel === 'gpt4_0125' ? 'gpt-4-0125-preview'
|
: requestModel === 'gpt4_0125' ? 'gpt-4-0125-preview'
|
||||||
: requestModel === "gptvi4_1106" ? 'gpt-4-vision-preview'
|
: requestModel === "gptvi4_1106" ? 'gpt-4-vision-preview'
|
||||||
|
: requestModel === "gpt35_0125" ? 'gpt-3.5-turbo-0125'
|
||||||
: requestModel === "gpt35_1106" ? 'gpt-3.5-turbo-1106'
|
: requestModel === "gpt35_1106" ? 'gpt-3.5-turbo-1106'
|
||||||
: requestModel === 'gpt35_0301' ? 'gpt-3.5-turbo-0301'
|
: requestModel === 'gpt35_0301' ? 'gpt-3.5-turbo-0301'
|
||||||
: requestModel === 'gpt4_0301' ? 'gpt-4-0301'
|
: requestModel === 'gpt4_0314' ? 'gpt-4-0314'
|
||||||
: (!requestModel) ? 'gpt-3.5-turbo'
|
: (!requestModel) ? 'gpt-3.5-turbo'
|
||||||
: requestModel,
|
: requestModel,
|
||||||
messages: formatedChat,
|
messages: formatedChat,
|
||||||
@@ -1423,7 +1425,7 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
let latestRole = 'user'
|
||||||
let requestPrompt = formated.map((v, i) => {
|
let requestPrompt = formated.map((v, i) => {
|
||||||
let prefix = ''
|
let prefix = ''
|
||||||
switch (v.role){
|
switch (v.role){
|
||||||
@@ -1437,13 +1439,18 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
prefix = "\n\nSystem: "
|
prefix = "\n\nSystem: "
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
latestRole = v.role
|
||||||
if(raiModel.startsWith('claude-2') && (!raiModel.startsWith('claude-2.0'))){
|
if(raiModel.startsWith('claude-2') && (!raiModel.startsWith('claude-2.0'))){
|
||||||
if(v.role === 'system' && i === 0){
|
if(v.role === 'system' && i === 0){
|
||||||
prefix = ''
|
prefix = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return prefix + v.content
|
return prefix + v.content
|
||||||
}).join('') + '\n\nAssistant: '
|
}).join('')
|
||||||
|
|
||||||
|
if(latestRole !== 'assistant'){
|
||||||
|
requestPrompt += '\n\nAssistant: '
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const bedrock = db.claudeAws
|
const bedrock = db.claudeAws
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { autoMarkPlugin } from "../plugins/automark";
|
|||||||
import { runCharacterJS } from "../plugins/embedscript";
|
import { runCharacterJS } from "../plugins/embedscript";
|
||||||
import { metricaPlugin } from "../plugins/metrica";
|
import { metricaPlugin } from "../plugins/metrica";
|
||||||
import { OaiFixKorean } from "../plugins/fixer";
|
import { OaiFixKorean } from "../plugins/fixer";
|
||||||
|
import { getModuleRegexScripts } from "./modules";
|
||||||
|
|
||||||
const dreg = /{{data}}/g
|
const dreg = /{{data}}/g
|
||||||
const randomness = /\|\|\|/g
|
const randomness = /\|\|\|/g
|
||||||
@@ -60,7 +61,7 @@ export async function importRegex(){
|
|||||||
export async function processScriptFull(char:character|groupChat|simpleCharacterArgument, data:string, mode:ScriptMode, chatID = -1){
|
export async function processScriptFull(char:character|groupChat|simpleCharacterArgument, data:string, mode:ScriptMode, chatID = -1){
|
||||||
let db = get(DataBase)
|
let db = get(DataBase)
|
||||||
let emoChanged = false
|
let emoChanged = false
|
||||||
const scripts = (db.globalscript ?? []).concat(char.customscript)
|
const scripts = (db.globalscript ?? []).concat(char.customscript).concat(getModuleRegexScripts())
|
||||||
if(db.officialplugins.automark && mode === 'editdisplay'){
|
if(db.officialplugins.automark && mode === 'editdisplay'){
|
||||||
data = autoMarkPlugin(data)
|
data = autoMarkPlugin(data)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { cloneDeep } from "lodash";
|
|||||||
import { getVarChat, risuChatParser } from "../parser";
|
import { getVarChat, risuChatParser } from "../parser";
|
||||||
import type { Chat, character } from "../storage/database";
|
import type { Chat, character } from "../storage/database";
|
||||||
import { tokenize } from "../tokenizer";
|
import { tokenize } from "../tokenizer";
|
||||||
|
import { getModuleTriggers } from "./modules";
|
||||||
|
|
||||||
export interface triggerscript{
|
export interface triggerscript{
|
||||||
comment: string;
|
comment: string;
|
||||||
@@ -68,7 +69,7 @@ export async function runTrigger(char:character,mode:triggerMode, arg:{
|
|||||||
historyend: '',
|
historyend: '',
|
||||||
promptend: ''
|
promptend: ''
|
||||||
}
|
}
|
||||||
const triggers = char.triggerscript
|
const triggers = char.triggerscript.concat(getModuleTriggers())
|
||||||
const chat = cloneDeep(arg.chat ?? char.chats[char.chatPage])
|
const chat = cloneDeep(arg.chat ?? char.chats[char.chatPage])
|
||||||
if((!triggers) || (triggers.length === 0)){
|
if((!triggers) || (triggers.length === 0)){
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -366,6 +366,8 @@ export function setDatabase(data:Database){
|
|||||||
data.openrouterMiddleOut ??= false
|
data.openrouterMiddleOut ??= false
|
||||||
data.removePunctuationHypa ??= true
|
data.removePunctuationHypa ??= true
|
||||||
data.memoryLimitThickness ??= 1
|
data.memoryLimitThickness ??= 1
|
||||||
|
data.modules ??= []
|
||||||
|
data.enabledModules ??= []
|
||||||
|
|
||||||
changeLanguage(data.language)
|
changeLanguage(data.language)
|
||||||
DataBase.set(data)
|
DataBase.set(data)
|
||||||
@@ -586,6 +588,8 @@ export interface Database{
|
|||||||
lastPatchNoteCheckVersion?:string,
|
lastPatchNoteCheckVersion?:string,
|
||||||
removePunctuationHypa?:boolean
|
removePunctuationHypa?:boolean
|
||||||
memoryLimitThickness?:number
|
memoryLimitThickness?:number
|
||||||
|
modules: RisuModule[]
|
||||||
|
enabledModules: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface customscript{
|
export interface customscript{
|
||||||
@@ -838,6 +842,7 @@ export interface Chat{
|
|||||||
suggestMessages?:string[]
|
suggestMessages?:string[]
|
||||||
isStreaming?:boolean
|
isStreaming?:boolean
|
||||||
scriptstate?:{[key:string]:string|number|boolean}
|
scriptstate?:{[key:string]:string|number|boolean}
|
||||||
|
modules?:string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Message{
|
export interface Message{
|
||||||
@@ -1119,6 +1124,7 @@ export function setPreset(db:Database, newPres: botPreset){
|
|||||||
import { encode as encodeMsgpack, decode as decodeMsgpack } from "msgpackr";
|
import { encode as encodeMsgpack, decode as decodeMsgpack } from "msgpackr";
|
||||||
import * as fflate from "fflate";
|
import * as fflate from "fflate";
|
||||||
import type { OnnxModelFiles } from '../process/embedding/transformers';
|
import type { OnnxModelFiles } from '../process/embedding/transformers';
|
||||||
|
import type { RisuModule } from '../process/modules';
|
||||||
|
|
||||||
export async function downloadPreset(id:number){
|
export async function downloadPreset(id:number){
|
||||||
saveCurrentPreset()
|
saveCurrentPreset()
|
||||||
|
|||||||
@@ -44,7 +44,11 @@ interface fetchLog{
|
|||||||
|
|
||||||
let fetchLog:fetchLog[] = []
|
let fetchLog:fetchLog[] = []
|
||||||
|
|
||||||
export async function downloadFile(name:string, data:Uint8Array|ArrayBuffer) {
|
export async function downloadFile(name:string, dat:Uint8Array|ArrayBuffer|string) {
|
||||||
|
if(typeof(dat) === 'string'){
|
||||||
|
dat = Buffer.from(dat, 'utf-8')
|
||||||
|
}
|
||||||
|
const data = new Uint8Array(dat)
|
||||||
const downloadURL = (data:string, fileName:string) => {
|
const downloadURL = (data:string, fileName:string) => {
|
||||||
const a = document.createElement('a')
|
const a = document.createElement('a')
|
||||||
a.href = data
|
a.href = data
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export const CurrentUsername = writable(db.username)
|
|||||||
export const CurrentUserIcon = writable(db.userIcon)
|
export const CurrentUserIcon = writable(db.userIcon)
|
||||||
export const CurrentShowMemoryLimit = writable(db.showMemoryLimit)
|
export const CurrentShowMemoryLimit = writable(db.showMemoryLimit)
|
||||||
export const ShowVN = writable(false)
|
export const ShowVN = writable(false)
|
||||||
|
export const SettingsMenuIndex = writable(0)
|
||||||
|
|
||||||
function createSimpleCharacter(char:character|groupChat){
|
function createSimpleCharacter(char:character|groupChat){
|
||||||
if((!char) || char.type === 'group'){
|
if((!char) || char.type === 'group'){
|
||||||
|
|||||||
Reference in New Issue
Block a user