fix(status): use correct AgentLoop attribute for web search config

The /status command tried to access web search config via
`loop.config.tools.web.search`, but AgentLoop has no `config` attribute.
This caused the search usage lookup to silently return None, so web
search provider usage was never displayed.

Fix: use `loop.web_config.search` which is the actual attribute
set during AgentLoop.__init__.
This commit is contained in:
yanghan-cyber 2026-04-06 18:47:38 +08:00 committed by Xubin Ren
parent f65f788ab1
commit 84f0571e0d

View File

@ -65,8 +65,7 @@ async def cmd_status(ctx: CommandContext) -> OutboundMessage:
search_usage_text: str | None = None
try:
from nanobot.utils.searchusage import fetch_search_usage
web_cfg = getattr(getattr(loop, "config", None), "tools", None)
web_cfg = getattr(web_cfg, "web", None) if web_cfg else None
web_cfg = getattr(loop, "web_config", None)
search_cfg = getattr(web_cfg, "search", None) if web_cfg else None
if search_cfg is not None:
provider = getattr(search_cfg, "provider", "duckduckgo")