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