MCPcopy Create free account
hub / github.com/Noumena-Network/code / convertEffortValueToLevel

Function convertEffortValueToLevel

src/utils/effort.ts:225–239  ·  view source on GitHub ↗
(value: EffortValue)

Source from the content-addressed store, hash-verified

223}
224
225export function convertEffortValueToLevel(value: EffortValue): EffortLevel {
226 if (typeof value === 'string') {
227 // Runtime guard: value may come from remote config (GrowthBook) where
228 // TypeScript types can't help us. Coerce unknown strings to 'high'
229 // rather than passing them through unchecked.
230 return isEffortLevel(value) ? value : 'high'
231 }
232 if (isInternalBuild() && typeof value === 'number') {
233 if (value <= 50) return 'low'
234 if (value <= 85) return 'medium'
235 if (value <= 100) return 'high'
236 return 'max'
237 }
238 return 'high'
239}
240
241/**
242 * Get user-facing description for effort levels

Callers 5

EffortCalloutFunction · 0.85
ModelPickerFunction · 0.85
getDisplayedEffortLevelFunction · 0.85
getEffortSuffixFunction · 0.85

Calls 2

isEffortLevelFunction · 0.85
isInternalBuildFunction · 0.85

Tested by

no test coverage detected