feat: add Lua help

This commit is contained in:
kwaroran
2024-06-29 18:21:08 +09:00
parent 95452921fe
commit 18ad143371
2 changed files with 13 additions and 6 deletions

View File

@@ -131,7 +131,8 @@ export const languageEnglish = {
defaultVariables: "Here you can define your own default variables. use `<variable name>=<variable value>` 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.", defaultVariables: "Here you can define your own default variables. use `<variable name>=<variable value>` 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.", 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\`\`\`", 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: { setup: {
chooseProvider: "Choose AI Provider", 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?", triggerSwitchWarn: "If you change the trigger type, current triggers will be lost. do you want to continue?",
codeMode: "Code", codeMode: "Code",
blockMode: "Block", blockMode: "Block",
helpBlock: "Help",
} }

View File

@@ -7,15 +7,15 @@
import Check from "../UI/GUI/CheckInput.svelte"; import Check from "../UI/GUI/CheckInput.svelte";
import { addCharEmotion, addingEmotion, getCharImage, rmCharEmotion, selectCharImg, makeGroupImage, removeChar, changeCharImage } from "../../ts/characters"; import { addCharEmotion, addingEmotion, getCharImage, rmCharEmotion, selectCharImg, makeGroupImage, removeChar, changeCharImage } from "../../ts/characters";
import LoreBook from "./LoreBook/LoreBookSetting.svelte"; 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 BarIcon from "./BarIcon.svelte";
import { findCharacterbyId, getAuthorNoteDefaultText, parseKeyValue, selectMultipleFile } from "../../ts/util"; import { findCharacterbyId, getAuthorNoteDefaultText, parseKeyValue, selectMultipleFile } from "../../ts/util";
import { onDestroy } from "svelte"; import { onDestroy } from "svelte";
import {isEqual} from 'lodash' import {isEqual} from 'lodash'
import Help from "../Others/Help.svelte"; 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 { 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 { addGroupChar, rmCharFromGroup } from "src/ts/process/group";
import TextInput from "../UI/GUI/TextInput.svelte"; import TextInput from "../UI/GUI/TextInput.svelte";
import NumberInput from "../UI/GUI/NumberInput.svelte"; import NumberInput from "../UI/GUI/NumberInput.svelte";
@@ -638,8 +638,13 @@
} }
}}>Lua</button> }}>Lua</button>
</div> </div>
{#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'}
<TextAreaInput highlight margin="both" autocomplete="off" bind:value={currentChar.data.triggerscript[0].effect[0].code}></TextAreaInput> <TextAreaInput highlight margin="both" autocomplete="off" bind:value={currentChar.data.triggerscript[0].effect[0].code}></TextAreaInput>
{:else if currentChar.data?.triggerscript?.[0]?.effect?.[0]?.type === 'triggerlua'}
<TextAreaInput margin="both" autocomplete="off" bind:value={currentChar.data.triggerscript[0].effect[0].code}></TextAreaInput>
<Button on:click={() => {
openURL(hubURL + '/redirect/docs/lua')
}}>{language.helpBlock}</Button>
{:else} {:else}
<TriggerList bind:value={currentChar.data.triggerscript} lowLevelAble={currentChar.data.lowLevelAccess} /> <TriggerList bind:value={currentChar.data.triggerscript} lowLevelAble={currentChar.data.lowLevelAccess} />
{/if} {/if}