Skip to content

Commit 520931b

Browse files
committed
feat(AutoDevInputSection): add model selector renderer and enable sketch mode
- Add custom renderer to display model names properly in ComboBox - Enable REFACTOR command in sketch mode - Add sketch mode parameter to AutoDevInputSection constructor - Remove redundant comment and border styling
1 parent 8f908e8 commit 520931b

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

core/src/main/kotlin/cc/unitmesh/devti/command/dataprovider/BuiltinCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ enum class BuiltinCommand(
4949
AllIcons.Actions.Edit,
5050
true,
5151
true,
52-
enableInSketch = false
52+
enableInSketch = true
5353
),
5454
PATCH(
5555
"patch",

core/src/main/kotlin/cc/unitmesh/devti/gui/chat/NormalChatCodingPanel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class NormalChatCodingPanel(private val chatCodingService: ChatCodingService, va
8282
)
8383
myScrollPane.verticalScrollBar.autoscrolls = true
8484

85-
inputSection = AutoDevInputSection(chatCodingService.project, disposable).apply {
85+
inputSection = AutoDevInputSection(chatCodingService.project, disposable, true).apply {
8686
border = JBUI.Borders.empty(8)
8787
}
8888
inputSection.addListener(object : AutoDevInputListener {

core/src/main/kotlin/cc/unitmesh/devti/gui/chat/ui/AutoDevInputSection.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ class AutoDevInputSection(
128128

129129
val modelItems = LLMModelManager.getInstance().getAllAvailableModels()
130130
modelSelector = ComboBox(modelItems.toTypedArray())
131+
modelSelector.renderer = SimpleListCellRenderer.create { label: JBLabel, value: ModelItem?, _: Int ->
132+
if (value != null) {
133+
label.text = value.displayName
134+
}
135+
}
131136

132137
val currentModel = AutoDevSettingsState.getInstance().defaultModelId.ifEmpty { "Default" }
133138
for (i in 0 until modelSelector.itemCount) {
@@ -219,14 +224,12 @@ class AutoDevInputSection(
219224

220225
input.minimumSize = Dimension(input.minimumSize.width, 64)
221226
layoutPanel.addToLeft(customAgent)
222-
// Add model selector next to the custom agent dropdown
223227
layoutPanel.addToLeft(Box.createHorizontalStrut(JBUI.scale(8)))
224228
layoutPanel.addToLeft(modelSelector)
225229
} else {
226230
layoutPanel.addToLeft(modelSelector)
227231
}
228232

229-
modelSelector.border = JBUI.Borders.empty(0, 4)
230233
modelSelector.preferredSize = Dimension(200, modelSelector.preferredSize.height)
231234

232235
buttonPanel = createButtonPanel()

0 commit comments

Comments
 (0)