[feat] trigger gui
This commit is contained in:
@@ -57,8 +57,11 @@ export async function importRegex(){
|
||||
export function processScriptFull(char:character|groupChat, data:string, mode:ScriptMode, chatID = -1){
|
||||
let db = get(DataBase)
|
||||
let emoChanged = false
|
||||
const scripts = (db.globalscript ?? []).concat(char.customscript)
|
||||
for (const script of scripts){
|
||||
const globalscripts = (db.globalscript ?? []).concat(char.customscript)
|
||||
if(db.officialplugins.automark && mode === 'editdisplay'){
|
||||
data = autoMarkPlugin(data)
|
||||
}
|
||||
for (const script of globalscripts){
|
||||
if(script.type === mode){
|
||||
const reg = new RegExp(script.in, script.ableFlag ? script.flag : 'g')
|
||||
let outScript2 = script.out.replaceAll("$n", "\n")
|
||||
@@ -141,9 +144,6 @@ export function processScriptFull(char:character|groupChat, data:string, mode:Sc
|
||||
}
|
||||
}
|
||||
}
|
||||
if(db.officialplugins.automark && mode === 'editdisplay'){
|
||||
data = autoMarkPlugin(data)
|
||||
}
|
||||
return {data, emoChanged}
|
||||
}
|
||||
|
||||
|
||||
42
src/ts/process/triggers.ts
Normal file
42
src/ts/process/triggers.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
export interface triggerscript{
|
||||
comment: string;
|
||||
type: 'start'|'manual'|'output'
|
||||
conditions: triggerCondition[]
|
||||
effect:triggerEffect[]
|
||||
}
|
||||
|
||||
export type triggerCondition = triggerConditionsVar|triggerConditionsExists
|
||||
|
||||
export type triggerEffect = triggerEffectSetvar|triggerEffectSystemPrompt|triggerEffectImpersonate
|
||||
|
||||
export type triggerConditionsVar = {
|
||||
type:'var'
|
||||
var:string
|
||||
value:string
|
||||
operator:'='|'!='|'>'|'<'|'>='|'<='
|
||||
}
|
||||
|
||||
export type triggerConditionsExists ={
|
||||
type: 'exists'
|
||||
value:string
|
||||
type2: 'strict'|'loose'|'regex',
|
||||
depth: number
|
||||
}
|
||||
|
||||
export interface triggerEffectSetvar{
|
||||
type: 'setvar'
|
||||
var:string
|
||||
value:string
|
||||
}
|
||||
|
||||
export interface triggerEffectSystemPrompt{
|
||||
type: 'systemprompt',
|
||||
location: 'start'|'historyend'|'promptend',
|
||||
value:string
|
||||
}
|
||||
|
||||
export interface triggerEffectImpersonate{
|
||||
type: 'impersonate'
|
||||
role: 'user'|'char',
|
||||
value:string
|
||||
}
|
||||
Reference in New Issue
Block a user