Skip to content

Commit 0ae0d40

Browse files
committed
fix(agent): model.update use Java List type, in kotlin should use MutableList
close #387
1 parent 14cc170 commit 0ae0d40

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import cc.unitmesh.devti.AutoDevNotifications
66
import cc.unitmesh.devti.agent.custom.model.CustomAgentConfig
77
import cc.unitmesh.devti.agent.custom.model.CustomAgentState
88
import cc.unitmesh.devti.completion.AutoDevInputLookupManagerListener
9+
import cc.unitmesh.devti.gui.AutoDevCoolBorder
910
import cc.unitmesh.devti.gui.chat.ui.file.RelatedFileListCellRenderer
1011
import cc.unitmesh.devti.gui.chat.ui.file.RelatedFileListViewModel
1112
import cc.unitmesh.devti.gui.chat.ui.file.WorkspaceFilePanel
@@ -45,7 +46,6 @@ import com.intellij.openapi.wm.IdeFocusManager
4546
import com.intellij.openapi.wm.impl.InternalDecorator
4647
import com.intellij.psi.PsiElement
4748
import com.intellij.psi.PsiManager
48-
import cc.unitmesh.devti.gui.AutoDevCoolBorder
4949
import com.intellij.ui.HintHint
5050
import com.intellij.ui.MutableCollectionComboBoxModel
5151
import com.intellij.ui.SimpleListCellRenderer
@@ -187,9 +187,9 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
187187
}
188188
}
189189
customAgent.selectedItem = defaultRag
190-
190+
191191
// Add action listener to refresh agent list when dropdown is clicked
192-
customAgent.addActionListener {
192+
customAgent.addActionListener {
193193
if (customAgent.isPopupVisible) {
194194
refreshAgentList()
195195
}
@@ -373,20 +373,20 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
373373
buttonPanel.isEnabled = true
374374
}
375375

376-
private fun loadAgents(): List<CustomAgentConfig> {
376+
private fun loadAgents(): MutableList<CustomAgentConfig> {
377377
val rags = CustomAgentConfig.loadFromProject(project)
378378

379-
if (rags.isEmpty()) return listOf(defaultRag)
379+
if (rags.isEmpty()) return mutableListOf(defaultRag)
380380

381-
return listOf(defaultRag) + rags
381+
return (listOf(defaultRag) + rags).toMutableList()
382382
}
383-
383+
384384
private fun refreshAgentList() {
385385
val currentSelection = customAgent.selectedItem
386386
val agents = loadAgents()
387387
val model = customAgent.model as MutableCollectionComboBoxModel<CustomAgentConfig>
388388
model.update(agents)
389-
389+
390390
// Try to restore the previous selection
391391
if (currentSelection != null && agents.contains(currentSelection)) {
392392
customAgent.selectedItem = currentSelection

0 commit comments

Comments
 (0)