Skip to content

Commit 67f9d40

Browse files
author
Calvinn Ng
committed
re-add commandModels and tabCompletionModels
1 parent 780611d commit 67f9d40

File tree

2 files changed

+42
-4
lines changed

2 files changed

+42
-4
lines changed

core/config/load.ts

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,45 @@ async function intermediateToFinalConfig(
338338
if (config.tabAutocompleteModels) {
339339
tabAutocompleteModels = (
340340
await Promise.all(
341-
(Array.isArray(config.tabAutocompleteModel)
342-
? config.tabAutocompleteModel
343-
: [config.tabAutocompleteModel]
341+
(Array.isArray(config.tabAutocompleteModels)
342+
? config.tabAutocompleteModels
343+
: [config.tabAutocompleteModels]
344+
).map(async (desc) => {
345+
if (isModelDescription(desc)) {
346+
const llm = await llmFromDescription(
347+
desc,
348+
ide.readFile.bind(ide),
349+
uniqueId,
350+
ideSettings,
351+
writeLog,
352+
config.completionOptions,
353+
config.systemMessage,
354+
);
355+
356+
if (llm?.providerName === "free-trial") {
357+
if (!allowFreeTrial) {
358+
// This shouldn't happen
359+
throw new Error("Free trial cannot be used with control plane");
360+
}
361+
const ghAuthToken = await ide.getGitHubAuthToken();
362+
(llm as FreeTrial).setupGhAuthToken(ghAuthToken);
363+
}
364+
return llm;
365+
} else {
366+
return new CustomLLMClass(desc);
367+
}
368+
}),
369+
)
370+
).filter((x) => x !== undefined) as BaseLLM[];
371+
372+
// Command model
373+
let commandModels: BaseLLM[] = [];
374+
if (config.commandModels) {
375+
commandModels = (
376+
await Promise.all(
377+
(Array.isArray(config.commandModels)
378+
? config.commandModels
379+
: [config.commandModels]
344380
).map(async (desc) => {
345381
if (isModelDescription(desc)) {
346382
const llm = await llmFromDescription(
@@ -440,6 +476,7 @@ async function intermediateToFinalConfig(
440476
reranker: config.reranker as any,
441477
};
442478
}
479+
}
443480

444481
function finalToBrowserConfig(
445482
final: ContinueConfig,

core/index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ export interface Config {
888888
* Continue will do the rest of the work to construct prompt templates, handle context items, prune context, etc.
889889
*/
890890
models: (CustomLLM | ModelDescription)[];
891+
commandModels: ModelDescription[];
891892
/** A system message to be followed by all of your models */
892893
systemMessage?: string;
893894
/** The default completion options for all models */
@@ -909,7 +910,7 @@ export interface Config {
909910
/** The provider used to calculate embeddings. If left empty, Continue will use transformers.js to calculate the embeddings with all-MiniLM-L6-v2 */
910911
embeddingsProvider?: EmbeddingsProviderDescription | EmbeddingsProvider;
911912
/** The model that Continue will use for tab autocompletions. */
912-
tabAutocompleteModel?:
913+
tabAutocompleteModels?:
913914
| CustomLLM
914915
| ModelDescription
915916
| (CustomLLM | ModelDescription)[];

0 commit comments

Comments
 (0)