MCPcopy
hub / github.com/continuedev/continue / handleListModels

Method handleListModels

core/core.ts:1308–1340  ·  view source on GitHub ↗
(msg: Message<{ title: string }>)

Source from the content-addressed store, hash-verified

1306 }
1307
1308 private async handleListModels(msg: Message<{ title: string }>) {
1309 const { config } = await this.configHandler.loadConfig();
1310 if (!config) {
1311 return [];
1312 }
1313
1314 const model =
1315 config.modelsByRole.chat.find(
1316 (model) => model.title === msg.data.title,
1317 ) ??
1318 config.modelsByRole.chat.find((model) =>
1319 model.title?.startsWith(msg.data.title),
1320 );
1321
1322 try {
1323 if (model) {
1324 return await model.listModels();
1325 } else {
1326 if (msg.data.title === "Ollama") {
1327 const models = await new Ollama({ model: "" }).listModels();
1328 return models;
1329 } else if (msg.data.title === "Lemonade") {
1330 const models = await new Lemonade({ model: "" }).listModels();
1331 return models;
1332 } else {
1333 return undefined;
1334 }
1335 }
1336 } catch (e) {
1337 console.debug(`Error listing Ollama models: ${e}`);
1338 return undefined;
1339 }
1340 }
1341
1342 private async handleCompleteOnboarding(
1343 msg: Message<CompleteOnboardingPayload>,

Callers

nothing calls this directly

Calls 3

listModelsMethod · 0.65
loadConfigMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected