Add TriggerV2
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -41,5 +41,5 @@ recc.md
|
||||
__pycache__/
|
||||
.tauri/
|
||||
dist.zip
|
||||
scripts/
|
||||
/scripts/
|
||||
.env
|
||||
141
src/lang/en.ts
141
src/lang/en.ts
@@ -240,6 +240,129 @@ export const languageEnglish = {
|
||||
finallyOption2: "No",
|
||||
finallyOption2Desc: "This will disable advanced tools, and make the UI more simple. Recommended for new users.",
|
||||
},
|
||||
triggerDesc: {
|
||||
v2Header: "Header",
|
||||
v2HeaderDesc: "Header",
|
||||
v2If: "If",
|
||||
v2IfDesc: "If {{source}} {{condition}} {{target}}",
|
||||
v2Else: "Else",
|
||||
v2ElseDesc: "Else",
|
||||
v2EndIndent: "End Indent",
|
||||
v2EndIndentDesc: "End Indent",
|
||||
v2SetVar: "Set Variable",
|
||||
v2SetVarDesc: "Set Variable {{var}} {{operator}} {{value}}",
|
||||
v2Loop: "Loop Forever",
|
||||
v2LoopDesc: "Loop Forever",
|
||||
v2BreakLoop: "Break Loop",
|
||||
v2BreakLoopDesc: "Break Loop",
|
||||
v2RunTrigger: "Run Trigger",
|
||||
v2RunTriggerDesc: "Run Trigger {{target}}",
|
||||
v2ConsoleLog: "Console Log",
|
||||
v2ConsoleLogDesc: "Console Log {{source}}",
|
||||
v2StopTrigger: "Stop Trigger",
|
||||
v2StopTriggerDesc: "Stop Trigger",
|
||||
v2CutChat: "Cut Chat",
|
||||
v2CutChatDesc: "Cut Chat from {{start}} to {{end}}",
|
||||
v2ModifyChat: "Modify Chat",
|
||||
v2ModifyChatDesc: "Modify Chat at index {{index}} with {{value}}",
|
||||
v2SystemPrompt: "Add System Prompt",
|
||||
v2SystemPromptDesc: "Add System Prompt at {{location}} with {{value}}",
|
||||
v2Impersonate: "Send Chat",
|
||||
v2ImpersonateDesc: "Send Chat as {{role}} with {{value}}",
|
||||
v2Command: "Run Command",
|
||||
v2CommandDesc: "Run command with {{value}}",
|
||||
v2SendAIprompt: "Send AI Prompt",
|
||||
v2SendAIpromptDesc: "Send AI Prompt",
|
||||
v2ImgGen: "Image Generation",
|
||||
v2ImgGenDesc: "Generate image from {{value}}, negative from {{negValue}} => {{outputVar}}",
|
||||
v2CheckSimilarity: "Check Similarity",
|
||||
v2CheckSimilarityDesc: "Check similarity between {{source}} and {{value}} => {{outputVar}}",
|
||||
v2RunLLM: "Run Model",
|
||||
v2RunLLMDesc: "Send request to model from {{value}} => {{outputVar}}",
|
||||
v2ShowAlert: "Show Alert",
|
||||
v2ShowAlertDesc: "Show alert with {{value}}",
|
||||
v2ExtractRegex: "Extract Regex",
|
||||
v2ExtractRegexDesc: "Extract text from {{value}} with regex {{regexType}} {{regex}} and flags {{flagsType}} {{flags}}, then store result as {{resultType}} {{result}} => {{outputVar}}",
|
||||
v2GetLastMessage: "Get Last Message",
|
||||
v2GetLastMessageDesc: "Get Last Message => {{outputVar}}",
|
||||
v2GetMessageAtIndex: "Get Message at Index",
|
||||
v2GetMessageAtIndexDesc: "Get Message at Index {{index}} => {{outputVar}}",
|
||||
v2GetMessageCount: "Get Message Count",
|
||||
v2GetMessageCountDesc: "Get Message Count => {{outputVar}}",
|
||||
v2GetLorebook: "Get Lorebook",
|
||||
v2GetLorebookDesc: "Get Lorebook named {{target}} => {{outputVar}}",
|
||||
v2GetLorebookCount: "Get Lorebook Count",
|
||||
v2GetLorebookCountDesc: "Get Lorebook Count => {{outputVar}}",
|
||||
v2GetLorebookEntry: "Get Lorebook with index",
|
||||
v2GetLorebookEntryDesc: "Get Lorebook with index {{index}} => {{outputVar}}",
|
||||
v2SetLorebookActivation: "Set Lorebook Activation",
|
||||
v2SetLorebookActivationDesc: "Set Lorebook with index {{index}}'s activation state to {{value}}",
|
||||
v2GetLorebookIndexViaName: "Get Lorebook Index via Name",
|
||||
v2GetLorebookIndexViaNameDesc: "Get Lorebook Index via Name {{name}} => {{outputVar}}",
|
||||
v2ModifyLorebook: "Modify Lorebook",
|
||||
v2ModifyLorebookDesc: "Modify Lorebook named {{target}} with {{value}}",
|
||||
v2LoopNTimes: "Loop N Times",
|
||||
v2LoopNTimesDesc: "Loop {{value}} Times",
|
||||
v2Random: "Random",
|
||||
v2RandomDesc: "Random from {{min}} to {{max}} => {{outputVar}}",
|
||||
v2GetCharAt: "Get Character at Index",
|
||||
v2GetCharAtDesc: "Get Character at Index {{index}} from {{source}} => {{outputVar}}",
|
||||
v2GetCharCount: "Get Character Count",
|
||||
v2GetCharCountDesc: "Get Character Count from {{source}} => {{outputVar}}",
|
||||
v2ToLowerCase: "Convert to Lower Case",
|
||||
v2ToLowerCaseDesc: "Convert {{source}} to Lower Case => {{outputVar}}",
|
||||
v2ToUpperCase: "Convert to Upper Case",
|
||||
v2ToUpperCaseDesc: "Convert {{source}} to Upper Case => {{outputVar}}",
|
||||
v2SetCharAt: "Set Character at Index",
|
||||
v2SetCharAtDesc: "Set Character at Index {{index}} in {{source}} to {{value}} => {{outputVar}}",
|
||||
v2SplitString: "Split String",
|
||||
v2SplitStringDesc: "Split {{source}} by {{delimiter}} => {{outputVar}}",
|
||||
v2GetCharacterDesc: "Get Character Description",
|
||||
v2GetCharacterDescDesc: "Get Character Description => {{outputVar}}",
|
||||
v2SetCharacterDesc: "Set Character Description",
|
||||
v2SetCharacterDescDesc: "Set Character Description to {{value}}",
|
||||
v2MakeArrayVar: "Make Array Variable",
|
||||
v2MakeArrayVarDesc: "Make Array Variable {{var}}",
|
||||
v2GetArrayVarLength: "Get Array Variable Length",
|
||||
v2GetArrayVarLengthDesc: "Get Length of Array Variable {{var}} => {{outputVar}}",
|
||||
v2GetArrayVar: "Get Array Variable",
|
||||
v2GetArrayVarDesc: "Get Value at Index {{index}} from Array Variable {{var}} => {{outputVar}}",
|
||||
v2SetArrayVar: "Set Array Variable",
|
||||
v2SetArrayVarDesc: "Set Value at Index {{index}} in Array Variable {{var}} to {{value}}",
|
||||
v2PushArrayVar: "Add to Array Variable",
|
||||
v2PushArrayVarDesc: "Add {{value}} to Array Variable {{var}}",
|
||||
v2PopArrayVar: "Remove last value from Array Variable and get",
|
||||
v2PopArrayVarDesc: "Remove last value from Array Variable {{var}} => {{outputVar}}",
|
||||
v2ShiftArrayVar: "Remove first value from from Array Variable and get",
|
||||
v2ShiftArrayVarDesc: "Remove first value from Array Variable {{var}} => {{outputVar}}",
|
||||
v2UnshiftArrayVar: "Add to Array Variable as first value",
|
||||
v2UnshiftArrayVarDesc: "Add {{value}} as first value of Array Variable {{var}}",
|
||||
v2SpliceArrayVar: "Add to Array Variable in Index",
|
||||
v2SpliceArrayVarDesc: "Add {{value}} as {{start}} value of Array Variable {{var}}",
|
||||
v2SliceArrayVar: "Slice Array Variable",
|
||||
v2SliceArrayVarDesc: "Slice Array Variable {{var}} from {{start}} to {{end}} => {{outputVar}}",
|
||||
v2GetIndexOfValueInArrayVar: "Get Index of Value in Array Variable",
|
||||
v2GetIndexOfValueInArrayVarDesc: "Get Index of {{value}} in Array Variable {{var}} => {{outputVar}}",
|
||||
v2RemoveIndexFromArrayVar: "Remove Index from Array Variable",
|
||||
v2RemoveIndexFromArrayVarDesc: "Remove Value at Index {{index}} from Array Variable {{var}}",
|
||||
v2ConcatString: "Concatenate Strings",
|
||||
v2ConcatStringDesc: "Concatenate {{source1}} and {{source2}} => {{outputVar}}",
|
||||
v2GetLastUserMessage: "Get Last User Message",
|
||||
v2GetLastUserMessageDesc: "Get Last User Message => {{outputVar}}",
|
||||
v2GetLastCharMessage: "Get Last Character Message",
|
||||
v2GetLastCharMessageDesc: "Get Last Character Message => {{outputVar}}",
|
||||
v2GetFirstMessage: "Get First Message",
|
||||
v2GetFirstMessageDesc: "Get First Message => {{outputVar}}",
|
||||
v2GetAlertInput: "Get Alert Input",
|
||||
v2GetAlertInputDesc: "Get Alert Input => {{outputVar}}",
|
||||
v2UnsupportedTrigger: "Unsupported Trigger",
|
||||
v2UnsupportedTriggerDesc: "Unsupported Trigger",
|
||||
v2GetDisplayState: "Get Display State",
|
||||
v2GetDisplayStateDesc: "Get Display State => {{outputVar}}",
|
||||
v2SetDisplayState: "Set Display State",
|
||||
v2SetDisplayStateDesc: "Set Display State to {{value}}",
|
||||
},
|
||||
|
||||
confirm: "Confirm",
|
||||
goback: "Go Back",
|
||||
botSettings:'Bot Settings',
|
||||
@@ -843,4 +966,22 @@ export const languageEnglish = {
|
||||
showPromptComparison: "Show Prompt Comparison",
|
||||
hypaV3Desc: "HypaMemory V3 is a long-term memory system that use both summarized data and vector search.",
|
||||
inlayErrorResponse: "Inlay Error Response",
|
||||
triggerOn: "Trigger On",
|
||||
noConfig: "No Config",
|
||||
varName: "Variable Name",
|
||||
var: "Variable",
|
||||
condition: "Condition",
|
||||
trigger: "Trigger",
|
||||
outputVar: "Output Variable",
|
||||
source: "Source",
|
||||
cmd: "Command",
|
||||
sysStart: "System Start",
|
||||
sysHistoryEnd: "System History End",
|
||||
sysPromptEnd: "System Prompt End",
|
||||
target: "Target",
|
||||
addElse: "Add Else",
|
||||
min: "Min",
|
||||
max: "Max",
|
||||
delimiter: "Delimiter",
|
||||
deleteCount: "Delete Count",
|
||||
}
|
||||
136
src/lang/ko.ts
136
src/lang/ko.ts
@@ -191,6 +191,128 @@ export const languageKorean = {
|
||||
"finallyOption2Desc": "이것은 고급 도구를 비활성화하며, UI를 더 간단하게 만듭니다. 신규 사용자에게 추천합니다.",
|
||||
"openAIProvider": "OpenAI GPT는 가장 좋은 모델이지만, 유료고 검열이 있습니다."
|
||||
},
|
||||
"triggerDesc": {
|
||||
"v2Header": "헤더",
|
||||
"v2HeaderDesc": "헤더",
|
||||
"v2If": "만약 ~이라면",
|
||||
"v2IfDesc": "만약 {{source}} {{condition}} {{target}} 이라면",
|
||||
"v2Else": "아닐 경우",
|
||||
"v2ElseDesc": "아닐 경우",
|
||||
"v2EndIndent": "들여쓰기 끝",
|
||||
"v2EndIndentDesc": "들여쓰기 끝",
|
||||
"v2SetVar": "변수 설정",
|
||||
"v2SetVarDesc": "변수 {{var}} {{operator}} {{value}}",
|
||||
"v2Loop": "계속 반복하기",
|
||||
"v2LoopDesc": "계속 반복하기",
|
||||
"v2BreakLoop": "반복 중단",
|
||||
"v2BreakLoopDesc": "반복 중단",
|
||||
"v2RunTrigger": "트리거 실행",
|
||||
"v2RunTriggerDesc": "트리거 {{target}} 실행",
|
||||
"v2ConsoleLog": "콘솔 로그",
|
||||
"v2ConsoleLogDesc": "{{source}}를 로그에 출력",
|
||||
"v2StopTrigger": "트리거 중단",
|
||||
"v2StopTriggerDesc": "트리거 중단",
|
||||
"v2CutChat": "대화 부분 잘라내기",
|
||||
"v2CutChatDesc": "{{start}}에서 {{end}}까지 대화 잘라내기",
|
||||
"v2ModifyChat": "대화 수정",
|
||||
"v2ModifyChatDesc": "인덱스 {{index}}에 있는 대화를 {{value}}로 수정",
|
||||
"v2SystemPrompt": "시스템 프롬프트 추가",
|
||||
"v2SystemPromptDesc": "{{location}}에 시스템 프롬프트 {{value}} 추가",
|
||||
"v2Impersonate": "대화 보내기",
|
||||
"v2ImpersonateDesc": "{{role}} 대화 {{value}} 보내기",
|
||||
"v2Command": "명령 실행",
|
||||
"v2CommandDesc": "{{value}} 명령 실행",
|
||||
"v2SendAIprompt": "AI 프롬프트 전송",
|
||||
"v2SendAIpromptDesc": "AI 프롬프트 전송",
|
||||
"v2ImgGen": "이미지 생성",
|
||||
"v2ImgGenDesc": "{{value}} 프롬프트로 이미지 생성 => {{outputVar}}",
|
||||
"v2CheckSimilarity": "유사도 확인",
|
||||
"v2CheckSimilarityDesc": "{{source}}와 {{value}}의 유사도 확인 => {{outputVar}}",
|
||||
"v2RunLLM": "모델 실행",
|
||||
"v2RunLLMDesc": "{{value}}을 모델에 요청 => {{outputVar}}",
|
||||
"v2ShowAlert": "알림 표시",
|
||||
"v2ShowAlertDesc": "{{value}}로 알림 표시",
|
||||
"v2ExtractRegex": "정규식 추출",
|
||||
"v2ExtractRegexDesc": "{{value}}에서 정규식 {{regexType}} {{regex}} 및 플래그 {{flagsType}} {{flags}}를 사용하여 텍스트 추출, 결과를 {{resultType}} {{result}}로 저장 => {{outputVar}}",
|
||||
"v2GetLastMessage": "마지막 메시지 가져오기",
|
||||
"v2GetLastMessageDesc": "마지막 메시지 가져오기 => {{outputVar}}",
|
||||
"v2GetMessageAtIndex": "인덱스에서 메시지 가져오기",
|
||||
"v2GetMessageAtIndexDesc": "인덱스 {{index}}에서 메시지 가져오기 => {{outputVar}}",
|
||||
"v2GetMessageCount": "메시지 개수 가져오기",
|
||||
"v2GetMessageCountDesc": "메시지 개수 가져오기 => {{outputVar}}",
|
||||
"v2GetLorebook": "로어북 가져오기",
|
||||
"v2GetLorebookDesc": "로어북 {{target}} 가져오기 => {{outputVar}}",
|
||||
"v2GetLorebookCount": "로어북 개수 가져오기",
|
||||
"v2GetLorebookCountDesc": "로어북 개수 가져오기 => {{outputVar}}",
|
||||
"v2GetLorebookEntry": "인덱스에서 로어북 가져오기",
|
||||
"v2GetLorebookEntryDesc": "인덱스 {{index}}에 있는 로어북 가져오기 => {{outputVar}}",
|
||||
"v2SetLorebookActivation": "로어북 활성화 설정",
|
||||
"v2SetLorebookActivationDesc": "인덱스 {{index}}에 있는 로어북의 활성화 상태를 {{value}}로 설정",
|
||||
"v2GetLorebookIndexViaName": "이름으로 로어북 인덱스 가져오기",
|
||||
"v2GetLorebookIndexViaNameDesc": "이름 {{name}}인 로어북의 인덱스 가져오기 => {{outputVar}}",
|
||||
"v2ModifyLorebook": "로어북 수정",
|
||||
"v2ModifyLorebookDesc": "로어북 {{target}}을 {{value}}로 수정",
|
||||
"v2LoopNTimes": "N번 반복하기",
|
||||
"v2LoopNTimesDesc": "{{value}} 번 반복하기",
|
||||
"v2Random": "랜덤",
|
||||
"v2RandomDesc": "{{min}}에서 {{max}}까지의 랜덤 값 => {{outputVar}}",
|
||||
"v2GetCharAt": "문자열에서 N번째 문자 가져오기",
|
||||
"v2GetCharAtDesc": "{{source}}의 {{index}}번째 문자 가져오기 => {{outputVar}}",
|
||||
"v2GetCharCount": "문자 개수 가져오기",
|
||||
"v2GetCharCountDesc": "{{source}}의 문자 개수 가져오기 => {{outputVar}}",
|
||||
"v2ToLowerCase": "소문자로 변환",
|
||||
"v2ToLowerCaseDesc": "{{source}}를 소문자로 변환 => {{outputVar}}",
|
||||
"v2ToUpperCase": "대문자로 변환",
|
||||
"v2ToUpperCaseDesc": "{{source}}를 대문자로 변환 => {{outputVar}}",
|
||||
"v2SetCharAt": "문자열의 N번째 문자 변경",
|
||||
"v2SetCharAtDesc": "{{source}}의 {{index}}번째 문자를 {{value}}로 변경 => {{outputVar}}",
|
||||
"v2SplitString": "문자열 분할",
|
||||
"v2SplitStringDesc": "{{source}}를 {{delimiter}}로 분할 => {{outputVar}}",
|
||||
"v2GetCharacterDesc": "캐릭터 설명 가져오기",
|
||||
"v2GetCharacterDescDesc": "캐릭터 설명 가져오기 => {{outputVar}}",
|
||||
"v2SetCharacterDesc": "캐릭터 설명 설정",
|
||||
"v2SetCharacterDescDesc": "캐릭터 설명을 {{value}}로 설정",
|
||||
"v2MakeArrayVar": "배열 변수 생성",
|
||||
"v2MakeArrayVarDesc": "배열 변수 {{var}} 생성",
|
||||
"v2GetArrayVarLength": "배열 변수 길이 가져오기",
|
||||
"v2GetArrayVarLengthDesc": "배열 변수 {{var}}의 길이 가져오기 => {{outputVar}}",
|
||||
"v2GetArrayVar": "배열 변수 가져오기",
|
||||
"v2GetArrayVarDesc": "배열 변수 {{var}}의 {{index}}번째 값 가져오기 => {{outputVar}}",
|
||||
"v2SetArrayVar": "배열 변수 설정",
|
||||
"v2SetArrayVarDesc": "배열 변수 {{var}}의 {{index}}번째 값을 {{value}}로 설정",
|
||||
"v2PushArrayVar": "배열 변수 가장 뒤에 값 추가",
|
||||
"v2PushArrayVarDesc": "배열 변수 {{var}} 의 가장 뒤에 {{value}} 추가",
|
||||
"v2PopArrayVar": "배열 변수에서 마지막 값 제거 후 가져오기",
|
||||
"v2PopArrayVarDesc": "배열 변수 {{var}}에서 마지막 값 제거 => {{outputVar}}",
|
||||
"v2ShiftArrayVar": "배열 변수에서 첫 값 제거 후 가져오기",
|
||||
"v2ShiftArrayVarDesc": "배열 변수 {{var}}에서 첫 값 제거 => {{outputVar}}",
|
||||
"v2UnshiftArrayVar": "배열 변수에 첫 값 추가",
|
||||
"v2UnshiftArrayVarDesc": "배열 변수 {{var}}에 {{value}} 첫 값으로 추가",
|
||||
"v2SpliceArrayVar": "배열 변수 가운데에 값 추가",
|
||||
"v2SpliceArrayVarDesc": "배열 변수 {{var}}의 {{start}}에 {{item}} 추가",
|
||||
"v2SliceArrayVar": "배열 변수 슬라이스",
|
||||
"v2SliceArrayVarDesc": "배열 변수 {{var}}의 {{start}}부터 {{end}}까지 슬라이스 => {{outputVar}}",
|
||||
"v2GetIndexOfValueInArrayVar": "배열 변수에서 값의 인덱스 가져오기",
|
||||
"v2GetIndexOfValueInArrayVarDesc": "배열 변수 {{var}}에서 값 {{value}}의 인덱스 가져오기 => {{outputVar}}",
|
||||
"v2RemoveIndexFromArrayVar": "배열 변수에서 인덱스에 있는 값 제거",
|
||||
"v2RemoveIndexFromArrayVarDesc": "배열 변수 {{var}}에서 인덱스 {{index}} 에 있는 값 제거",
|
||||
"v2ConcatString": "문자열 합치기",
|
||||
"v2ConcatStringDesc": "{{source1}}와 {{source2}}를 합치기 => {{outputVar}}",
|
||||
"v2GetLastUserMessage": "마지막 유저 메시지 가져오기",
|
||||
"v2GetLastUserMessageDesc": "마지막 유저 메시지 가져오기 => {{outputVar}}",
|
||||
"v2GetLastCharMessage": "마지막 캐릭터 메시지 가져오기",
|
||||
"v2GetLastCharMessageDesc": "마지막 캐릭터 메시지 가져오기 => {{outputVar}}",
|
||||
"v2GetFirstMessage": "첫 메시지 가져오기",
|
||||
"v2GetFirstMessageDesc": "첫 메시지 가져오기 => {{outputVar}}",
|
||||
"v2GetAlertInput": "알림 입력창",
|
||||
"v2GetAlertInputDesc": "알림 입력창 => {{outputVar}}",
|
||||
"v2UnsupportedTrigger": "미지원 트리거",
|
||||
"v2UnsupportedTriggerDesc": "지원되지 않는 트리거",
|
||||
"v2SetDisplayState": "디스플레이 바꾸기",
|
||||
"v2SetDisplayStateDesc": "디스플레이 상태를 {{value}}로 설정",
|
||||
"v2GetDisplayState": "현재 디스플레이 데이터 가져오기",
|
||||
"v2GetDisplayStateDesc": "현재 디스플레이 테이터 가져오기 => {{outputVar}}",
|
||||
},
|
||||
"confirm": "확인",
|
||||
"goback": "뒤로",
|
||||
"botSettings": "봇 설정",
|
||||
@@ -767,4 +889,18 @@ export const languageKorean = {
|
||||
"translateBeforeHTMLFormatting": "HTML 포맷 전 번역",
|
||||
"retranslate": "다시 번역",
|
||||
"loading": "로딩중",
|
||||
"triggerOn": "활성화 조건",
|
||||
"noConfig": "설정 없음",
|
||||
"varName": "변수 이름",
|
||||
"var": "변수",
|
||||
"condition": "조건",
|
||||
"trigger": "트리거",
|
||||
"outputVar": "출력 변수",
|
||||
"source": "출처",
|
||||
"cmd": "명령어",
|
||||
"sysStart": "시스템 시작",
|
||||
"sysHistoryEnd": "시스템 히스토리 끝",
|
||||
"sysPromptEnd": "시스템 프롬프트 끝",
|
||||
"target": "목표",
|
||||
"addElse": "그 외에 경우 추가",
|
||||
}
|
||||
@@ -103,7 +103,21 @@
|
||||
<span>{language.regexScript}</span>
|
||||
</button>
|
||||
<button onclick={() => {
|
||||
currentModule.trigger ??= []
|
||||
currentModule.trigger ??= [{
|
||||
comment: "",
|
||||
type: "manual",
|
||||
conditions: [],
|
||||
effect: [{
|
||||
type: "v2Header",
|
||||
code: "",
|
||||
indent: 0
|
||||
}]
|
||||
}, {
|
||||
comment: "New Event",
|
||||
type: 'manual',
|
||||
conditions: [],
|
||||
effect: []
|
||||
}]
|
||||
submenu = 3
|
||||
}} class="p-2 flex-1 border-r border-darkborderc" class:bg-darkbutton={submenu === 3}>
|
||||
<span>{language.triggerScript}</span>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
import { openURL } from "src/ts/globalApi.svelte";
|
||||
import { hubURL } from "src/ts/characterCards";
|
||||
import { PlusIcon } from "lucide-svelte";
|
||||
import TriggerV2List from "./TriggerList2.svelte";
|
||||
interface Props {
|
||||
value?: triggerscript[];
|
||||
lowLevelAble?: boolean;
|
||||
@@ -76,23 +77,49 @@
|
||||
</script>
|
||||
|
||||
<div class="flex items-start mt-2 gap-2">
|
||||
{#if value?.[0]?.effect?.[0]?.type !== 'triggercode' && value?.[0]?.effect?.[0]?.type !== 'triggerlua' && value?.[0]?.effect?.[0]?.type !== 'v2Header' }
|
||||
<button class="bg-bgcolor py-1 rounded-md text-sm px-2" class:ring-1={true} onclick={(async (e) => {
|
||||
e.stopPropagation()
|
||||
const codeType = value?.[0]?.effect?.[0]?.type
|
||||
if(codeType === 'triggercode' || codeType === 'triggerlua' || codeType === 'v2Header'){
|
||||
const codeTrigger = value?.[0]?.effect?.[0]?.code
|
||||
if(codeTrigger){
|
||||
const t = await alertConfirm(language.triggerSwitchWarn)
|
||||
if(!t){
|
||||
return
|
||||
}
|
||||
}
|
||||
value = []
|
||||
}
|
||||
})}>V1</button>
|
||||
{/if}
|
||||
<button class="bg-bgcolor py-1 rounded-md text-sm px-2" class:ring-1={
|
||||
value?.[0]?.effect?.[0]?.type !== 'triggercode' &&
|
||||
value?.[0]?.effect?.[0]?.type !== 'triggerlua'
|
||||
value?.[0]?.effect?.[0]?.type === 'v2Header'
|
||||
} onclick={(async (e) => {
|
||||
e.stopPropagation()
|
||||
const codeType = value?.[0]?.effect?.[0]?.type
|
||||
if(codeType === 'triggercode' || codeType === 'triggerlua'){
|
||||
const codeTrigger = value?.[0]?.effect?.[0]?.code
|
||||
if(codeTrigger){
|
||||
const t = await alertConfirm(language.triggerSwitchWarn)
|
||||
if(!t){
|
||||
return
|
||||
}
|
||||
if(codeType !== 'v2Header'){
|
||||
const t = await alertConfirm(language.triggerSwitchWarn)
|
||||
if(!t){
|
||||
return
|
||||
}
|
||||
value = []
|
||||
value = [{
|
||||
comment: "",
|
||||
type: "manual",
|
||||
conditions: [],
|
||||
effect: [{
|
||||
type: "v2Header",
|
||||
code: "",
|
||||
indent: 0
|
||||
}]
|
||||
}, {
|
||||
comment: "New Event",
|
||||
type: 'manual',
|
||||
conditions: [],
|
||||
effect: []
|
||||
}]
|
||||
}
|
||||
})}>{language.blockMode}</button>
|
||||
})}>V2</button>
|
||||
<button class="bg-bgcolor py-1 rounded-md text-sm px-2" class:ring-1={value?.[0]?.effect?.[0]?.type === 'triggerlua'} onclick={(async (e) => {
|
||||
e.stopPropagation()
|
||||
if(value?.[0]?.effect?.[0]?.type !== 'triggerlua'){
|
||||
@@ -119,19 +146,23 @@
|
||||
<Button onclick={() => {
|
||||
openURL(hubURL + '/redirect/docs/lua')
|
||||
}}>{language.helpBlock}</Button>
|
||||
{:else if value?.[0]?.effect?.[0]?.type === 'v2Header'}
|
||||
<TriggerV2List bind:value={value} lowLevelAble={lowLevelAble}/>
|
||||
{:else}
|
||||
{#key sorted}
|
||||
<div class="contain w-full max-w-full mt-2 flex flex-col p-3 border-selected border-1 bg-darkbg rounded-md" bind:this={ele}>
|
||||
<div
|
||||
class="contain w-full max-w-full mt-2 flex flex-col border-selected border-1 bg-darkbg rounded-md p-3" bind:this={ele}
|
||||
>
|
||||
{#if value.length === 0}
|
||||
<div class="text-textcolor2">No Scripts</div>
|
||||
<div class="text-textcolor2">No Scripts</div>
|
||||
{/if}
|
||||
{#each value as triggerscript, i}
|
||||
<TriggerData idx={i} bind:value={value[i]} lowLevelAble={lowLevelAble} onOpen={onOpen} onClose={onClose} onRemove={() => {
|
||||
let triggerscript = value
|
||||
triggerscript.splice(i, 1)
|
||||
value = triggerscript
|
||||
}}/>
|
||||
{/each}
|
||||
{#each value as triggerscript, i}
|
||||
<TriggerData idx={i} bind:value={value[i]} lowLevelAble={lowLevelAble} onOpen={onOpen} onClose={onClose} onRemove={() => {
|
||||
let triggerscript = value
|
||||
triggerscript.splice(i, 1)
|
||||
value = triggerscript
|
||||
}}/>
|
||||
{/each}
|
||||
</div>
|
||||
<button class="font-medium cursor-pointer hover:text-textcolor mb-2 text-textcolor2" onclick={() => {
|
||||
value.push({
|
||||
|
||||
1502
src/lib/SideBars/Scripts/TriggerList2.svelte
Normal file
1502
src/lib/SideBars/Scripts/TriggerList2.svelte
Normal file
File diff suppressed because it is too large
Load Diff
24
src/lib/UI/GUI/Portal.svelte
Normal file
24
src/lib/UI/GUI/Portal.svelte
Normal file
@@ -0,0 +1,24 @@
|
||||
<script lang="ts">
|
||||
import { getAllContexts, mount, unmount } from "svelte";
|
||||
//@ts-ignore
|
||||
import PortalConsumer from "./PortalConsumer.svelte";
|
||||
|
||||
interface Props {
|
||||
target?: HTMLElement;
|
||||
children: any;
|
||||
}
|
||||
|
||||
const { target: target = document.body, children }:Props = $props();
|
||||
|
||||
const context = getAllContexts();
|
||||
|
||||
let instance;
|
||||
|
||||
$effect(() => {
|
||||
instance = mount(PortalConsumer, { target, props: { children }, context })
|
||||
|
||||
return () => {
|
||||
unmount(instance);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
7
src/lib/UI/GUI/PortalConsumer.svelte
Normal file
7
src/lib/UI/GUI/PortalConsumer.svelte
Normal file
@@ -0,0 +1,7 @@
|
||||
<script lang="ts">
|
||||
const { children } = $props();
|
||||
</script>
|
||||
|
||||
{#if children}
|
||||
{@render children()}
|
||||
{/if}
|
||||
@@ -607,7 +607,21 @@ export function createBlankChar():character{
|
||||
scenario:"",
|
||||
firstMsgIndex: -1,
|
||||
replaceGlobalNote: "",
|
||||
triggerscript: [],
|
||||
triggerscript: [{
|
||||
comment: "",
|
||||
type: "manual",
|
||||
conditions: [],
|
||||
effect: [{
|
||||
type: "v2Header",
|
||||
code: "",
|
||||
indent: 0
|
||||
}]
|
||||
}, {
|
||||
comment: "New Event",
|
||||
type: 'manual',
|
||||
conditions: [],
|
||||
effect: []
|
||||
}],
|
||||
additionalText: ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -684,7 +684,7 @@ export async function runLuaEditTrigger<T extends any>(char:character|groupChat|
|
||||
}
|
||||
}
|
||||
|
||||
export async function runLuaButtonTrigger(char:character|groupChat|simpleCharacterArgument, data:string):Promise<T>{
|
||||
export async function runLuaButtonTrigger(char:character|groupChat|simpleCharacterArgument, data:string):Promise<any>{
|
||||
let runResult
|
||||
try {
|
||||
const triggers = char.type === 'group' ? getModuleTriggers() : char.triggerscript.concat(getModuleTriggers())
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import { get } from "svelte/store";
|
||||
import { CharEmotion, selectedCharID } from "../stores.svelte";
|
||||
import { type character, type customscript, type groupChat, type Database, getDatabase } from "../storage/database.svelte";
|
||||
import { type character, type customscript, type groupChat, type Database, getDatabase, getCurrentCharacter, getCurrentChat } from "../storage/database.svelte";
|
||||
import { downloadFile } from "../globalApi.svelte";
|
||||
import { alertError, alertNormal } from "../alert";
|
||||
import { language } from "src/lang";
|
||||
import { selectSingleFile } from "../util";
|
||||
import { assetRegex, type CbsConditions, risuChatParser as risuChatParserOrg, type simpleCharacterArgument } from "../parser.svelte";
|
||||
import { getModuleAssets, getModuleRegexScripts } from "./modules";
|
||||
import { getModuleAssets, getModuleRegexScripts, getModuleTriggers } from "./modules";
|
||||
import { HypaProcesser } from "./memory/hypamemory";
|
||||
import { runLuaEditTrigger } from "./lua";
|
||||
import { pluginV2 } from "../plugins/plugins";
|
||||
import { runTrigger } from "./triggers";
|
||||
|
||||
const dreg = /{{data}}/g
|
||||
const randomness = /\|\|\|/g
|
||||
@@ -104,6 +105,22 @@ export async function processScriptFull(char:character|groupChat|simpleCharacter
|
||||
let emoChanged = false
|
||||
const scripts = (db.presetRegex ?? []).concat(char.customscript).concat(getModuleRegexScripts())
|
||||
data = await runLuaEditTrigger(char, mode, data)
|
||||
|
||||
if(mode === 'editdisplay'){
|
||||
const currentChar = getCurrentCharacter()
|
||||
if(currentChar.type !== 'group'){
|
||||
const perf = performance.now()
|
||||
const d = await runTrigger(currentChar, 'display', {
|
||||
chat: getCurrentChat(),
|
||||
displayMode: true,
|
||||
displayData: data
|
||||
})
|
||||
|
||||
data = d.displayData
|
||||
console.log('Trigger time', performance.now() - perf)
|
||||
}
|
||||
}
|
||||
|
||||
if(pluginV2[mode].size > 0){
|
||||
for(const plugin of pluginV2[mode]){
|
||||
const res = await plugin(data)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1013,5 +1013,6 @@ export function parseKeyValue(template:string){
|
||||
|
||||
export const sortableOptions = {
|
||||
delay: 300, // time in milliseconds to define when the sorting should start
|
||||
delayOnTouchOnly: true
|
||||
delayOnTouchOnly: true,
|
||||
filter: '.no-sort',
|
||||
} as const
|
||||
@@ -46,6 +46,8 @@ export default {
|
||||
width: {
|
||||
'2xl': '48rem',
|
||||
'3xl': '72rem',
|
||||
'4xl': 'var(--container-4xl);',
|
||||
'7xl': '1280px',
|
||||
'110': '28rem',
|
||||
'124': '32rem',
|
||||
'138': '36rem',
|
||||
|
||||
Reference in New Issue
Block a user