{
@@ -77,7 +81,7 @@
alertError(language.errors.onlyOneChat)
return
}
- const d = await alertConfirm(`${language.removeConfirm}${presets.name}`)
+ const d = await alertConfirm(`${language.removeConfirm}${preset.name}`)
if(d){
changeToPreset(0)
let botPresets = DBState.db.botPresets
diff --git a/src/lib/SideBars/Scripts/RegexList.svelte b/src/lib/SideBars/Scripts/RegexList.svelte
index 9c21f804..963c83ab 100644
--- a/src/lib/SideBars/Scripts/RegexList.svelte
+++ b/src/lib/SideBars/Scripts/RegexList.svelte
@@ -4,11 +4,13 @@
import Sortable from "sortablejs";
import { sleep, sortableOptions } from "src/ts/util";
import { onDestroy, onMount } from "svelte";
+ import { PlusIcon } from "lucide-svelte";
interface Props {
value?: customscript[];
+ buttons?: boolean
}
- let { value = $bindable([]) }: Props = $props();
+ let { value = $bindable([]), buttons = false }: Props = $props();
let stb: Sortable = null
let ele: HTMLDivElement = $state()
let sorted = $state(0)
@@ -75,3 +77,15 @@
{/each}
{/key}
+{#if buttons}
+
+{/if}
\ No newline at end of file
diff --git a/src/ts/process/modules.ts b/src/ts/process/modules.ts
index 0aec3e2d..5afb4f00 100644
--- a/src/ts/process/modules.ts
+++ b/src/ts/process/modules.ts
@@ -279,10 +279,6 @@ export function getModules(){
if (currentChat){
ids = ids.concat(currentChat.modules ?? [])
}
- if(db.moduleIntergration){
- const intList = db.moduleIntergration.split(',').map((s) => s.trim())
- ids = ids.concat(intList)
- }
const idsJoined = ids.join('-')
if(lastModules === idsJoined){
return lastModuleData
diff --git a/src/ts/process/scripts.ts b/src/ts/process/scripts.ts
index 5505ea8d..37dea54f 100644
--- a/src/ts/process/scripts.ts
+++ b/src/ts/process/scripts.ts
@@ -97,12 +97,12 @@ export function resetScriptCache(){
export async function processScriptFull(char:character|groupChat|simpleCharacterArgument, data:string, mode:ScriptMode, chatID = -1, cbsConditions:CbsConditions = {}){
let db = getDatabase()
const originalData = data
- const cached = getScriptCache((db.globalscript ?? []).concat(char.customscript), originalData, mode)
+ const cached = getScriptCache((db.presetRegex ?? []).concat(char.customscript), originalData, mode)
if(cached){
return {data: cached, emoChanged: false}
}
let emoChanged = false
- const scripts = (db.globalscript ?? []).concat(char.customscript).concat(getModuleRegexScripts())
+ const scripts = (db.presetRegex ?? []).concat(char.customscript).concat(getModuleRegexScripts())
data = await runLuaEditTrigger(char, mode, data)
if(pluginV2[mode].size > 0){
for(const plugin of pluginV2[mode]){
diff --git a/src/ts/storage/database.svelte.ts b/src/ts/storage/database.svelte.ts
index ade7197a..7a301c5f 100644
--- a/src/ts/storage/database.svelte.ts
+++ b/src/ts/storage/database.svelte.ts
@@ -5,7 +5,7 @@ import type { RisuPlugin } from '../plugins/plugins';
import type {triggerscript as triggerscriptMain} from '../process/triggers';
import { downloadFile, saveAsset as saveImageGlobal } from '../globalApi.svelte';
import { defaultAutoSuggestPrompt, defaultJailbreak, defaultMainPrompt } from './defaultPrompts';
-import { alertNormal, alertSelect } from '../alert';
+import { alertError, alertNormal, alertSelect } from '../alert';
import type { NAISettings } from '../process/models/nai';
import { prebuiltNAIpresets, prebuiltPresets } from '../process/templates/templates';
import { defaultColorScheme, type ColorScheme } from '../gui/colorscheme';
@@ -353,6 +353,7 @@ export function setDatabase(data:Database){
data.huggingfaceKey ??= ''
data.fishSpeechKey ??= ''
data.statistics ??= {}
+ data.presetRegex ??= []
data.reverseProxyOobaArgs ??= {
mode: 'instruct'
}
@@ -860,6 +861,7 @@ export interface Database{
menuSideBar:boolean
pluginV2: RisuPlugin[]
showSavingIcon:boolean
+ presetRegex: customscript[]
}
interface SeparateParameters{
@@ -1181,6 +1183,8 @@ export interface botPreset{
openAIPrediction?: string
enableCustomFlags?: boolean
customFlags?: LLMFlags[]
+ image?:string
+ regex?:customscript[]
}
@@ -1481,6 +1485,7 @@ export function saveCurrentPreset(){
systemRoleReplacement: db.systemRoleReplacement,
customFlags: safeStructuredClone(db.customFlags),
enableCustomFlags: db.enableCustomFlags,
+ regex: db.presetRegex
}
db.botPresets = pres
setDatabase(db)
@@ -1588,6 +1593,7 @@ export function setPreset(db:Database, newPres: botPreset){
db.systemRoleReplacement = newPres.systemRoleReplacement ?? 'user'
db.customFlags = safeStructuredClone(newPres.customFlags) ?? []
db.enableCustomFlags = newPres.enableCustomFlags ?? false
+ db.presetRegex = newPres.regex ?? []
return db
}
@@ -1613,6 +1619,12 @@ export async function downloadPreset(id:number, type:'json'|'risupreset'|'return
pres.proxyKey = ''
pres.textgenWebUIStreamURL= ''
pres.textgenWebUIBlockingURL= ''
+
+ if((pres.image || pres.regex?.length > 0) && type !== 'return'){
+ alertError("Preset with image or regexes cannot be exported for now. use RisuRealm to share the preset.")
+ return
+ }
+
if(type === 'json'){
downloadFile(pres.name + "_preset.json", Buffer.from(JSON.stringify(pres, null, 2)))
}
diff --git a/src/ts/stores.svelte.ts b/src/ts/stores.svelte.ts
index 80a0add7..439e8372 100644
--- a/src/ts/stores.svelte.ts
+++ b/src/ts/stores.svelte.ts
@@ -111,7 +111,6 @@ $effect.root(() => {
DBState?.db?.characters?.[selIdState.selId]?.chats?.[DBState?.db?.characters?.[selIdState.selId]?.chatPage]?.modules?.length
DBState?.db?.characters?.[selIdState.selId]?.hideChatIcon
DBState?.db?.characters?.[selIdState.selId]?.backgroundHTML
- DBState?.db?.moduleIntergration
moduleUpdate()
})
})
\ No newline at end of file