feat: 增加 shell 工具自定义超时配置#6076
Hidden character warning
Conversation
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.
嗨,我在这里给出了一些高层次的反馈:
- 在
shell.call里读取shell_call_timeout时,建议避免直接使用硬编码的默认值30,而是复用中央配置中已有的默认值(或回退到tool_call_timeout),这样默认值只需要在一个地方维护。 - 从
provider_settings中读取shell_call_timeout时,它可能会以字符串形式出现(例如来自 UI 输入),因此在将其传入sb.shell.exec之前,显式地将其转换/校验为int会更安全。
给 AI 代理的提示词
Please address the comments from this code review:
## Overall Comments
- Consider avoiding the hard-coded default `30` when reading `shell_call_timeout` in `shell.call` and instead reuse the existing default from the central config (or fall back to `tool_call_timeout`) so the default only needs to be maintained in one place.
- When reading `shell_call_timeout` from `provider_settings`, it may arrive as a string (e.g., from UI input), so it’s safer to explicitly cast/validate it as an `int` before passing it into `sb.shell.exec`.帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续评审。
Original comment in English
Hey - I've left some high level feedback:
- Consider avoiding the hard-coded default
30when readingshell_call_timeoutinshell.calland instead reuse the existing default from the central config (or fall back totool_call_timeout) so the default only needs to be maintained in one place. - When reading
shell_call_timeoutfromprovider_settings, it may arrive as a string (e.g., from UI input), so it’s safer to explicitly cast/validate it as anintbefore passing it intosb.shell.exec.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider avoiding the hard-coded default `30` when reading `shell_call_timeout` in `shell.call` and instead reuse the existing default from the central config (or fall back to `tool_call_timeout`) so the default only needs to be maintained in one place.
- When reading `shell_call_timeout` from `provider_settings`, it may arrive as a string (e.g., from UI input), so it’s safer to explicitly cast/validate it as an `int` before passing it into `sb.shell.exec`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
某些特殊技能脚本可能需要更长的执行时间 且需要将执行结果实时返回给LLM(如使用yt-dlp库在youtube上抓取字幕 该库在游客身份下获取字幕列表后 必须等待60秒才能够进行字幕下载 否则会报429错误)
该PR增加了对shell工具超时时间的自定义修改支持 默认30秒
Modifications / 改动点
修改文件:
astrbot/core/computer/tools/shell.pycall方法中的sb.shell.exec调用 传入系统配置(shell_call_timeout)修改文件:
astrbot/core/config/default.pyshell_call_timeout属性及相关定义、描述修改文件:
dashboard/src/i18n/locales/en-US/features/config-metadata.json和dashboard/src/i18n/locales/zh-CN/features/config-metadata.jsonshell_call_timeout的i18n翻译Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
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 inrequirements.txtandpyproject.toml.Summary by Sourcery
为 shell 工具执行添加可配置的超时支持(默认 30 秒),并通过 provider 设置对外暴露。
New Features:
shell_call_timeout配置项,用于按 provider 控制 shell 工具的执行超时时间。Enhancements:
shell_call_timeout,以便可以通过控制台(dashboard)界面进行管理。Original summary in English
Summary by Sourcery
Add configurable timeout support for shell tool execution with a default of 30 seconds and expose it through provider settings.
New Features:
Enhancements: