Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions en/dev/star/guides/plugin-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The file content is a `Schema` that represents the configuration. The Schema is
}
```

- `type`: **Required**. The type of the configuration. Supports `string`, `text`, `int`, `float`, `bool`, `object`, `list`, `dict`, `template_list`, `file`. When the type is `text`, it will be visualized as a larger resizable textarea component to accommodate large text.
- `type`: **Required**. The type of the configuration. Supports `string`, `text`, `int`, `float`, `bool`, `object`, `list`, `dict`, `template_list`, `file`, `palette`, `palette_rgb`, `palette_hsv`. When the type is `text`, it will be visualized as a larger resizable textarea component to accommodate large text.
- `description`: Optional. Description of the configuration. A one-sentence description of the configuration's behavior is recommended.
- `hint`: Optional. Hint information for the configuration, displayed in the question mark button on the right in the image above, shown when hovering over it.
- `obvious_hint`: Optional. Whether the configuration hint should be prominently displayed, like `token` in the image above.
Expand Down Expand Up @@ -81,6 +81,16 @@ Introduced in v4.13.0, this allows plugins to define file-upload configuration i
}
```

### Palette Type

Used for color selection. Supports three types:

- `palette`: HEX format (e.g., `#FFFFFF`).
- `palette_rgb`: RGB format (e.g., `rgb(255, 255, 255)`).
- `palette_hsv`: HSV format (e.g., `hsv(0, 0%, 100%)`).

In the WebUI, it will be presented as a color preview block and an input field. Clicking the preview block opens a color picker.

### `dict` type schema

Used to visualize editing a Python `dict` type configuration. For example, AstrBot Core's custom extra body parameter configuration:
Expand Down Expand Up @@ -209,4 +219,4 @@ class ConfigPlugin(Star):

## Configuration Updates

When you update the Schema across different versions, AstrBot will recursively inspect the configuration items in the Schema, automatically adding default values for missing items and removing those that no longer exist.
When you update the Schema across different versions, AstrBot will recursively inspect the configuration items in the Schema, automatically adding default values for missing items and removing those that no longer exist.
14 changes: 12 additions & 2 deletions zh/dev/star/guides/plugin-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ AstrBot 提供了”强大“的配置解析和可视化功能。能够让用户
}
```

- `type`: **此项必填**。配置的类型。支持 `string`, `text`, `int`, `float`, `bool`, `object`, `list`, `dict`, `template_list`。当类型为 `text` 时,将会可视化为一个更大的可拖拽宽高的 textarea 组件,以适应大文本。
- `type`: **此项必填**。配置的类型。支持 `string`, `text`, `int`, `float`, `bool`, `object`, `list`, `dict`, `template_list`, `file`, `palette`, `palette_rgb`, `palette_hsv`。当类型为 `text` 时,将会可视化为一个更大的可拖拽宽高的 textarea 组件,以适应大文本。
- `description`: 可选。配置的描述。建议一句话描述配置的行为。
- `hint`: 可选。配置的提示信息,表现在上图中右边的问号按钮,当鼠标悬浮在问号按钮上时显示。
- `obvious_hint`: 可选。配置的 hint 是否醒目显示。如上图的 `token`。
- `default`: 可选。配置的默认值。如果用户没有配置,将使用默认值。int 是 0,float 是 0.0,bool 是 False,string 是 "",object 是 {},list 是 []。
- `items`: 可选。如果配置的类型是 `object`,需要添加 `items` 字段。`items` 的内容是这个配置项的子 Schema。理论上可以无限嵌套,但是不建议过多嵌套。
- `items`: 可选。如果配置的类型是 `object`,需要添加 `items` 字段。`items` 的内容是 this 配置项的子 Schema。理论上可以无限嵌套,但是不建议过多嵌套。
- `invisible`: 可选。配置是否隐藏。默认是 `false`。如果设置为 `true`,则不会在管理面板上显示。
- `options`: 可选。一个列表,如 `"options": ["chat", "agent", "workflow"]`。提供下拉列表可选项。
- `editor_mode`: 可选。是否启用代码编辑器模式。需要 AstrBot >= `v3.5.10`, 低于这个版本不会报错,但不会生效。默认是 false。
Expand Down Expand Up @@ -81,6 +81,16 @@ AstrBot 提供了”强大“的配置解析和可视化功能。能够让用户
}
```

### 调色板类型 (Palette)

用于选择颜色。支持以下三种类型:

- `palette`: HEX 格式(如 `#FFFFFF`)。
- `palette_rgb`: RGB 格式(如 `rgb(255, 255, 255)`)。
- `palette_hsv`: HSV 格式(如 `hsv(0, 0%, 100%)`)。

在 WebUI 中将呈现为一个颜色预览块和输入框,点击预览块可打开调色板进行选择。

### dict 类型的 schema

用于可视化编辑一个 Python 的 dict 类型的配置。如 AstrBot Core 中的自定义请求体参数配置项:
Expand Down