From e635c31a441a6bc80d5bc29d43df09cb324b58ee Mon Sep 17 00:00:00 2001 From: Tom Ross Date: Fri, 23 Aug 2024 15:51:31 +0100 Subject: [PATCH] Edit: Support multiple models on enterprise (#5289) ## Description Enable multiple model selection on enterprise ### Screenshots ### Multiple models supported image ### Multiple models supported, with allowlist/denylist image ### Single model supported, with Ollama (selection shown) image ### Single model supported no Ollama (no selection shown) image ## Test plan Tested using different model config options on an enterprise instance: - Multiple models - Multiple models with allow/denylist - Single completions model - Single completions model with Ollama Tested: - UI is functional - Edits work correctly (responses are applied) --- vscode/src/edit/input/get-input.ts | 2 +- vscode/src/edit/input/get-items/model.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vscode/src/edit/input/get-input.ts b/vscode/src/edit/input/get-input.ts index 154ce627dd79..0ea6f675dc82 100644 --- a/vscode/src/edit/input/get-input.ts +++ b/vscode/src/edit/input/get-input.ts @@ -100,7 +100,7 @@ export const getInput = async ( const isCodyPro = !authStatus.userCanUpgrade const modelOptions = modelsService.getModels(ModelUsage.Edit) const modelItems = getModelOptionItems(modelOptions, isCodyPro) - const showModelSelector = modelOptions.length > 1 && authStatus.isDotCom + const showModelSelector = modelOptions.length > 1 let activeModel = initialValues.initialModel let activeModelItem = modelItems.find(item => item.model === initialValues.initialModel) diff --git a/vscode/src/edit/input/get-items/model.ts b/vscode/src/edit/input/get-items/model.ts index 1b7d991a206e..83e85288aeb6 100644 --- a/vscode/src/edit/input/get-items/model.ts +++ b/vscode/src/edit/input/get-items/model.ts @@ -29,12 +29,13 @@ export const getModelOptionItems = (modelOptions: Model[], isCodyPro: boolean): const allOptions = modelOptions .map(modelOption => { const icon = getModelProviderIcon(modelOption.provider) + const title = modelOption.title || modelOption.id return { - label: `${QUICK_PICK_ITEM_EMPTY_INDENT_PREFIX} ${icon} ${modelOption.title}`, + label: `${QUICK_PICK_ITEM_EMPTY_INDENT_PREFIX} ${icon} ${title}`, description: `by ${modelOption.provider}`, alwaysShow: true, model: modelOption.id, - modelTitle: modelOption.title, + modelTitle: title, codyProOnly: isCodyProModel(modelOption), } })