fix: handle index out of range error when selecting provider #4206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修复了使用provider指令时索引越界报错不正常的问题
Modifications / 改动点
在使用provider指令切换提供商时,若参数提供的索引越界了,则会报错
在调用插件 builtin_commands 的处理函数 provider 时出现异常:list index out of range
源码中有处理该报错的代码,但并未生效,经检查是少写了return,故加上.
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
修复提供商选择命令,使其在处理超出范围的索引时不会抛出错误。
错误修复:
增强功能:
Original summary in English
Summary by Sourcery
Fix provider selection command to correctly handle out-of-range indices without raising errors.
Bug Fixes:
Enhancements: