Download src/commands/extra-usage/index.ts from chenbhao/codev: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/chenbhao/codev/resolve/main/src/commands/extra-usage/index.ts
- Command line
-
hf download hf://chenbhao/codev/src/commands/extra-usage/index.ts
-
curl -L -o index.ts https://huggingface.co/chenbhao/codev/resolve/main/src/commands/extra-usage/index.ts
1.1 kB
| import { getIsNonInteractiveSession } from '../../bootstrap/state.js' | |
| import type { Command } from '../../commands.js' | |
| import { isOverageProvisioningAllowed } from '../../utils/auth.js' | |
| import { isEnvTruthy } from '../../utils/envUtils.js' | |
| function isExtraUsageAllowed(): boolean { | |
| if (isEnvTruthy(process.env.DISABLE_EXTRA_USAGE_COMMAND)) { | |
| return false | |
| } | |
| return isOverageProvisioningAllowed() | |
| } | |
| export const extraUsage = { | |
| type: 'local-jsx', | |
| name: 'extra-usage', | |
| description: 'Configure extra usage to keep working when limits are hit', | |
| isEnabled: () => isExtraUsageAllowed() && !getIsNonInteractiveSession(), | |
| load: () => import('./extra-usage.js'), | |
| } satisfies Command | |
| export const extraUsageNonInteractive = { | |
| type: 'local', | |
| name: 'extra-usage', | |
| supportsNonInteractive: true, | |
| description: 'Configure extra usage to keep working when limits are hit', | |
| isEnabled: () => isExtraUsageAllowed() && getIsNonInteractiveSession(), | |
| get isHidden() { | |
| return !getIsNonInteractiveSession() | |
| }, | |
| load: () => import('./extra-usage-noninteractive.js'), | |
| } satisfies Command | |