Skip to content

Commit

Permalink
Edit: Support multiple models on enterprise (#5289)
Browse files Browse the repository at this point in the history
## Description

Enable multiple model selection on enterprise

### Screenshots

### Multiple models supported

<img width="673" alt="image"
src="https://github.com/user-attachments/assets/0b59780c-dd6d-4fef-99ad-e508bd542c7b">

### Multiple models supported, with allowlist/denylist

<img width="718" alt="image"
src="https://github.com/user-attachments/assets/74e14e58-3219-46bd-b9a9-a650f672bc1f">

### Single model supported, with Ollama (selection shown)

<img width="640" alt="image"
src="https://github.com/user-attachments/assets/e5bff2c7-6f5e-42cd-bfda-5a151ddf9755">


### Single model supported no Ollama (no selection shown)

<img width="687" alt="image"
src="https://github.com/user-attachments/assets/fbd530cf-4586-475c-a658-b60f94e25480">


## 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)

<!-- Required. See
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles.
-->
  • Loading branch information
umpox authored Aug 23, 2024
1 parent 6343eef commit e635c31
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion vscode/src/edit/input/get-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions vscode/src/edit/input/get-items/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
})
Expand Down

0 comments on commit e635c31

Please sign in to comment.