From 90a3a2171a51a9dab78f69c09b7913641d2ba753 Mon Sep 17 00:00:00 2001 From: Misaka Mikoto <117180744+Railgun19457@users.noreply.github.com> Date: Sat, 30 May 2026 22:13:09 +0800 Subject: [PATCH] fix: Template config optimization (#8228) * fix: improve template list config handling * feat(webui): show template list display item * feat(webui): allow hiding template list hints * docs: document template list metadata fields * fix: support file fields in template list configs --- astrbot/dashboard/routes/config.py | 2 +- astrbot/dashboard/routes/util.py | 21 ++++- .../src/components/shared/AstrBotConfigV4.vue | 50 +++++++++-- .../components/shared/TemplateListEditor.vue | 56 +++++++++++- docs/en/dev/star/guides/plugin-config.md | 13 +++ docs/zh/dev/star/guides/plugin-config.md | 13 +++ tests/unit/test_dashboard_util.py | 88 +++++++++++++++++++ 7 files changed, 230 insertions(+), 13 deletions(-) create mode 100644 tests/unit/test_dashboard_util.py diff --git a/astrbot/dashboard/routes/config.py b/astrbot/dashboard/routes/config.py index 9ec24d254..3c37a2b78 100644 --- a/astrbot/dashboard/routes/config.py +++ b/astrbot/dashboard/routes/config.py @@ -95,7 +95,7 @@ def _validate_template_list(value, meta, path_key, errors, validate_fn) -> None: validate_fn( item, template_meta.get("items", {}), - path=f"{item_path}.", + path=f"{path_key}.templates.{template_key}.", ) diff --git a/astrbot/dashboard/routes/util.py b/astrbot/dashboard/routes/util.py index 105619815..d08af03ee 100644 --- a/astrbot/dashboard/routes/util.py +++ b/astrbot/dashboard/routes/util.py @@ -16,6 +16,7 @@ def get_schema_item(schema: dict | None, key_path: str) -> dict | None: 同时支持: - 扁平 schema(直接 key 命中) - 嵌套 object schema({type: "object", items: {...}}) + - template_list schema(.templates.