MCPcopy Create free account
hub / github.com/cursor/cookbook / modelToChoices

Function modelToChoices

sdk/coding-agent-cli/src/agent.ts:261–282  ·  view source on GitHub ↗
(model: SDKModel)

Source from the content-addressed store, hash-verified

259}
260
261function modelToChoices(model: SDKModel): ModelChoice[] {
262 const baseLabel = model.displayName || model.id
263 const variants = model.variants ?? []
264
265 if (variants.length === 0) {
266 return [
267 {
268 label: baseLabel,
269 value: { id: model.id },
270 description: model.description,
271 },
272 ]
273 }
274
275 const choices = variants.map((variant) => ({
276 label: buildVariantLabel(model, variant.displayName),
277 value: { id: model.id, params: variant.params },
278 description: variant.description ?? model.description,
279 }))
280
281 return disambiguateDuplicateLabels(dedupeModelChoices(choices), model)
282}
283
284function buildVariantLabel(model: SDKModel, variantDisplayName: string) {
285 const baseLabel = model.displayName || model.id

Callers

nothing calls this directly

Calls 3

buildVariantLabelFunction · 0.85
dedupeModelChoicesFunction · 0.85

Tested by

no test coverage detected