@@ -6,6 +6,7 @@ import cc.unitmesh.devti.AutoDevNotifications
6
6
import cc.unitmesh.devti.agent.custom.model.CustomAgentConfig
7
7
import cc.unitmesh.devti.agent.custom.model.CustomAgentState
8
8
import cc.unitmesh.devti.completion.AutoDevInputLookupManagerListener
9
+ import cc.unitmesh.devti.gui.AutoDevCoolBorder
9
10
import cc.unitmesh.devti.gui.chat.ui.file.RelatedFileListCellRenderer
10
11
import cc.unitmesh.devti.gui.chat.ui.file.RelatedFileListViewModel
11
12
import cc.unitmesh.devti.gui.chat.ui.file.WorkspaceFilePanel
@@ -45,7 +46,6 @@ import com.intellij.openapi.wm.IdeFocusManager
45
46
import com.intellij.openapi.wm.impl.InternalDecorator
46
47
import com.intellij.psi.PsiElement
47
48
import com.intellij.psi.PsiManager
48
- import cc.unitmesh.devti.gui.AutoDevCoolBorder
49
49
import com.intellij.ui.HintHint
50
50
import com.intellij.ui.MutableCollectionComboBoxModel
51
51
import com.intellij.ui.SimpleListCellRenderer
@@ -187,9 +187,9 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
187
187
}
188
188
}
189
189
customAgent.selectedItem = defaultRag
190
-
190
+
191
191
// Add action listener to refresh agent list when dropdown is clicked
192
- customAgent.addActionListener {
192
+ customAgent.addActionListener {
193
193
if (customAgent.isPopupVisible) {
194
194
refreshAgentList()
195
195
}
@@ -373,20 +373,20 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
373
373
buttonPanel.isEnabled = true
374
374
}
375
375
376
- private fun loadAgents (): List <CustomAgentConfig > {
376
+ private fun loadAgents (): MutableList <CustomAgentConfig > {
377
377
val rags = CustomAgentConfig .loadFromProject(project)
378
378
379
- if (rags.isEmpty()) return listOf (defaultRag)
379
+ if (rags.isEmpty()) return mutableListOf (defaultRag)
380
380
381
- return listOf (defaultRag) + rags
381
+ return ( listOf (defaultRag) + rags).toMutableList()
382
382
}
383
-
383
+
384
384
private fun refreshAgentList () {
385
385
val currentSelection = customAgent.selectedItem
386
386
val agents = loadAgents()
387
387
val model = customAgent.model as MutableCollectionComboBoxModel <CustomAgentConfig >
388
388
model.update(agents)
389
-
389
+
390
390
// Try to restore the previous selection
391
391
if (currentSelection != null && agents.contains(currentSelection)) {
392
392
customAgent.selectedItem = currentSelection
0 commit comments