Skip to content

Commit a5c8122

Browse files
committed
feat(mcp): integrate LLM config with chatbot selector #337
- Load LLM configurations to populate chatbot selector- Update chatbot selector to use model names from LLM config - Remove unused icon placeholder in selector panel
1 parent d8244d4 commit a5c8122

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

core/src/main/kotlin/cc/unitmesh/devti/mcp/editor/McpPreviewEditor.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cc.unitmesh.devti.mcp.editor
22

33
import cc.unitmesh.devti.mcp.client.CustomMcpServerManager
4+
import cc.unitmesh.devti.llm2.model.LlmConfig
45
import com.intellij.openapi.application.runReadAction
56
import com.intellij.openapi.editor.Editor
67
import com.intellij.openapi.fileEditor.FileEditor
@@ -152,18 +153,18 @@ open class McpPreviewEditor(
152153
background = UIUtil.getPanelBackground()
153154
}
154155

155-
// Icon placeholder
156-
val iconPlaceholder = JPanel().apply {
157-
preferredSize = Dimension(20, 20)
158-
background = UIUtil.getPanelBackground()
159-
border = BorderFactory.createLineBorder(primaryBlue, 1)
160-
}
161-
162156
val chatbotLabel = JBLabel("Chatbot:").apply {
163157
font = JBUI.Fonts.label(14.0f)
164158
}
165159

166-
chatbotSelector = JComboBox(arrayOf("GPT-4", "Claude", "Llama 3")).apply {
160+
val llmConfigs = LlmConfig.load()
161+
val modelNames = if (llmConfigs.isEmpty()) {
162+
arrayOf("No LLMs configured")
163+
} else {
164+
llmConfigs.map { it.name }.toTypedArray()
165+
}
166+
167+
chatbotSelector = com.intellij.openapi.ui.ComboBox(modelNames).apply {
167168
font = JBUI.Fonts.label(14.0f)
168169
}
169170

@@ -173,7 +174,6 @@ open class McpPreviewEditor(
173174
addActionListener { showConfigDialog() }
174175
}
175176

176-
selectorPanel.add(iconPlaceholder)
177177
selectorPanel.add(chatbotLabel)
178178
selectorPanel.add(chatbotSelector)
179179

0 commit comments

Comments
 (0)