feat: add module apply
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
import { CurrentChat } from "src/ts/stores";
|
||||
import { tokenize } from "src/ts/tokenizer";
|
||||
import TextAreaInput from "../UI/GUI/TextAreaInput.svelte";
|
||||
import ModuleChatMenu from "../Setting/Pages/Module/ModuleChatMenu.svelte";
|
||||
let btn
|
||||
let input = ''
|
||||
let cardExportType = 'realm'
|
||||
@@ -58,7 +59,7 @@
|
||||
}
|
||||
}}></svelte:window>
|
||||
|
||||
{#if $alertStore.type !== 'none' && $alertStore.type !== 'toast' && $alertStore.type !== 'cardexport'}
|
||||
{#if $alertStore.type !== 'none' && $alertStore.type !== 'toast' && $alertStore.type !== 'cardexport' && $alertStore.type !== 'selectModule'}
|
||||
<div class="absolute w-full h-full z-50 bg-black bg-opacity-50 flex justify-center items-center" class:vis={ $alertStore.type === 'wait2'}>
|
||||
<div class="bg-darkbg p-4 break-any rounded-md flex flex-col max-w-3xl max-h-full overflow-y-auto">
|
||||
{#if $alertStore.type === 'error'}
|
||||
@@ -450,6 +451,13 @@
|
||||
})
|
||||
}}
|
||||
>{$alertStore.msg}</div>
|
||||
{:else if $alertStore.type === 'selectModule'}
|
||||
<ModuleChatMenu alertMode close={(d) => {
|
||||
alertStore.set({
|
||||
type: 'none',
|
||||
msg: d
|
||||
})
|
||||
}} />
|
||||
{/if}
|
||||
|
||||
<style>
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
import { DataBase } from "src/ts/storage/database";
|
||||
import { CurrentChat } from "src/ts/stores";
|
||||
import { SettingsMenuIndex, settingsOpen } from "src/ts/stores";
|
||||
export let close = () => {}
|
||||
|
||||
export let close = (i:string) => {}
|
||||
export let alertMode = false
|
||||
let moduleSearch = ''
|
||||
|
||||
function sortModules(modules:RisuModule[], search:string){
|
||||
@@ -20,11 +20,13 @@
|
||||
}).sort((a, b) => {
|
||||
let score = a.name.toLowerCase().localeCompare(b.name.toLowerCase())
|
||||
|
||||
if(db.enabledModules.includes(a.id)){
|
||||
score += 1000
|
||||
}
|
||||
if(db.enabledModules.includes(b.id)){
|
||||
score -= 1000
|
||||
if(!alertMode){
|
||||
if(db.enabledModules.includes(a.id)){
|
||||
score += 1000
|
||||
}
|
||||
if(db.enabledModules.includes(b.id)){
|
||||
score -= 1000
|
||||
}
|
||||
}
|
||||
|
||||
return score
|
||||
@@ -39,7 +41,9 @@
|
||||
<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}>
|
||||
<button class="text-textcolor2 hover:text-green-500 mr-2 cursor-pointer items-center" on:click={() => {
|
||||
close('')
|
||||
}}>
|
||||
<XIcon size={24}/>
|
||||
</button>
|
||||
</div>
|
||||
@@ -64,15 +68,21 @@
|
||||
<span class="">{rmodule.name}</span>
|
||||
{/if}
|
||||
<div class="flex-grow flex justify-end">
|
||||
{#if $DataBase.enabledModules.includes(rmodule.id)}
|
||||
{#if $DataBase.enabledModules.includes(rmodule.id) && !alertMode}
|
||||
<button class="mr-2 text-textcolor2 cursor-not-allowed">
|
||||
</button>
|
||||
{:else}
|
||||
<button class={(!$CurrentChat.modules.includes(rmodule.id)) ?
|
||||
<button class={(!$CurrentChat.modules.includes(rmodule.id) && !alertMode) ?
|
||||
"text-textcolor2 hover:text-green-500 mr-2 cursor-pointer" :
|
||||
"mr-2 cursor-pointer text-blue-500"
|
||||
} on:click={async (e) => {
|
||||
e.stopPropagation()
|
||||
|
||||
if(alertMode){
|
||||
close(rmodule.id)
|
||||
return
|
||||
}
|
||||
|
||||
if($CurrentChat.modules.includes(rmodule.id)){
|
||||
$CurrentChat.modules.splice($CurrentChat.modules.indexOf(rmodule.id), 1)
|
||||
}
|
||||
@@ -93,7 +103,7 @@
|
||||
<Button className="mt-4 flex-grow-0" size="sm" on:click={() => {
|
||||
$SettingsMenuIndex = 14
|
||||
$settingsOpen = true
|
||||
close()
|
||||
close('')
|
||||
}}>{language.edit}</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
import { updateInlayScreen } from "src/ts/process/inlayScreen";
|
||||
import { registerOnnxModel } from "src/ts/process/transformers";
|
||||
import MultiLangInput from "../UI/GUI/MultiLangInput.svelte";
|
||||
import { applyModule } from "src/ts/process/modules";
|
||||
|
||||
|
||||
let subMenu = 0
|
||||
@@ -904,20 +905,30 @@
|
||||
</div>
|
||||
|
||||
{#if $DataBase.supaMemoryType === 'hypaV2'}
|
||||
<Button on:click={() => {
|
||||
currentChar.data.chats[currentChar.data.chatPage].hypaV2Data ??= {
|
||||
chunks: [],
|
||||
mainChunks: []
|
||||
}
|
||||
showHypaV2Alert()
|
||||
}}>
|
||||
<Button
|
||||
on:click={() => {
|
||||
currentChar.data.chats[currentChar.data.chatPage].hypaV2Data ??= {
|
||||
chunks: [],
|
||||
mainChunks: []
|
||||
}
|
||||
showHypaV2Alert()
|
||||
}}
|
||||
className="mt-4"
|
||||
>
|
||||
{language.HypaMemory} V2 Data
|
||||
</Button>
|
||||
{:else if currentChar.data.chats[currentChar.data.chatPage].supaMemoryData && currentChar.data.chats[currentChar.data.chatPage].supaMemoryData.length > 4 || currentChar.data.supaMemory}
|
||||
<span class="text-textcolor">{language.SuperMemory}</span>
|
||||
<span class="text-textcolor mt-4">{language.SuperMemory}</span>
|
||||
<TextAreaInput margin="both" autocomplete="off" bind:value={currentChar.data.chats[currentChar.data.chatPage].supaMemoryData}></TextAreaInput>
|
||||
{/if}
|
||||
|
||||
<Button
|
||||
on:click={applyModule}
|
||||
className="mt-4"
|
||||
>
|
||||
{language.applyModule}
|
||||
</Button>
|
||||
|
||||
{#if currentChar.data.license !== 'CC BY-NC-SA 4.0'
|
||||
&& currentChar.data.license !== 'CC BY-SA 4.0'
|
||||
&& currentChar.data.license !== 'CC BY-ND 4.0'
|
||||
@@ -946,15 +957,9 @@
|
||||
{/if}
|
||||
{:else}
|
||||
{#if currentChar.data.chats[currentChar.data.chatPage].supaMemoryData && currentChar.data.chats[currentChar.data.chatPage].supaMemoryData.length > 4 || currentChar.data.supaMemory}
|
||||
<span class="text-textcolor">{language.SuperMemory}</span>
|
||||
<span class="text-textcolor mt-4">{language.SuperMemory}</span>
|
||||
<TextAreaInput margin="both" autocomplete="off" bind:value={currentChar.data.chats[currentChar.data.chatPage].supaMemoryData}></TextAreaInput>
|
||||
{/if}
|
||||
{#if $DataBase.useExperimental}
|
||||
<div class="flex mb-2 items-center">
|
||||
<Check bind:check={currentChar.data.useCharacterLore} name={language.useCharLorebook}/>
|
||||
<Help key="experimental" name={language.useCharLorebook}/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="flex items-center mt-4">
|
||||
<Check bind:check={currentChar.data.lowLevelAccess} name={language.lowLevelAccess}/>
|
||||
|
||||
Reference in New Issue
Block a user