lightboard
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLightboard
Lightboard
Lightboard is a Lua-based auxiliary model request framework for Risuai.
Lightboard是一款基于Lua的、为Risuai打造的辅助模型请求框架。
Risuai
Risuai
Risuai is an open-source LLM chat frontend.
- Persona: User-controlled character.
- Character: In 1:1 chat, the other, LLM-controlled character. In 1:N chat, the Character represents the world itself.
- Lorebooks: May contain everything from world settings and character profiles to meta instructions.
Risuai是一款开源的LLM聊天前端。
- Persona:用户控制的角色。
- Character:在一对一聊天中,由LLM控制的对方角色;在一对多聊天中,Character代表整个世界。
- Lorebooks:可包含从世界设定、角色档案到元指令的各类内容。
Risuai and modules
Risuai与模块
- Toggles
- Lorebooks
- Lua scripts for advanced interactions or editing, called "Trigger scripts"
- Regex scripts for editing input/output/display/request
- Custom CSS wrapped in tags. Restricted: No
style,html, orbodyaccess. Best practice: Prefix all class names.:root
Lua runs first, and then the regexes are evaluated.
List of edits and their execution timing:
- input: Once after user submits their message. Edits the original.
- request: Every time a chat is being sent. Preserves the original.
- output: Once after chat response received. Edits the original.
- display: Every time a chat is being rendered. Preserves the original.
Note: Output edits only apply to chat responses. Lightboard responses are not affected.
- Toggles(开关)
- Lorebooks(设定库)
- 用于高级交互或编辑的Lua脚本,称为「Trigger scripts(触发脚本)」
- 用于编辑输入/输出/显示/请求的正则表达式脚本
- 包裹在标签中的自定义CSS。限制:无法访问
style、html或body元素。最佳实践:为所有类名添加前缀。:root
Lua脚本会先执行,随后再处理正则表达式。
编辑类型及其执行时机:
- input:用户提交消息后执行一次,修改原始内容。
- request:每次发送聊天请求时执行,保留原始内容。
- output:收到聊天响应后执行一次,修改原始内容。
- display:每次渲染聊天内容时执行,保留原始内容。
注意:Output编辑仅适用于聊天响应,Lightboard的响应不受影响。
Toggles
Toggles(开关)
Toggles define module-level user preferences.
{key}={label}[={type}[={opt1,opt2,...}]]type- (omit): Checkbox, '0'|'1'.
- select: Dropdown. Index of the selected option.
- text: Text input. User typed text.
booleanValue=Check Me
selectValue=Select Me=select=opt1,opt2,opt3
textValue=Type Me=textA divider and collapsible groups are also available.
=Collapsible Group=group
=optional label=divider
==groupEndModule toggles appear in the sidebar, so the module does not need to provide an interface for them.
Toggles用于定义模块级别的用户偏好设置。
{key}={label}[={type}[={opt1,opt2,...}]]type- (省略):复选框,取值为'0'或'1'。
- select:下拉菜单,取值为选中选项的索引。
- text:文本输入框,取值为用户输入的文本。
booleanValue=Check Me
selectValue=Select Me=select=opt1,opt2,opt3
textValue=Type Me=text还支持分隔符和可折叠分组:
=Collapsible Group=group
=optional label=divider
==groupEnd模块开关会显示在侧边栏中,因此模块无需自行提供相关界面。
Security concerns
安全注意事项
Do not include external links when rendering HTML. JavaScript is not allowed. UI interaction without scripts is limited to , , and popovers.
<details><input type="checkbox">Use Lua to implement stateful buttons with or and custom handlers that set chat variables. See .
risu-triggerrisu-btnreferences/000-lua.md渲染HTML时请勿包含外部链接。禁止使用JavaScript。无脚本的UI交互仅限、和弹出框。
<details><input type="checkbox">如需实现有状态按钮,请使用Lua结合或以及设置聊天变量的自定义处理器。详情请参阅。
risu-triggerrisu-btnreferences/000-lua.mdAvailable References
可用参考资料
- To understand Risuai's Lua script environment, start with .
references/000-lua.md - To understand Risuai's double-curly-brace templating language for lorebooks, background embeddings, and regex output values, read .
references/000-cbs.md
For a complete Lightboard module development, read .
references/000-lightboard.mdFor a Lightboard Miniboard renderer code, read .
references/000-miniboard-renderer.md- 如需了解Risuai的Lua脚本环境,请从开始阅读。
references/000-lua.md - 如需了解Risuai用于Lorebooks、背景嵌入和正则表达式输出值的双花括号模板语言,请阅读。
references/000-cbs.md
如需完成完整的Lightboard模块开发,请阅读。
references/000-lightboard.md如需查看Lightboard Miniboard渲染器代码,请阅读。
references/000-miniboard-renderer.mdPacking
打包
If the environment has Node.js installed, use to build the final CharX file. See 's for project requirements and structures.
risupackrisupackREADME.mdnpm i risupack
npm risupack build-charx -- my-module/charx.json如果环境中已安装Node.js,请使用构建最终的CharX文件。项目要求和结构请参阅的。
risupackrisupackREADME.mdnpm i risupack
npm risupack build-charx -- my-module/charx.jsonThe CSS
CSS相关
Risuai restricts the selector scope. Do not use , , or selectors. Always select by classes first, then by attributes or states. Prefix all classes with the module identifier (). Never rely on Risuai's built-in classes, such as .
htmlbody:root.{identifier}-{class}.chattextGlobal styles from Risuai or other modules will interfere, especially with font colors. Do not rely on the cascade. Specify every required property.
Risuai限制了选择器的作用域。请勿使用、或选择器。应优先通过类选择,再通过属性或状态选择。为所有类名添加模块标识符前缀()。切勿依赖Risuai的内置类,例如。
htmlbody:root.{identifier}-{class}.chattext来自Risuai或其他模块的全局样式会产生干扰,尤其是字体颜色。请勿依赖样式的层叠特性,务必明确指定所有必需的样式属性。
Axiom of Doubt
怀疑公理
Do not assume anything not provided to you. Question your prior knowledge. Read the necessary resources.
Both Lua and CBS might feel familiar, but they are not.
- Read the Lightboard resource when developing or reviewing a full Lightboard frontend module.
- Read the Lua resource when the task needs Risuai Lua APIs beyond a task-specific reference.
- Read the CBS resource when encountering unfamiliar curly-brace syntax.
请勿假设任何未明确提供的内容。质疑你的既有认知,阅读必要的参考资料。
Lua和CBS可能看起来熟悉,但它们并非你所熟知的技术。
- 开发或审核完整的Lightboard前端模块时,请阅读Lightboard相关资料。
- 当任务需要使用特定参考以外的Risuai Lua API时,请阅读Lua相关资料。
- 遇到不熟悉的花括号语法时,请阅读CBS相关资料。