From 430694aae95729d770f4ff7cc206cb5a3d7b86eb Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Wed, 4 Feb 2026 10:05:35 +0800 Subject: [PATCH 1/6] chore: update readme --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ed33004da..eca615c99 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,6 @@ AstrBot 是一个开源的一站式 Agentic 个人和群聊助手,可在 QQ、 -陪伴与能力**从来不应该是**对立面。我们希望创造的是一个既能理解情绪、给予陪伴,也能可靠完成工作的机器人——致敬[ATRI](https://zh.wikipedia.org/zh-cn/ATRI_-My_Dear_Moments-)。 - ## 快速开始 #### Docker 部署(推荐 🥳) @@ -268,6 +266,6 @@ pre-commit install _私は、高性能ですから!_ - - Date: Wed, 4 Feb 2026 10:08:48 +0800 Subject: [PATCH 2/6] fix: update ruff exclude list to include tests directory --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 35eb5a73d..342ea629b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,7 +76,7 @@ dev = [ astrbot = "astrbot.cli.__main__:cli" [tool.ruff] -exclude = ["astrbot/core/utils/t2i/local_strategy.py", "astrbot/api/all.py"] +exclude = ["astrbot/core/utils/t2i/local_strategy.py", "astrbot/api/all.py", "tests"] line-length = 88 target-version = "py310" From fe06dfcca303012e7527264da5ee105d35e6f71b Mon Sep 17 00:00:00 2001 From: Raven95676 Date: Wed, 4 Feb 2026 11:45:59 +0800 Subject: [PATCH 3/6] fix: update ruff version to 0.15.0 and add ASYNC240 to ignore list --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 342ea629b..2ce53ad39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,7 +69,7 @@ dev = [ "pytest>=8.4.1", "pytest-asyncio>=1.1.0", "pytest-cov>=6.2.1", - "ruff>=0.12.8", + "ruff>=0.15.0", ] [project.scripts] @@ -97,6 +97,7 @@ ignore = [ "F405", "E501", "ASYNC230", # TODO: handle ASYNC230 in AstrBot + "ASYNC240", # TODO: handle ASYNC240 in AstrBot ] [tool.pyright] From f65b268bb220a0d06f1b4d6fd33f914c5b3480eb Mon Sep 17 00:00:00 2001 From: Anima-IGCenter Date: Wed, 4 Feb 2026 15:00:08 +0800 Subject: [PATCH 4/6] chore: create robots.txt (#4847) --- dashboard/public/robots.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 dashboard/public/robots.txt diff --git a/dashboard/public/robots.txt b/dashboard/public/robots.txt new file mode 100644 index 000000000..1f53798bb --- /dev/null +++ b/dashboard/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / From 36f0d1f0f9e9dd6cf23c47b994444ed879bdc104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=9C=A3=E8=BE=BE=E7=94=9F=E7=89=A9=E5=A4=9A?= Date: Wed, 4 Feb 2026 15:02:15 +0800 Subject: [PATCH 5/6] feat: add debug hint to console page and localization files (#4852) --- .../src/i18n/locales/en-US/features/console.json | 5 ++++- .../src/i18n/locales/zh-CN/features/console.json | 5 ++++- dashboard/src/views/ConsolePage.vue | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/dashboard/src/i18n/locales/en-US/features/console.json b/dashboard/src/i18n/locales/en-US/features/console.json index 3c7448586..34f65540a 100644 --- a/dashboard/src/i18n/locales/en-US/features/console.json +++ b/dashboard/src/i18n/locales/en-US/features/console.json @@ -11,5 +11,8 @@ "mirrorLabel": "Force PyPI repository URL (optional)", "mirrorHint": "Force PyPI repository URL > Config item `PyPI Repository Address`", "installButton": "Install" + }, + "debugHint": { + "text": "Debug logs can be enabled in \"Configuration File → System → Console Log Level\"" } -} \ No newline at end of file +} diff --git a/dashboard/src/i18n/locales/zh-CN/features/console.json b/dashboard/src/i18n/locales/zh-CN/features/console.json index 321bda339..844662650 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/console.json +++ b/dashboard/src/i18n/locales/zh-CN/features/console.json @@ -11,5 +11,8 @@ "mirrorLabel": "强制 PyPI 软件仓库链接(可选)", "mirrorHint": "强制 PyPI 软件仓库链接 > 配置项 `PyPI 软件仓库地址`", "installButton": "安装" + }, + "debugHint": { + "text": "Debug 日志需要在「配置文件 → 系统 → 控制台日志级别」中开启" } -} \ No newline at end of file +} diff --git a/dashboard/src/views/ConsolePage.vue b/dashboard/src/views/ConsolePage.vue index 0ffff380d..b4c813f49 100644 --- a/dashboard/src/views/ConsolePage.vue +++ b/dashboard/src/views/ConsolePage.vue @@ -10,7 +10,18 @@ const { tm } = useModuleI18n('features/console');
-

{{ tm('title') }}

+
+

{{ tm('title') }}

+ + {{ tm('debugHint.text') }} + +
\ No newline at end of file + From 36432c43615867972a5ae6d1e912b15d2814d18a Mon Sep 17 00:00:00 2001 From: Gao Jinzhe <2968474907@qq.com> Date: Wed, 4 Feb 2026 15:06:03 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E7=83=AD=E9=87=8D=E8=BD=BD=E6=97=B6=E5=B9=B3=E5=8F=B0=E9=80=82?= =?UTF-8?q?=E9=85=8D=E5=99=A8=E6=9C=AA=E6=B8=85=E7=90=86=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E5=86=B2=E7=AA=81=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#4859)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/platform/platform_metadata.py | 3 ++ astrbot/core/platform/register.py | 32 ++++++++++++++++++++++ astrbot/core/star/star_manager.py | 13 +++++++++ 3 files changed, 48 insertions(+) diff --git a/astrbot/core/platform/platform_metadata.py b/astrbot/core/platform/platform_metadata.py index b5f11ca15..00e7dc966 100644 --- a/astrbot/core/platform/platform_metadata.py +++ b/astrbot/core/platform/platform_metadata.py @@ -21,3 +21,6 @@ class PlatformMetadata: """平台是否支持真实流式传输""" support_proactive_message: bool = True """平台是否支持主动消息推送(非用户触发)""" + + module_path: str | None = None + """注册该适配器的模块路径,用于插件热重载时清理""" diff --git a/astrbot/core/platform/register.py b/astrbot/core/platform/register.py index 5f550ecd1..3bbec4809 100644 --- a/astrbot/core/platform/register.py +++ b/astrbot/core/platform/register.py @@ -37,6 +37,9 @@ def register_platform_adapter( if "id" not in default_config_tmpl: default_config_tmpl["id"] = adapter_name + # Get the module path of the class being decorated + module_path = cls.__module__ + pm = PlatformMetadata( name=adapter_name, description=desc, @@ -45,6 +48,7 @@ def register_platform_adapter( adapter_display_name=adapter_display_name, logo_path=logo_path, support_streaming_message=support_streaming_message, + module_path=module_path, ) platform_registry.append(pm) platform_cls_map[adapter_name] = cls @@ -52,3 +56,31 @@ def register_platform_adapter( return cls return decorator + + +def unregister_platform_adapters_by_module(module_path_prefix: str) -> list[str]: + """根据模块路径前缀注销平台适配器。 + + 在插件热重载时调用,用于清理该插件注册的所有平台适配器。 + + Args: + module_path_prefix: 模块路径前缀,如 "data.plugins.my_plugin" + + Returns: + 被注销的平台适配器名称列表 + """ + unregistered = [] + to_remove = [] + + for pm in platform_registry: + if pm.module_path and pm.module_path.startswith(module_path_prefix): + to_remove.append(pm) + unregistered.append(pm.name) + + for pm in to_remove: + platform_registry.remove(pm) + if pm.name in platform_cls_map: + del platform_cls_map[pm.name] + logger.debug(f"平台适配器 {pm.name} 已注销 (来自模块 {pm.module_path})") + + return unregistered diff --git a/astrbot/core/star/star_manager.py b/astrbot/core/star/star_manager.py index c59fa314e..567397107 100644 --- a/astrbot/core/star/star_manager.py +++ b/astrbot/core/star/star_manager.py @@ -15,6 +15,7 @@ import yaml from astrbot.core import logger, pip_installer, sp from astrbot.core.agent.handoff import FunctionTool, HandoffTool from astrbot.core.config.astrbot_config import AstrBotConfig +from astrbot.core.platform.register import unregister_platform_adapters_by_module from astrbot.core.provider.register import llm_tools from astrbot.core.utils.astrbot_path import ( get_astrbot_config_path, @@ -842,6 +843,18 @@ class PluginManager: for func_tool in to_remove: llm_tools.func_list.remove(func_tool) + # Unregister platform adapters registered by this plugin + # module_path is like "data.plugins.my_plugin.main", extract prefix like "data.plugins.my_plugin" + module_prefix = ".".join(plugin_module_path.split(".")[:-1]) + if module_prefix: + unregistered_adapters = unregister_platform_adapters_by_module( + module_prefix + ) + for adapter_name in unregistered_adapters: + logger.info( + f"移除了插件 {plugin_name} 的平台适配器 {adapter_name}", + ) + if plugin is None: return