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

Function intermediateToFinalConfig

core/config/load.ts:234–596  ·  view source on GitHub ↗

Only difference between intermediate and final configs is the `models` array

({
  config,
  ide,
  ideSettings,
  ideInfo,
  uniqueId,
  llmLogger,
  loadPromptFiles = true,
}: {
  config: Config;
  ide: IDE;
  ideSettings: IdeSettings;
  ideInfo: IdeInfo;
  uniqueId: string;
  llmLogger: ILLMLogger;
  loadPromptFiles?: boolean;
})

Source from the content-addressed store, hash-verified

232
233/** Only difference between intermediate and final configs is the `models` array */
234async function intermediateToFinalConfig({
235 config,
236 ide,
237 ideSettings,
238 ideInfo,
239 uniqueId,
240 llmLogger,
241 loadPromptFiles = true,
242}: {
243 config: Config;
244 ide: IDE;
245 ideSettings: IdeSettings;
246 ideInfo: IdeInfo;
247 uniqueId: string;
248 llmLogger: ILLMLogger;
249 loadPromptFiles?: boolean;
250}): Promise<{ config: ContinueConfig; errors: ConfigValidationError[] }> {
251 const errors: ConfigValidationError[] = [];
252 const workspaceDirs = await ide.getWorkspaceDirs();
253 const getUriFromPath = (path: string) => {
254 return resolveRelativePathInDir(path, ide, workspaceDirs);
255 };
256 // Auto-detect models
257 let models: BaseLLM[] = [];
258 await Promise.all(
259 config.models.map(async (desc) => {
260 if ("title" in desc) {
261 const llm = await llmFromDescription(
262 desc,
263 ide.readFile.bind(ide),
264 getUriFromPath,
265 uniqueId,
266 ideSettings,
267 llmLogger,
268 config.completionOptions,
269 );
270 if (!llm) {
271 return;
272 }
273
274 if (llm.model === "AUTODETECT") {
275 try {
276 const modelNames = await llm.listModels();
277 const detectedModels = await Promise.all(
278 modelNames.map(async (modelName) => {
279 return await llmFromDescription(
280 {
281 ...desc,
282 model: modelName,
283 title: modelName,
284 isFromAutoDetect: true,
285 },
286 ide.readFile.bind(ide),
287 getUriFromPath,
288 uniqueId,
289 ideSettings,
290 llmLogger,
291 copyOf(config.completionOptions),

Callers 1

Calls 15

llmFromDescriptionFunction · 0.90
copyOfFunction · 0.90
getBaseToolDefinitionsFunction · 0.90
loadJsonMcpConfigsFunction · 0.90
getModelByRoleFunction · 0.90
getEmbeddingsILLMFunction · 0.85
getRerankingILLMFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected