Fix 修正shell工具未正确应用工具调用超时的问题#6434
Hidden character warning
Conversation
…95987/AstrBot into fix-修正shell工具未正确应用工具调用超时的问题
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在增强shell工具的灵活性和鲁棒性,通过允许其根据系统配置动态调整命令执行超时时间。这确保了需要较长执行时间的脚本(例如数据抓取或复杂处理任务)不会因默认的硬编码超时而过早终止,从而提高了工具的可靠性和适用性。 Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- When converting
tool_call_timeoutto anint, consider handling non-numeric or malformed values (e.g., try/except ValueError with a sane fallback) to avoid failing the entire tool call if the config is misconfigured. - It may be useful to validate that the resolved timeout is positive and within a reasonable upper bound before passing it to
sb.shell.exec, so that misconfigured timeouts (e.g., 0 or extremely large values) don't cause unintended behavior.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- When converting `tool_call_timeout` to an `int`, consider handling non-numeric or malformed values (e.g., try/except ValueError with a sane fallback) to avoid failing the entire tool call if the config is misconfigured.
- It may be useful to validate that the resolved timeout is positive and within a reasonable upper bound before passing it to `sb.shell.exec`, so that misconfigured timeouts (e.g., 0 or extremely large values) don't cause unintended behavior.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
关于工具调用之前有个恶性bug,delta.data和data没有同时判定的 |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
lgtm |
|
@a61995987 合并后,在这里:#6325 跟踪进度 |
请问指的是agent执行器中deerflow的模型提供商流式请求的过程中出现的么?还是其他地方? |
是开启streaming返回的时候,出现了任何tool无法调用的情况,我提交的pr先前已经合并到master了 |
收到 感谢 |
OK 我看到了 但好像咱们两个的PR并没有冲突 没问题 |
某些特殊技能脚本可能需要更长的执行时间 且需要将执行结果实时返回给LLM(如使用yt-dlp库在youtube上抓取字幕 该库在游客身份下获取字幕列表后 必须等待60秒才能够进行字幕下载 否则会报429错误)
该PR对shell工具引入了工具调用超时参数 使其能够正确接收工具调用超时设置而非硬编码的30秒
修改自PR(#6076)
Modifications / 改动点
修改文件:
astrbot/core/computer/tools/shell.pycall方法中的sb.shell.exec调用 传入系统配置(tool_call_timeout)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.txt和pyproject.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.txtandpyproject.toml.😮 我的更改没有引入恶意代码。
/ My changes do not introduce malicious code.
/ I have read and understood all the above and confirm this PR follows the rules.
🚀 我确保本次开发基于 dev 分支,并将代码合并至开发分支(除非极其紧急,才允许合并到主分支)。
/ I confirm that this development is based on the dev branch and will be merged into the development branch, unless it is extremely urgent to merge into the main branch.
/ I did not read the above carefully before submitting.
Summary by Sourcery
Bug Fixes: