alexanderatallah / alexanderatallah/window.ai

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

Aberta
#11 1 comentário 2 reações 0 responsáveis Ver no GitHub
Linguagem predominante
TypeScript
Estrelas
987
Forks
97
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

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.

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.