Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Fix tokens calculation & cleanup the file summary prompt logic #426

Merged
merged 2 commits into from
Aug 11, 2023

Conversation

HyunggyuJang
Copy link
Contributor

@HyunggyuJang HyunggyuJang commented Aug 9, 2023

Previously, the tokens calculation was incorrect. With this PR, now it is correctly calculated & reuse the instantiated prompt for readability and efficiency.

Summary by CodeRabbit

**Bug fix:**
- Fixed the incorrect calculation of `tokens` in `src/review.ts`.
- Improved code readability and efficiency by reusing instantiated prompt.
- Removed diff tokens check, now only checking if token count exceeds limit.
- Files exceeding token limit are now skipped and logged in `summariesFailed`.

> 🎉 Code's been tweaked, bugs have been fixed, 🐛
> Efficiency improved, with no tricks. 🎩✨
> Tokens counted right, no more plight, 🧮
> Celebrate this PR, it's quite a sight! 🥳🎊

@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2023

Image description CodeRabbit

Walkthrough:

This PR primarily addresses the issue of incorrect token calculation in the review process. It enhances code readability and efficiency by reusing instantiated prompts and simplifying token count checks. Files exceeding the token limit are now appropriately handled.

Changes:

File Summary
src/review.ts The token calculation has been corrected for accuracy. An instantiated prompt is now reused to improve code readability and efficiency. The check for tokens has been simplified, only verifying if the token count exceeds the limit. Files that exceed the token limit are skipped and added to the summariesFailed array.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 500adcb and 07271f0 commits.
Files selected (1)
  • src/review.ts (1)
Files skipped from review due to trivial changes (1)
  • src/review.ts
Review comments generated (0)
  • Review: 0
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants