( userId: string, accessTier: FreebuffAccessTier, deps: SessionDeps, )
| 173 | } |
| 174 | |
| 175 | async function fetchRateLimitsByModel( |
| 176 | userId: string, |
| 177 | accessTier: FreebuffAccessTier, |
| 178 | deps: SessionDeps, |
| 179 | ): Promise<Record<string, FreebuffSessionRateLimit>> { |
| 180 | const config = quotaConfigForAccessTier(accessTier) |
| 181 | const snapshot = await fetchSessionQuotaSnapshot(userId, config, deps) |
| 182 | return Object.fromEntries( |
| 183 | config.models.map( |
| 184 | (model) => [model, toRateLimitInfo(model, snapshot)] as const, |
| 185 | ), |
| 186 | ) |
| 187 | } |
| 188 | |
| 189 | function onlyUsedRateLimitsByModel( |
| 190 | rateLimitsByModel: Record<string, FreebuffSessionRateLimit>, |
no test coverage detected