Skip to content

Extract accumulateStepCosts helper to remove duplicated logic - #3474

Open
traitimtrongvag wants to merge 1 commit into
charmbracelet:mainfrom
traitimtrongvag:refactor/accumulate-step-costs
Open

Extract accumulateStepCosts helper to remove duplicated logic#3474
traitimtrongvag wants to merge 1 commit into
charmbracelet:mainfrom
traitimtrongvag:refactor/accumulate-step-costs

Conversation

@traitimtrongvag

Copy link
Copy Markdown

The Summarize and GenerateTitle methods both iterate over provider step
metadata to accumulate OpenRouter costs and extract Hyper credits using
identical 12-line loop blocks. This change extracts the shared logic into
a single accumulateStepCosts helper method.

The refactoring is purely mechanical: the extracted code is identical in
both call sites, and the new helper is placed directly above the existing
openrouterCost method that it depends on. No behavior, signatures, or
imports are changed. The diff is -3 lines net, and the helper is
self-contained with no side effects beyond those already present in the
original duplicated blocks.

@charmcli

charmcli commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@traitimtrongvag

Copy link
Copy Markdown
Author

I have read the Contributor License Agreement (CLA) and hereby sign the CLA.

@traitimtrongvag

Copy link
Copy Markdown
Author

recheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants