MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / refreshModels

Function refreshModels

out/cli.cjs:86903–86926  ·  view source on GitHub ↗
(provider)

Source from the content-addressed store, hash-verified

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 });
86906 }
86907 console.log("");
86908}
86909async function refreshModels(provider) {
86910 const config8 = getConfig();
86911 const apiKey = config8.OCO_API_KEY;
86912 const loadingSpinner = le();
86913 loadingSpinner.start(`Fetching models from ${provider}...`);
86914 clearModelCache();
86915 try {
86916 const models = await fetchModelsForProvider(
86917 provider,
86918 apiKey,
86919 void 0,
86920 true
86921 );
86922 loadingSpinner.stop(`${source_default.green("+")} Fetched ${models.length} models`);
86923 await listModels(provider, true);
86924 } catch (error) {
86925 loadingSpinner.stop(source_default.red("Failed to fetch models"));
86926 console.error(
86927 source_default.red(
86928 `Error: ${error instanceof Error ? error.message : "Unknown error"}`
86929 )

Callers 1

cli.cjsFile · 0.70

Calls 6

getConfigFunction · 0.70
clearModelCacheFunction · 0.70
fetchModelsForProviderFunction · 0.70
listModelsFunction · 0.70
startMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…