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