Skip to content

Conversation

@DonDawsy
Copy link

@DonDawsy DonDawsy commented Apr 17, 2025

Context

Adds a Total API Cost to the history view, makes it easy to quickly see how much is spent on a project.
Can view totals for both current project and all projects.

Implementation

It uses a React useMemo hook to compute the sum of the totalCost field from the filtered task list. The total is shown above the task list.

Screenshots

Before:
CleanShot 2025-04-17 at 03 35 31

After:
CleanShot 2025-04-17 at 03 43 09

Get in Touch

Discord: dondaws


Important

Adds total API cost calculation and display to HistoryView component using useMemo.

  • Feature:
    • Adds total API cost calculation to HistoryView component using useMemo.
    • Displays total API cost above task list in HistoryView.
  • Implementation:
    • Computes sum of totalCost from tasks array, handling both string and number types.
    • Uses useMemo to optimize calculation based on tasks dependency.
  • UI:
    • Adds a new UI element to show total API cost in HistoryView.

This description was created by Ellipsis for 1bba837. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Apr 17, 2025

⚠️ No Changeset found

Latest commit: 1bba837

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels Apr 17, 2025
@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap Apr 17, 2025
// Calculate total API cost for current tasks
const totalApiCost = useMemo(() => {
return tasks.reduce((sum, task) => {
const cost = typeof task.totalCost === "string" ? parseFloat(task.totalCost) : task.totalCost
Copy link
Contributor

Choose a reason for hiding this comment

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

do we have a case where totalCost is a string?
i'm guessing the type is a string, but i'm a bit confused as to where it's being used since free model is 0 right? instead of some other string value

Copy link
Author

Choose a reason for hiding this comment

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

It's more of a safeguard really, I can always change it

@mrubens
Copy link
Collaborator

mrubens commented Apr 21, 2025

I like the idea of more visibility here, but I would love to complement the cost with some information about the amount of work accomplished for that spend (number of tasks is probably easiest). I know @sachasayan is also redesigning this area in #2806 - maybe he has some ideas too? Thank you!

@sachasayan
Copy link
Contributor

I have some questions about here about purpose, and whether this starts transitioning the view in question from a task management view to a project management view. Stats are fun but maybe there could be a specific view for project (workspace) level information rather than crowding the task management view?

@DonDawsy
Copy link
Author

I have some questions about here about purpose, and whether this starts transitioning the view in question from a task management view to a project management view. Stats are fun but maybe there could be a specific view for project (workspace) level information rather than crowding the task management view?

Yeah that's fair. I figured since the API costs for each task is already visible in the history view it would make sense to have a total, and I like being able to quickly get an overview over how much is spent within a project. But I'm open to moving it elsewhere.

@sachasayan
Copy link
Contributor

Yeah that's fair. I figured since the API costs for each task is already visible in the history view it would make sense to have a total, and I like being able to quickly get an overview over how much is spent within a project. But I'm open to moving it elsewhere.

Maybe we could have a little ( i ) mouseover in the task list for the current workspace on the main screen?

@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap May 20, 2025
@hannesrudolph hannesrudolph moved this from PR [Needs Review] to TEMP in Roo Code Roadmap May 26, 2025
@daniel-lxs daniel-lxs moved this from TEMP to PR [Needs Review] in Roo Code Roadmap May 26, 2025
@daniel-lxs
Copy link
Member

Hey @DonDawsy, thank you for your contribution. Sorry for the delay on reviewing your PR

We'd like to implement a more robust cost management solution to handle this specific issue and we apologize that we took so long to let you know. We shifted to a clearer issue-first workflow. Please create an issue first if you'd like to revisit this.

We appreciate your patience.

@daniel-lxs daniel-lxs closed this May 27, 2025
@github-project-automation github-project-automation bot moved this from PR [Pre Approval Review] to Done in Roo Code Roadmap May 27, 2025
@github-project-automation github-project-automation bot moved this from Needs Preliminary Review to Done in Roo Code Roadmap May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Needs Preliminary Review size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants