Skip to content

[Bug] _conf_schema.json 缺少类型校验和文档测试 #8252

@pizeroLOL

Description

@pizeroLOL

What happened / 发生了什么

  1. 没有 "type": "dict"
{
  "test_obj": {
    "type": "dict"
  }
}

- `type`: **此项必填**。配置的类型。支持 `string`, `text`, `int`, `float`, `bool`, `object`, `list`, `dict`, `template_list`。当类型为 `text` 时,将会可视化为一个更大的可拖拽宽高的 textarea 组件,以适应大文本。

日志 ~/Projects/astrbot tags/v4.25.0* 45s astrbot ❯ uv run astrbot run
 ___           _______.___________..______      .______     ______   .___________.
/   \         /       |           ||   _  \     |   _  \   /  __  \  |           |

/ ^ \ | (-------| |----| |) | | |) | | | | | ---| |----
/ /\ \ \ \ | | | / | _ < | | | | | |
/ _____ \ .----) | | | | |\ ----.| |
) | | --' | | | /__/ \__\ |_______/ |__| | _| \.||/ ___/ ||

Welcome to AstrBot CLI!
AstrBot CLI version: 4.25.0
[02:04:02.653] [Core] [DBUG] [platform.register:60]: Platform adapter registered: aiocqhttp
[02:04:02.672] [Core] [DBUG] [platform.register:60]: Platform adapter registered: wecom_ai_bot
[02:04:02.673] [Core] [DBUG] [platform.register:60]: Platform adapter registered: webchat
Dashboard is already up to date
[02:04:02.692] [Core] [DBUG] [core.core_lifecycle:81]: HTTP proxy cleared
[02:04:02.692] [Core] [INFO] [core.core_lifecycle:148]: AstrBot v4.25.0
[02:04:02.733] [Core] [INFO] [core.persona_mgr:38]: Loaded 0 personas.
[02:04:02.736] [Core] [INFO] [star.star_manager:926]: Loading plugin astr_plugin_config_simple ...
[02:04:02.737] [Core] [ERRO] [v4.25.0] [star.star_manager:1214]: ----- 插件 astr_plugin_config_simple 载入失败 -----
[02:04:02.737] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | Traceback (most recent call last):
[02:04:02.737] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | File "/home/pizero/Projects/astrbot/astrbot/core/star/star_manager.py", line 967, in load
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | plugin_config = AstrBotConfig(
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | ^^^^^^^^^^^^^^
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | File "/home/pizero/Projects/astrbot/astrbot/core/config/astrbot_config.py", line 52, in init
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | default_config = self._config_schema_to_default_config(schema)
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | File "/home/pizero/Projects/astrbot/astrbot/core/config/astrbot_config.py", line 153, in _config_schema_to_default_config
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | _parse_schema(schema, conf)
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | File "/home/pizero/Projects/astrbot/astrbot/core/config/astrbot_config.py", line 137, in _parse_schema
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | raise TypeError(
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: | TypeError: 不受支持的配置类型 dict。支持的类型有:dict_keys(['int', 'float', 'bool', 'string', 'text', 'list', 'file', 'object', 'template_list'])
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1217]: |
[02:04:02.738] [Core] [ERRO] [v4.25.0] [star.star_manager:1218]: ----------------------------------
[02:04:02.738] [Core] [INFO] [star.star_manager:1231]: 失败插件依旧在插件列表中,正在清理...
[02:04:02.739] [Core] [INFO] [star.star_manager:926]: Loading plugin astrbot ...
[02:04:02.740] [Core] [INFO] [star.star_manager:1014]: Plugin astrbot (4.1.0) by AstrBot Team: AstrBot's internal plugin, providing some basic capabilities.
[02:04:02.740] [Core] [INFO] [star.star_manager:926]: Loading plugin builtin_commands ...
[02:04:02.742] [Core] [INFO] [star.star_manager:1014]: Plugin builtin_commands (0.0.1) by Soulter: AstrBot's internal plugin, providing all built-in commands such as /reset.
[02:04:02.748] [Core] [INFO] [knowledge_base.kb_mgr:62]: KnowledgeBase database initialized: /home/pizero/Projects/astrbot/data/knowledge_base/kb.db
[02:04:02.837] [Core] [INFO] [dashboard.server:489]: Starting WebUI at http://0.0.0.0:6185
[02:04:02.837] [Core] [INFO] [dashboard.server:491]: WebUI listens on all interfaces. Check security. Set dashboard.host in data/cmd_config.json to change it.
[02:04:02.837] [Core] [INFO] [dashboard.server:528]:
✨✨✨
AstrBot v4.25.0 WebUI is ready

➜ Local: http://localhost:6185
➜ Network: http://127.0.0.1:6185
➜ Network: http://172.20.10.3:6185
➜ Username: astrbot
✨✨✨

[02:04:02.838] [Core] [INFO] [core.core_lifecycle:341]: AstrBot started.
[02:04:02.840] [Core] [INFO] [utils.temp_dir_cleaner:127]: TempDirCleaner started. interval=600s cleanup_ratio=0.3
[2026-05-20 02:04:02 +0800] [26280] [INFO] Running on http://0.0.0.0:6185 (CTRL + C to quit)
[02:04:03.380] [Core] [INFO] [t2i.network_strategy:131]: Successfully got 2 official T2I endpoints.
[02:04:04.312] [Core] [INFO] [utils.llm_metadata:63]: Successfully fetched metadata for 2483 LLMs.

  1. 基本上所有能写 list 的地方都能写 string
{
  "options_string": {
    "type": "string",
    "options": "this is string's default"
  },
  "list_options_string": {
    "type": "list",
    "options": "this is string's default"
  },
  "list_default_string": {
    "type": "list",
    "default": "this is string's default"
  }
}
Image
  1. obvious_hint 没提类型,同时判断不检查类型,未说明该选项依赖 hint
{
  "hint_string": {
    "type": "string",
    "obvious_hint": "wtf"
  },
  "ob_string": {
    "type": "string",
    "obvious_hint": "wtf"
  },
  "hint_ob_string": {
    "type": "string",
    "obvious_hint": "wtf",
    "hint": "wtf"
  },
  "hint_empty_ob_string": {
    "type": "string",
    "obvious_hint": "",
    "hint": "wtf"
  }
}
Image
  1. default 未校验类型,导致保存出错
{
  "string": {
    "type": "string",
    "default": 1
  },
  "string_list": {
    "type": "string",
    "default": ["w", "tf"]
  },
  "text": {
    "type": "text",
    "default": 1
  },
  "int": {
    "type": "int",
    "default": "a"
  },
  "float": {
    "type": "float",
    "default": "a"
  },
  "bool": {
    "type": "bool",
    "default": 1
  },
  "list": {
    "type": "list",
    "default": 1
  },
  "template_list": {
    "type": "template_list",
    "default": 1
  }
}
Image Image
  1. slider 没有文档记录

### dict 类型的 schema

{
  "slider": {
    "type": "float",
    "slider": { "min": "0", "max": "10", "step": "1" }
  }
}

同样没有校验

{
  "slider": {
    "type": "float",
    "slider": { "min": "0a", "max": "10a", "step": "1a" }
  }
}
Image

Reproduce / 如何复现?

如上

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

git 02291a3

OS

Linux

Logs / 报错日志

如上

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions