Add Command for trigger
This commit is contained in:
@@ -416,6 +416,7 @@ export const languageEnglish = {
|
|||||||
triggerEffSysPrompt: 'Add System Prompt',
|
triggerEffSysPrompt: 'Add System Prompt',
|
||||||
triggerEffSetVar: 'Modify Variable',
|
triggerEffSetVar: 'Modify Variable',
|
||||||
triggerEffImperson: 'Send Chat',
|
triggerEffImperson: 'Send Chat',
|
||||||
|
triggerEffCommand: 'Run Command',
|
||||||
varableName: "Variable Name",
|
varableName: "Variable Name",
|
||||||
role: "Role",
|
role: "Role",
|
||||||
location: 'Location',
|
location: 'Location',
|
||||||
|
|||||||
@@ -211,12 +211,20 @@
|
|||||||
value: ''
|
value: ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(effect.type === 'command'){
|
||||||
|
effect = {
|
||||||
|
type: 'command',
|
||||||
|
value: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
}}>
|
}}>
|
||||||
{#if effect.type === 'systemprompt' || value.type === 'start'}
|
{#if effect.type === 'systemprompt' || value.type === 'start'}
|
||||||
<OptionInput value="systemprompt">{language.triggerEffSysPrompt}</OptionInput>
|
<OptionInput value="systemprompt">{language.triggerEffSysPrompt}</OptionInput>
|
||||||
{/if}
|
{/if}
|
||||||
<OptionInput value="setvar">{language.triggerEffSetVar}</OptionInput>
|
<OptionInput value="setvar">{language.triggerEffSetVar}</OptionInput>
|
||||||
<OptionInput value="impersonate">{language.triggerEffImperson}</OptionInput>
|
<OptionInput value="impersonate">{language.triggerEffImperson}</OptionInput>
|
||||||
|
<OptionInput value="command">{language.triggerEffCommand}</OptionInput>
|
||||||
|
|
||||||
</SelectInput>
|
</SelectInput>
|
||||||
{#if effect.type === 'systemprompt'}
|
{#if effect.type === 'systemprompt'}
|
||||||
{#if value.type !== 'start'}
|
{#if value.type !== 'start'}
|
||||||
@@ -245,6 +253,11 @@
|
|||||||
<span class="text-textcolor2 text-sm">{language.value}</span>
|
<span class="text-textcolor2 text-sm">{language.value}</span>
|
||||||
<TextInput size="sm" bind:value={effect.value} />
|
<TextInput size="sm" bind:value={effect.value} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{#if effect.type === 'command'}
|
||||||
|
<span class="text-textcolor2 text-sm">{language.value}</span>
|
||||||
|
<TextAreaInput size="sm" bind:value={effect.value} />
|
||||||
|
{/if}
|
||||||
{#if effect.type === 'impersonate'}
|
{#if effect.type === 'impersonate'}
|
||||||
<span class="text-textcolor2 text-sm">{language.role}</span>
|
<span class="text-textcolor2 text-sm">{language.role}</span>
|
||||||
<SelectInput bind:value={effect.role} size="sm">
|
<SelectInput bind:value={effect.role} size="sm">
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { tokenize } from "../tokenizer";
|
|||||||
import { getModuleTriggers } from "./modules";
|
import { getModuleTriggers } from "./modules";
|
||||||
import { get } from "svelte/store";
|
import { get } from "svelte/store";
|
||||||
import { CurrentChat } from "../stores";
|
import { CurrentChat } from "../stores";
|
||||||
|
import { processMultiCommand } from "./command";
|
||||||
|
|
||||||
export interface triggerscript{
|
export interface triggerscript{
|
||||||
comment: string;
|
comment: string;
|
||||||
@@ -15,7 +16,7 @@ export interface triggerscript{
|
|||||||
|
|
||||||
export type triggerCondition = triggerConditionsVar|triggerConditionsExists|triggerConditionsChatIndex
|
export type triggerCondition = triggerConditionsVar|triggerConditionsExists|triggerConditionsChatIndex
|
||||||
|
|
||||||
export type triggerEffect = triggerEffectSetvar|triggerEffectSystemPrompt|triggerEffectImpersonate
|
export type triggerEffect = triggerEffectSetvar|triggerEffectSystemPrompt|triggerEffectImpersonate|triggerEffectCommand
|
||||||
|
|
||||||
export type triggerConditionsVar = {
|
export type triggerConditionsVar = {
|
||||||
type:'var'
|
type:'var'
|
||||||
@@ -56,6 +57,11 @@ export interface triggerEffectImpersonate{
|
|||||||
value:string
|
value:string
|
||||||
}type triggerMode = 'start'|'manual'|'output'|'input'
|
}type triggerMode = 'start'|'manual'|'output'|'input'
|
||||||
|
|
||||||
|
export interface triggerEffectCommand{
|
||||||
|
type: 'command',
|
||||||
|
value: string
|
||||||
|
}
|
||||||
|
|
||||||
export type additonalSysPrompt = {
|
export type additonalSysPrompt = {
|
||||||
start:string,
|
start:string,
|
||||||
historyend: string,
|
historyend: string,
|
||||||
@@ -198,6 +204,9 @@ export async function runTrigger(char:character,mode:triggerMode, arg:{
|
|||||||
chat.message.push({role: 'char', data: effect.value})
|
chat.message.push({role: 'char', data: effect.value})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(effect.type === 'command'){
|
||||||
|
return await processMultiCommand(effect.value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user