MCPcopy
hub / github.com/di-sukharev/opencommit / listModels

Function listModels

out/cli.cjs:86871–86902  ·  view source on GitHub ↗
(provider, useCache = true)

Source from the content-addressed store, hash-verified

86869 return `${days} day${days === 1 ? "" : "s"} ago`;
86870 } else if (hours > 0) {
86871 return `${hours} hour${hours === 1 ? "" : "s"} ago`;
86872 } else if (minutes > 0) {
86873 return `${minutes} minute${minutes === 1 ? "" : "s"} ago`;
86874 }
86875 return "just now";
86876}
86877async function listModels(provider, useCache = true) {
86878 const config8 = getConfig();
86879 const apiKey = config8.OCO_API_KEY;
86880 const currentModel = config8.OCO_MODEL;
86881 let models = [];
86882 if (useCache) {
86883 const cached = getCachedModels(provider);
86884 if (cached) {
86885 models = cached;
86886 }
86887 }
86888 if (models.length === 0) {
86889 const providerKey = provider.toLowerCase();
86890 models = MODEL_LIST[providerKey] || [];
86891 }
86892 console.log(
86893 `
86894${source_default.bold("Available models for")} ${source_default.cyan(provider)}:
86895`
86896 );
86897 if (models.length === 0) {
86898 console.log(source_default.dim(" No models found"));
86899 } else {
86900 models.forEach((model) => {
86901 const isCurrent = model === currentModel;
86902 const prefix = isCurrent ? source_default.green("* ") : " ";
86903 const label = isCurrent ? source_default.green(model) : model;
86904 console.log(`${prefix}${label}`);
86905 });

Callers 2

refreshModelsFunction · 0.70
cli.cjsFile · 0.70

Calls 5

toLowerCaseMethod · 0.80
boldMethod · 0.80
getConfigFunction · 0.70
getCachedModelsFunction · 0.70
forEachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…