Skip to content

Commit

Permalink
Disable dropdown when fixedModel is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
mkondratek committed Nov 28, 2024
1 parent 702ee03 commit 61fadbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/com/sourcegraph/cody/chat/ui/LlmDropdown.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class LlmDropdown(
private val project: Project,
private val onSetSelectedItem: (Model) -> Unit,
val parentDialog: EditCommandPrompt?,
private val model: String? = null
private val fixedModel: String? = null
) : ComboBox<ModelAvailabilityStatus>(MutableCollectionComboBoxModel()) {

private val serverToRecentModel = HashMap<SourcegraphServerPath, Model>()
Expand Down Expand Up @@ -74,10 +74,10 @@ class LlmDropdown(
val defaultLlm = serverToRecentModel[CodyAccount.getActiveAccount()?.server]

selectedItem =
availableModels.find { it.model.id == model || it.model.id == defaultLlm?.id }
availableModels.find { it.model.id == fixedModel || it.model.id == defaultLlm?.id }
?: models.firstOrNull()

isEnabled = true
isEnabled = fixedModel != null
isVisible = selectedItem != null
setMaximumRowCount(15)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class EditCommandPrompt(
project = project,
onSetSelectedItem = { model = it.id },
this,
model = model)
fixedModel = model)
.apply {
foreground = boldLabelColor()
background = textFieldBackground()
Expand Down

0 comments on commit 61fadbf

Please sign in to comment.