Skip to content
Merged
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
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ async def inject_diversity_to_llm_request(self, event: AstrMessageEvent, req=Non

@filter.after_message_sent()
@monitored
async def on_bot_message_sent(self, event: AstrMessageEvent):
async def on_bot_message_sent(self, event: AstrMessageEvent, *_args):
"""捕获 Bot 发送的消息并存入数据库,用于 fewshot 对话对提取。"""
reset_trace_context()
try:
Expand Down
19 changes: 19 additions & 0 deletions tests/integration/test_package_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import builtins
import importlib
import importlib.util
import inspect
import sys
from pathlib import Path
from types import SimpleNamespace
Expand Down Expand Up @@ -61,6 +62,24 @@ def test_webui_persona_review_service_imports_under_astrbot_package_path():
_cleanup_alias(alias)


def test_after_message_sent_hook_accepts_framework_extra_args():
"""AstrBot v4.26.5 can pass extra hook args after the event object."""
alias = "data.plugins.astrbot_plugin_self_learning_hook_signature_pkgtest"
_cleanup_alias(alias)

try:
_load_plugin_package(alias)
module = importlib.import_module(f"{alias}.main")
signature = inspect.signature(module.SelfLearningPlugin.on_bot_message_sent)

assert any(
param.kind is inspect.Parameter.VAR_POSITIONAL
for param in signature.parameters.values()
)
finally:
_cleanup_alias(alias)


def test_webui_manager_uses_deferred_annotations_for_lazy_server_import():
"""Python 3.11 evaluates annotations unless this future import is present."""
manager_source = (PLUGIN_ROOT / "webui" / "manager.py").read_text(
Expand Down
Loading