-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update token_handler.py #699
Conversation
PR Description updated to latest commit (a461c2a)
|
PR Review
✨ Review tool usage guide:Overview:
With a configuration file, use the following template:
See the review usage page for a comprehensive guide on using this tool. |
PR Code Suggestions
✨ Improve tool usage guide:Overview:
With a configuration file, use the following template:
See the improve usage page for a more comprehensive guide on using this tool. |
/help |
PR Agent Walkthrough🤖 Welcome to the PR Agent, an AI-powered tool for automated pull request analysis, feedback, suggestions and more. Here is a list of tools you can use to interact with the PR Agent:
(1) Note that each tool be triggered automatically when a new PR is opened, or called manually by commenting on a PR. (2) Tools marked with [*] require additional parameters to be passed. For example, to invoke the |
PR Analysis
✨ Usage guide:Using static code analysis capabilities, the
Language that are currently supported: Python, Java, C++, JavaScript, TypeScript. |
PR DocumentationHere is a list of the files that were modified in the PR, with docstring for each altered code component:
|
Changelog updates: 2024-02-22Enhanced
|
Generated tests for '_get_system_user_tokens'
Component signature: def _get_system_user_tokens(self, pr, encoder, vars: dict, system, user):
✨ Usage guide:The
where 'component_name' is the name of a specific component in the PR. To get a list of the components that changed in the PR, use the Configuration options: See more information about the test tool in the docs. |
Type
enhancement, bug_fix
Description
_get_system_user_tokens
to return-1
when an exception occurs, enhancing robustness.count_tokens
function.Changes walkthrough
token_handler.py
Enhance Token Handling with Error Management
pr_agent/algo/token_handler.py
_get_system_user_tokens
with atry-except block.
-1
if an exception occurs during token counting.count_tokens
function logic, just formatting adjustment.