( model: ModelSetting, fastModeUserEnabled: boolean | undefined, )
| 320 | } |
| 321 | |
| 322 | export function getFastModeState( |
| 323 | model: ModelSetting, |
| 324 | fastModeUserEnabled: boolean | undefined, |
| 325 | ): 'off' | 'cooldown' | 'on' { |
| 326 | const enabled = |
| 327 | isFastModeEnabled() && |
| 328 | isFastModeAvailable() && |
| 329 | !!fastModeUserEnabled && |
| 330 | isFastModeSupportedByModel(model) |
| 331 | if (enabled && isFastModeCooldown()) { |
| 332 | return 'cooldown' |
| 333 | } |
| 334 | if (enabled) { |
| 335 | return 'on' |
| 336 | } |
| 337 | return 'off' |
| 338 | } |
| 339 | |
| 340 | // Disabled reason returned by the API. The API is the canonical source for why |
| 341 | // fast mode is disabled (free account, admin preference, extra usage not enabled). |
no test coverage detected