alexanderatallah / alexanderatallah/window.ai

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

オープン
#11 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
986
フォーク
97
PR マージ指標
30日以内にマージされた PR はありません

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。