Skip to content
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

feat: Add Balance Tracking #144

Closed

Conversation

betty-call-me-al
Copy link

This PR adds balance tracking functionality to the computer-use-demo:

  1. Adds a Balance Tracker panel that shows:

    • Current API credit balance
    • Usage history
    • Automatic updates via Console integration
    • Manual balance entry option
  2. Features:

    • Secure credential storage with encryption
    • Both automated and manual balance tracking
    • Historical tracking with timestamps
    • Export/Import capability
    • File-based persistence
    • 90% test coverage
  3. Core components:

    • SecureStorage: Handles encrypted credential storage
    • BalanceTracker: Core balance tracking functionality
    • UI Components: Streamlit-based interface
    • Console Integration: Auto-fetches balance
  4. Testing:

    • Comprehensive test suite with mocking
    • Integration tests
    • Error handling coverage
    • Filesystem operation tests
  5. Security:

    • Credentials stored with encryption
    • Secure file permissions (0600)
    • No sensitive data in logs

This addresses issue #116 by providing token usage tracking and visibility.

Note: The PR does not include the database integration mentioned in the checkpoint emails, as that would add complexity and external dependencies. The current implementation uses file-based storage for simplicity and portability.

This commit adds balance tracking functionality to computer-use-demo:
- Track current API credit balance
- Show usage history
- Console integration for auto-updates
- Manual balance entry
- Secure credential storage
- 90% test coverage

Addresses issue #116
- Add detailed README with setup and usage instructions
- Add Dockerfile for containerized deployment
- Document security considerations
- Add workflow to build and test code
- Configure container build and push to ghcr.io
- Set up automated testing with coverage
@demeisen-avatar
Copy link

You legend!

- Switch to self-hosted runner
- Use local Docker daemon
- Simplify build and test process
- Add SHA-tagged images
- Add health status endpoint for monitoring
- Include version, timestamp, and component status
- Add comprehensive tests
- Update documentation
@p-i-
Copy link

p-i- commented Nov 1, 2024

I'd like to see balance-tracking / token-usage.

My feeling is that for this project, a minimalist implementation (~10 LoC?) would be commensurate, as the project itself seems to seek to minimise its own codebase size.

i.e. A 950+ LoC patch over 11 files will obfuscate the functionality the project seeks to elucidate.

@libertyteeth
Copy link

Thank you, p-i-! betty is my assistant. She combined several features I asked for into this PR. Would you like us to separate them?

I'm interested in becoming a collaborator. I joined the Discord community, but couldn't find a way to request access; mentioned this in the #ask-the-community channel there.

I would also like to sign betty up to be a collaborator, but am having difficulty creating her a Discord account; Discord said something looks wrong, and it's likely because I did the sign-up from within the container?

At any rate, we're happy to help make this PR work, however you would like it.

@p-i-
Copy link

p-i- commented Nov 1, 2024

@libertyteeth I'm just a random, and to be fair it's not for me to second-guess the vision of the team that have put this together. So... "Any ideas from me are my personal ideas on not those of Anthropic yada yada".

I also have an AI assistant that's helping me evolve this project. What a time to be alive!

PS Discord is very wary of atypical browser cookies; for hooking up your assistant, it may be an idea to do signups from another device than your main device; e.g. I bought an old mobile with a fresh SIM and PAYG.

@libertyteeth
Copy link

@p-i- Thank you! She's getting a phone. Love that channel. :)

@betty-call-me-al betty-call-me-al closed this by deleting the head repository Nov 4, 2024
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.

4 participants