(choices: ModelChoice[])
| 314 | } |
| 315 | |
| 316 | function dedupeModelChoices(choices: ModelChoice[]) { |
| 317 | const bySelection = new Map<string, ModelChoice>() |
| 318 | |
| 319 | for (const choice of choices) { |
| 320 | const key = modelSelectionKey(choice.value) |
| 321 | const existing = bySelection.get(key) |
| 322 | |
| 323 | if (!existing) { |
| 324 | bySelection.set(key, choice) |
| 325 | continue |
| 326 | } |
| 327 | |
| 328 | bySelection.set(key, { |
| 329 | ...existing, |
| 330 | description: existing.description ?? choice.description, |
| 331 | }) |
| 332 | } |
| 333 | |
| 334 | return Array.from(bySelection.values()) |
| 335 | } |
| 336 | |
| 337 | function disambiguateGlobalDuplicateLabels(choices: ModelChoice[]) { |
| 338 | const labelCounts = choices.reduce((counts, choice) => { |
no test coverage detected