From 18ad14337115593112fba7f6a4fa6bd2553da10e Mon Sep 17 00:00:00 2001 From: kwaroran Date: Sat, 29 Jun 2024 18:21:08 +0900 Subject: [PATCH] feat: add Lua help --- src/lang/en.ts | 4 +++- src/lib/SideBars/CharConfig.svelte | 15 ++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/lang/en.ts b/src/lang/en.ts index 757874d6..95bc5b76 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -131,7 +131,8 @@ export const languageEnglish = { defaultVariables: "Here you can define your own default variables. use `=` format, seperated by newline. for example, `name=RisuAI`, which then can be used with trigger scripts and variables CBS like `{{getvar::A}}`, `{{setvar::A::B}}` or `{{? $A + 1}}`. if prompt template's default variable and character's default variable has same name, character's default variable will be used.", lowLevelAccess: "If enabled, it will enable access to features that requires high computing powers and executing AI model via triggers in the character. do not enable this unless you really need these features.", triggerLLMPrompt: "A prompt that would be sent to the model. you can use multi turns and roles by using `@@role user`, `@@role system`, `@@role assistant`. for example, \n\`\`\`\n@@role system\nrespond as hello\n@@role assistant\nhello\n@@role user\nhi\n\`\`\`", - legacyTranslation: "If enabled, it will use the old translation method, which preprocess markdown and quotes before translations instead of postprocessing after translations." + legacyTranslation: "If enabled, it will use the old translation method, which preprocess markdown and quotes before translations instead of postprocessing after translations.", + luaHelp: "You can use Lua scripts as a trigger script. you can define onInput, onOutput, onStart functions. onInput is called when user sends a message, onOutput is called when character sends a message, onStart is called when the chat starts. for more information, see the documentation.", }, setup: { chooseProvider: "Choose AI Provider", @@ -666,4 +667,5 @@ export const languageEnglish = { triggerSwitchWarn: "If you change the trigger type, current triggers will be lost. do you want to continue?", codeMode: "Code", blockMode: "Block", + helpBlock: "Help", } \ No newline at end of file diff --git a/src/lib/SideBars/CharConfig.svelte b/src/lib/SideBars/CharConfig.svelte index 1fa391d2..8863f8b9 100644 --- a/src/lib/SideBars/CharConfig.svelte +++ b/src/lib/SideBars/CharConfig.svelte @@ -7,15 +7,15 @@ import Check from "../UI/GUI/CheckInput.svelte"; import { addCharEmotion, addingEmotion, getCharImage, rmCharEmotion, selectCharImg, makeGroupImage, removeChar, changeCharImage } from "../../ts/characters"; import LoreBook from "./LoreBook/LoreBookSetting.svelte"; - import { alertConfirm, alertNormal, alertSelectChar, alertTOS, showHypaV2Alert } from "../../ts/alert"; + import { alertConfirm, alertMd, alertNormal, alertSelectChar, alertTOS, showHypaV2Alert } from "../../ts/alert"; import BarIcon from "./BarIcon.svelte"; import { findCharacterbyId, getAuthorNoteDefaultText, parseKeyValue, selectMultipleFile } from "../../ts/util"; import { onDestroy } from "svelte"; import {isEqual} from 'lodash' import Help from "../Others/Help.svelte"; - import { exportChar } from "src/ts/characterCards"; + import { exportChar, hubURL } from "src/ts/characterCards"; import { getElevenTTSVoices, getWebSpeechTTSVoices, getVOICEVOXVoices, oaiVoices, getNovelAIVoices, FixNAITTS } from "src/ts/process/tts"; - import { checkCharOrder, getFileSrc } from "src/ts/storage/globalApi"; + import { checkCharOrder, getFileSrc, openURL } from "src/ts/storage/globalApi"; import { addGroupChar, rmCharFromGroup } from "src/ts/process/group"; import TextInput from "../UI/GUI/TextInput.svelte"; import NumberInput from "../UI/GUI/NumberInput.svelte"; @@ -638,8 +638,13 @@ } }}>Lua - {#if currentChar.data?.triggerscript?.[0]?.effect?.[0]?.type === 'triggercode' || currentChar.data?.triggerscript?.[0]?.effect?.[0]?.type === 'triggerlua'} - + {#if currentChar.data?.triggerscript?.[0]?.effect?.[0]?.type === 'triggercode'} + + {:else if currentChar.data?.triggerscript?.[0]?.effect?.[0]?.type === 'triggerlua'} + + {:else} {/if}