Add Command for trigger

This commit is contained in:
kwaroran
2024-04-10 09:36:28 +09:00
parent 410eaf6de1
commit 0d57392feb
3 changed files with 24 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import { tokenize } from "../tokenizer";
import { getModuleTriggers } from "./modules";
import { get } from "svelte/store";
import { CurrentChat } from "../stores";
import { processMultiCommand } from "./command";
export interface triggerscript{
comment: string;
@@ -15,7 +16,7 @@ export interface triggerscript{
export type triggerCondition = triggerConditionsVar|triggerConditionsExists|triggerConditionsChatIndex
export type triggerEffect = triggerEffectSetvar|triggerEffectSystemPrompt|triggerEffectImpersonate
export type triggerEffect = triggerEffectSetvar|triggerEffectSystemPrompt|triggerEffectImpersonate|triggerEffectCommand
export type triggerConditionsVar = {
type:'var'
@@ -56,6 +57,11 @@ export interface triggerEffectImpersonate{
value:string
}type triggerMode = 'start'|'manual'|'output'|'input'
export interface triggerEffectCommand{
type: 'command',
value: string
}
export type additonalSysPrompt = {
start:string,
historyend: string,
@@ -198,6 +204,9 @@ export async function runTrigger(char:character,mode:triggerMode, arg:{
chat.message.push({role: 'char', data: effect.value})
}
}
else if(effect.type === 'command'){
return await processMultiCommand(effect.value)
}
}
}