From 61fadbf37987bc240544ee45b2395422a57c0f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Kondratek?= Date: Thu, 28 Nov 2024 11:14:02 +0100 Subject: [PATCH] Disable dropdown when fixedModel is defined --- src/main/kotlin/com/sourcegraph/cody/chat/ui/LlmDropdown.kt | 6 +++--- .../kotlin/com/sourcegraph/cody/edit/EditCommandPrompt.kt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/sourcegraph/cody/chat/ui/LlmDropdown.kt b/src/main/kotlin/com/sourcegraph/cody/chat/ui/LlmDropdown.kt index 252687783b..d1ddf9ee32 100644 --- a/src/main/kotlin/com/sourcegraph/cody/chat/ui/LlmDropdown.kt +++ b/src/main/kotlin/com/sourcegraph/cody/chat/ui/LlmDropdown.kt @@ -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(MutableCollectionComboBoxModel()) { private val serverToRecentModel = HashMap() @@ -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) diff --git a/src/main/kotlin/com/sourcegraph/cody/edit/EditCommandPrompt.kt b/src/main/kotlin/com/sourcegraph/cody/edit/EditCommandPrompt.kt index 2fac6793be..34a98ac130 100644 --- a/src/main/kotlin/com/sourcegraph/cody/edit/EditCommandPrompt.kt +++ b/src/main/kotlin/com/sourcegraph/cody/edit/EditCommandPrompt.kt @@ -135,7 +135,7 @@ class EditCommandPrompt( project = project, onSetSelectedItem = { model = it.id }, this, - model = model) + fixedModel = model) .apply { foreground = boldLabelColor() background = textFieldBackground()