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

Allow users to set a limit on how many tokens an app can use #11

Open
alexanderatallah opened this issue Apr 11, 2023 · 1 comment
Open

Comments

@alexanderatallah
Copy link
Owner

alexanderatallah commented Apr 11, 2023

Similar to a "gas limit" in metamask.

The way I'm thinking we could implement it, but open to other ideas:

  • We add a field to Origin that indicates the limit (in $), and another field with how much has been used.
  • We deprecate the permission field. Instead, "allow" translates to limit === -1 (e.g. infinite), and "ask" translates to limit === 0 (ask every time)
  • We change the PermissionRequest.tsx ui to allow users to customize the limit per app, using a slider. limit defaults to 0.
  • Every completion request then updates used
  • Some module is responsible for accounting (would be nice to track overall $ used in a separate manager)
  • requestPermission skips over "limited" origins for requests that have a maxTokens param and are under the limit with that param included in accounting
  • Once we hit the limit, requestPermission will fire up the modal again, defaulting to the same limit as last time but allowing the user to change the app's permissions again if they want to. used is reset to zero when the user clicks allow, and at the end of the transaction, it's updated again.
@alexanderatallah
Copy link
Owner Author

WIP PR: may be resolved by ThePatShea#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: In Progress
Development

No branches or pull requests

1 participant