MCPcopy Create free account
hub / github.com/anomalyco/opencode / buildModelSelectOptions

Function buildModelSelectOptions

packages/opencode/src/acp/config-option.ts:166–191  ·  view source on GitHub ↗
(
  providers: readonly ConfigOptionProvider[],
  options: { includeVariants: boolean },
)

Source from the content-addressed store, hash-verified

164}
165
166function buildModelSelectOptions(
167 providers: readonly ConfigOptionProvider[],
168 options: { includeVariants: boolean },
169): Array<{ value: string; name: string }> {
170 return providers.flatMap((provider) =>
171 Object.values(provider.models)
172 .sort((a, b) => a.name.localeCompare(b.name))
173 .flatMap((model) => {
174 const base = {
175 value: `${provider.id}/${model.id}`,
176 name: `${provider.name}/${model.name}`,
177 }
178 if (!options.includeVariants || !model.variants) return [base]
179
180 return [
181 base,
182 ...Object.keys(model.variants)
183 .filter((variant) => variant !== DEFAULT_VARIANT_VALUE)
184 .map((variant) => ({
185 value: `${provider.id}/${model.id}/${variant}`,
186 name: `${provider.name}/${model.name} (${formatVariantName(variant)})`,
187 })),
188 ]
189 }),
190 )
191}
192
193function variantsForModel(providers: readonly ConfigOptionProvider[], model: ModelSelection["model"]) {
194 return Object.keys(

Callers 1

buildModelSelectOptionFunction · 0.85

Calls 2

formatVariantNameFunction · 0.85
valuesMethod · 0.45

Tested by

no test coverage detected