Skip to content

Commit fd8437f

Browse files
committed
feat(chat): add model indicator in chat input section
Add a label that displays the currently selected AI model next to the agent dropdown in the AutoDevInputSection. The label shows "Default" when no specific model is selected.
1 parent 4d72e00 commit fd8437f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
7575
private val stopButtonPresentation: Presentation
7676
private val enhanceButtonPresentation: Presentation
7777
private val sendButton: ActionButton
78+
private val modelLabel: JBLabel
7879
private val stopButton: ActionButton
7980
private val enhanceButton: ActionButton
8081
private var buttonPanel: JPanel = JPanel(CardLayout())
@@ -120,6 +121,10 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
120121
input = AutoDevInput(project, listOf(), disposable, this)
121122
workspaceFilePanel = WorkspaceFilePanel(project)
122123

124+
// Create a label to display the current model ID
125+
val modelId = AutoDevSettingsState.getInstance().defaultModelId.ifEmpty { "Default" }
126+
modelLabel = JBLabel("Model: $modelId").apply { foreground = JBUI.CurrentTheme.Label.disabledForeground() }
127+
123128
setupElementsList()
124129
val sendButtonPresentation = Presentation(AutoDevBundle.message("chat.panel.send"))
125130
sendButtonPresentation.icon = AutoDevIcons.SEND
@@ -197,6 +202,11 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
197202

198203
input.minimumSize = Dimension(input.minimumSize.width, 64)
199204
layoutPanel.addToLeft(customAgent)
205+
// Add model label next to the custom agent dropdown
206+
layoutPanel.addToLeft(Box.createHorizontalStrut(JBUI.scale(8)))
207+
layoutPanel.addToLeft(modelLabel)
208+
} else {
209+
layoutPanel.addToLeft(modelLabel)
200210
}
201211

202212
buttonPanel = createButtonPanel()
@@ -488,5 +498,4 @@ fun JComponent.mediumFontFunction() {
488498
it.font = JBFont.medium()
489499
}
490500
putClientProperty(FONT_KEY, f)
491-
}
492-
501+
}

0 commit comments

Comments
 (0)