Skip to content
Open
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
12 changes: 10 additions & 2 deletions astrbot/core/star/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,15 +491,23 @@ def add_llm_tools(self, *tools: FunctionTool) -> None:
for tool in tools:
if not module_path:
_parts = []
module_part = tool.__module__.split(".")
module_part = tool.__module__.split(".") if tool.__module__ else []
flags = ["builtin_stars", "plugins"]
found_flag = False
for i, part in enumerate(module_part):
_parts.append(part)
if part in flags and i + 1 < len(module_part):
_parts.append(module_part[i + 1])
_parts.append("main")
found_flag = True
break
tool.handler_module_path = ".".join(_parts)
if not found_flag and module_part:
# Subdirectory tool: construct path matching star_manager format
# Only apply to known plugin naming patterns (astrbot_plugin_*)
plugin_name = module_part[0]
if plugin_name.startswith("astrbot_plugin_"):
_parts = ["data", "plugins", plugin_name, "main"]
tool.handler_module_path = ".".join(_parts) if _parts else tool.__module__ or ""
module_path = tool.handler_module_path
else:
tool.handler_module_path = module_path
Expand Down