Skip to content

[Bug] 插件缺少 FastAPI 初始化失败时的降低保护,导致插件无法正常加载 #57

@jin6yang

Description

@jin6yang

你想实现什么?

正常安装使用

当前实际情况

插件无法正常安装或加载,提示环境冲突或加载出现问题

你已经尝试过哪些方法?

关闭机器人并关闭所有插件然后完整重启AstrBot后重试(未尝试卸载所有插件和干净安装AstrBot后重试)

你目前对问题性质的判断

更像是配置、部署或适配器相关问题。

推测是因为本插件运行环境与AstrBot主运行环境发生依赖冲突,AstrBot主运行环境使用了老版本的Pydantic,而本插件在代码中使用的语法需要新版本的Pydantic才可以运行

插件版本

1.2.2

AstrBot 版本

4.23.2

部署方式

AstrBot App 桌面应用部署

使用的消息平台适配器

OneBot v11 (原 QQ 个人号)

其他平台名称(如选择“其他平台”请填写)

No response

操作系统

Windows

补充说明(可选)

No response

相关配置、日志或截图

插件 astrbot_plugin_proactive_chat 依赖安装失败: 检测到插件依赖与当前运行时发生冲突,无法安全加载该插件。冲突模块: fastapi -> Unable to generate pydantic-core schema for <class 'fastapi.openapi.models.Example'>. Set arbitrary_types_allowed=Truein the model_config to ignore this error or implementget_pydantic_core_schemaon your type to fully support it. If you got this error by calling handler(<some type>) withinget_pydantic_core_schemathen you likely need to callhandler.generate_schema()since we do not callget_pydantic_core_schemaon otherwise to avoid infinite recursion. For further information visit https://errors.pydantic.dev/2.13/u/schema-for-unknown-type

禁用所有插件后:
加载插件「主动消息 (Proactive Chat)」(目录: astrbot_plugin_proactive_chat, 版本: v1.2.2) 时出现问题,原因:Unable to generate pydantic-core schema for <class 'fastapi.openapi.models.Example'>. Set arbitrary_types_allowed=Truein the model_config to ignore this error or implementget_pydantic_core_schemaon your type to fully support it. If you got this error by calling handler(<some type>) withinget_pydantic_core_schemathen you likely need to callhandler.generate_schema()since we do not callget_pydantic_core_schemaon otherwise to avoid infinite recursion. For further information visit https://errors.pydantic.dev/2.13/u/schema-for-unknown-type。

你愿意在结论明确后提交 PR 或协助补充文档吗?

  • 是的,我愿意在问题明确后协助推进。

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/P1高优先级:重要功能缺陷或关键需求,需尽快处理type/fix🐛 Bug 修复

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions