Skip to content

Conversation

@Soulter
Copy link
Member

@Soulter Soulter commented Jan 23, 2026

Modifications / 改动点

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果


Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

由 Sourcery 提供的摘要

错误修复:

  • 确保仅当传入事件来源于 webchat 平台时,才在 tool-end 钩子中对 web_search_tavily 的结果进行后处理。
Original summary in English

Summary by Sourcery

Bug Fixes:

  • Ensure web_search_tavily results are only post-processed in the tool-end hook when the incoming event originates from the webchat platform.

@auto-assign auto-assign bot requested review from Fridemn and advent259141 January 23, 2026 11:50
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 23, 2026
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给出一些整体性的反馈:

  • 建议对 run_context.context.event.get_platform_name() 做空值保护,以防 contextevent 可能为 None,从而避免在其他平台或未来重构中出现潜在的属性错误。
  • 建议为平台字符串字面量 "webchat"(以及其他平台检查中共享使用的值)使用常量或枚举,这样可以让这个条件判断更不易出错,也更方便未来扩展到其他平台。
供 AI Agent 使用的提示词
Please address the comments from this code review:

## Overall Comments
- Consider guarding `run_context.context.event.get_platform_name()` in case `context` or `event` is ever `None`, to avoid potential attribute errors in other platforms or future refactors.
- Using a constant or enum for the literal platform string `"webchat"` (shared with other platform checks) would make this condition less error-prone and easier to extend to additional platforms later.

Sourcery 对开源项目永久免费——如果你觉得我们的评审对你有帮助,欢迎分享给更多人 ✨
帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈持续改进代码评审质量。
Original comment in English

Hey - I've left some high level feedback:

  • Consider guarding run_context.context.event.get_platform_name() in case context or event is ever None, to avoid potential attribute errors in other platforms or future refactors.
  • Using a constant or enum for the literal platform string "webchat" (shared with other platform checks) would make this condition less error-prone and easier to extend to additional platforms later.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider guarding `run_context.context.event.get_platform_name()` in case `context` or `event` is ever `None`, to avoid potential attribute errors in other platforms or future refactors.
- Using a constant or enum for the literal platform string `"webchat"` (shared with other platform checks) would make this condition less error-prone and easier to extend to additional platforms later.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dosubot dosubot bot added the area:core The bug / feature is about astrbot's core, backend label Jan 23, 2026
@Soulter Soulter linked an issue Jan 23, 2026 that may be closed by this pull request
2 tasks
@Soulter Soulter merged commit eebe31f into master Jan 23, 2026
5 checks passed
@Soulter Soulter deleted the fix/websearch-tavily branch January 23, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]新版本工具调用的不调用和异常输出调用状态的问题

2 participants