Skip to content

Commit ac515d9

Browse files
docs: add slider key to plugin dev docs (#10289)
* docs: add slider key to plugin dev docs * Update docs/en/dev/star/guides/plugin-config.md Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
1 parent 6d50e1e commit ac515d9

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

‎docs/en/dev/star/guides/plugin-config.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Plugin Configuration
32

43
As plugin functionality grows, you may need to define configurations to allow users to customize plugin behavior.
@@ -53,6 +52,7 @@ The file content is a `Schema` that represents the configuration. The Schema is
5352
- `invisible`: Optional. Whether the configuration is hidden. Default is `false`. If set to `true`, it will not be displayed in the management panel.
5453
- `secret`: Optional. Applies to `string` and string `list` fields. When set to `true`, the dashboard displays a password input and lets the user temporarily reveal its value. This only masks the value in the UI; it does not encrypt the value in the configuration file.
5554
- `options`: Optional. A list, such as `"options": ["chat", "agent", "workflow"]`. Provides dropdown list options.
55+
- `slider`: Optional. Applies to `int` and `float` fields. A dict,such as `"slider": {"min": 1, "max": 100, "step": 1}`. Displays a slider with configurable minimum, maximum, and step values.
5656
- `editor_mode`: Optional. Whether to enable code editor mode. Requires AstrBot >= `v3.5.10`. Versions below this won't report errors but won't take effect. Default is false.
5757
- `editor_language`: Optional. The code language for the code editor, defaults to `json`.
5858
- `editor_theme`: Optional. The theme for the code editor. Options are `vs-light` (default) and `vs-dark`.
@@ -238,7 +238,6 @@ Templates also support these optional fields:
238238

239239
<img width="1000" alt="image" src="https://github.com/user-attachments/assets/74876d30-11a4-491b-a7a0-8ebe8d603782" />
240240

241-
242241
## Using Configuration in Plugins
243242

244243
When loading plugins, AstrBot will check if there's a `_conf_schema.json` file in the plugin directory. If it exists, it will automatically parse the configuration and save it under `data/config/<plugin_name>_config.json` (a configuration file entity created according to the Schema), and pass it to `__init__()` when instantiating the plugin class.

‎docs/zh/dev/star/guides/plugin-config.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# 插件配置
32

43
随着插件功能的增加,可能需要定义一些配置以让用户自定义插件的行为。
@@ -53,6 +52,7 @@ AstrBot 提供了“强大”的配置解析和可视化功能。能够让用户
5352
- `invisible`: 可选。配置是否隐藏。默认是 `false`。如果设置为 `true`,则不会在管理面板上显示。
5453
- `secret`: 可选。仅对 `string` 和字符串 `list` 生效。设置为 `true` 时,管理面板会以密码输入框展示,并允许用户临时切换可见状态。此选项只遮罩界面显示,不会加密配置文件中的值。
5554
- `options`: 可选。一个列表,如 `"options": ["chat", "agent", "workflow"]`。提供下拉列表可选项。
55+
- `slider`: 可选。仅对 `int` 和 `float` 生效。一个字典,如 `"slider": {"min": 1, "max": 100, "step": 1}`。提供一个含有上下限和一定步长的滑动列表。
5656
- `editor_mode`: 可选。是否启用代码编辑器模式。需要 AstrBot >= `v3.5.10`, 低于这个版本不会报错,但不会生效。默认是 false。
5757
- `editor_language`: 可选。代码编辑器的代码语言,默认为 `json`。
5858
- `editor_theme`: 可选。代码编辑器的主题,可选值有 `vs-light`(默认), `vs-dark`。

0 commit comments

Comments
 (0)