1
1
package cc.unitmesh.devti.mcp.editor
2
2
3
3
import cc.unitmesh.devti.AutoDevIcons
4
+ import cc.unitmesh.devti.AutoDevBundle
4
5
import cc.unitmesh.devti.AutoDevNotifications
5
6
import cc.unitmesh.devti.llm2.model.LlmConfig
6
7
import cc.unitmesh.devti.llms.custom.CustomLLMProvider
@@ -80,7 +81,7 @@ open class McpPreviewEditor(
80
81
private fun createUI () {
81
82
val headerPanel = panel {
82
83
row {
83
- val label = JBLabel (" MCP tools " ).apply {
84
+ val label = JBLabel (AutoDevBundle .message( " mcp.preview.editor.title " ) ).apply {
84
85
font = JBUI .Fonts .label(14.0f ).asBold()
85
86
border = JBUI .Borders .emptyLeft(8 )
86
87
isOpaque = true
@@ -89,7 +90,7 @@ open class McpPreviewEditor(
89
90
cell(label).align(Align .FILL ).resizableColumn()
90
91
91
92
searchField = SearchTextField ().apply {
92
- textEditor.emptyText.text = " Search tools... "
93
+ textEditor.emptyText.text = AutoDevBundle .message( " mcp.preview.editor.search.placeholder " )
93
94
textEditor.document.addDocumentListener(object : DocumentListener {
94
95
override fun insertUpdate (e : DocumentEvent ) = filterTools()
95
96
override fun removeUpdate (e : DocumentEvent ) = filterTools()
@@ -142,7 +143,7 @@ open class McpPreviewEditor(
142
143
background = UIUtil .getPanelBackground()
143
144
}
144
145
145
- val chatbotLabel = JBLabel (" Model " )
146
+ val chatbotLabel = JBLabel (AutoDevBundle .message( " mcp.preview.editor.model.label " ) )
146
147
147
148
val llmConfigs = LlmConfig .load()
148
149
val modelNames = if (llmConfigs.isEmpty()) {
@@ -152,7 +153,7 @@ open class McpPreviewEditor(
152
153
}
153
154
154
155
chatbotSelector = com.intellij.openapi.ui.ComboBox (modelNames)
155
- configButton = JButton (" Configure " ).apply {
156
+ configButton = JButton (AutoDevBundle .message( " mcp.preview.editor.configure.button " ) ).apply {
156
157
isFocusPainted = false
157
158
addActionListener {
158
159
showConfigDialog()
@@ -191,7 +192,7 @@ open class McpPreviewEditor(
191
192
testButton = ActionButton (
192
193
DumbAwareAction .create { sendMessage() },
193
194
sendPresentation,
194
- " McpSendAction" ,
195
+ " McpSendAction" ,
195
196
Dimension (JBUI .scale(30 ), JBUI .scale(30 ))
196
197
)
197
198
val sendButtonPanel = JPanel (FlowLayout (FlowLayout .CENTER , 0 , 0 )).apply {
@@ -247,7 +248,7 @@ open class McpPreviewEditor(
247
248
}
248
249
249
250
if (chatInput.text.isEmpty()) {
250
- AutoDevNotifications .warn(project, " Please enter a message to send. " )
251
+ AutoDevNotifications .warn(project, AutoDevBundle .message( " mcp.preview.editor.empty. message.warning " ) )
251
252
return
252
253
}
253
254
@@ -263,7 +264,7 @@ open class McpPreviewEditor(
263
264
val stream: Flow <String > = llmProvider.stream(message, systemPrompt = systemPrompt)
264
265
265
266
resultPanel.reset()
266
- resultPanel.setText(" Loading response... " )
267
+ resultPanel.setText(AutoDevBundle .message( " mcp.preview.editor.loading.response " ) )
267
268
resultPanel.isVisible = true
268
269
mainPanel.revalidate()
269
270
mainPanel.repaint()
0 commit comments