@@ -6,9 +6,15 @@ import cc.unitmesh.devti.gui.component.JsonLanguageField
6
6
import cc.unitmesh.devti.settings.locale.HUMAN_LANGUAGES
7
7
import cc.unitmesh.devti.settings.locale.LanguageChangedCallback
8
8
import cc.unitmesh.devti.settings.locale.LanguageChangedCallback.jBLabel
9
+ import com.intellij.lang.Language
10
+ import com.intellij.openapi.editor.Document
11
+ import com.intellij.openapi.project.Project
9
12
import com.intellij.openapi.project.ProjectManager
13
+ import com.intellij.psi.PsiFile
10
14
import com.intellij.ui.EditorTextField
11
15
import com.intellij.ui.JBColor
16
+ import com.intellij.ui.LanguageTextField
17
+ import com.intellij.ui.LanguageTextField.SimpleDocumentCreator
12
18
import com.intellij.ui.dsl.builder.panel
13
19
import com.intellij.util.ui.FormBuilder
14
20
import javax.swing.JPanel
@@ -27,8 +33,8 @@ class LLMSettingComponent(private val settings: AutoDevSettingsState) {
27
33
private val customEngineServerParam by LLMParam .creating { Editable (settings.customEngineServer) }
28
34
private val customEngineTokenParam by LLMParam .creating { Password (settings.customEngineToken) }
29
35
30
- private val customEngineResponseFormatParam by LLMParam .creating { Editable (settings.customEngineResponseFormat) }
31
- private val customEngineRequestBodyFormatParam by LLMParam .creating { Editable (settings.customEngineRequestFormat) }
36
+ private val customEngineResponseFormatParam by LLMParam .creating { JsonPathEditable (settings.customEngineResponseFormat) }
37
+ private val customEngineRequestBodyFormatParam by LLMParam .creating { JsonEditable (settings.customEngineRequestFormat) }
32
38
33
39
val project = ProjectManager .getInstance().openProjects.firstOrNull()
34
40
private val customLlmParam: EditorTextField by lazy {
@@ -75,6 +81,23 @@ class LLMSettingComponent(private val settings: AutoDevSettingsState) {
75
81
}, 1 , false )
76
82
}
77
83
84
+ LLMParam .ParamType .JsonText -> {
85
+ formBuilder.addLabeledComponent(jBLabel(this .label), cc.unitmesh.devti.provider.local.JsonLanguageField (
86
+ project, this .value, AutoDevBundle .messageWithLanguageFromLLMSetting(this .label), null , true
87
+ ), 1 , false )
88
+ }
89
+
90
+ LLMParam .ParamType .JsonPath -> {
91
+ formBuilder.addLabeledComponent(jBLabel(this .label), LanguageTextField (
92
+ Language .findLanguageByID(" JSONPath" ), project, value,
93
+ object : SimpleDocumentCreator () {
94
+ override fun createDocument (value : String? , language : Language ? , project : Project ? ): Document {
95
+ return LanguageTextField .createDocument(value, language, project, this )
96
+ }
97
+ }
98
+ ), 1 , false )
99
+ }
100
+
78
101
LLMParam .ParamType .ComboBox -> {
79
102
formBuilder.addLabeledComponent(jBLabel(this .label), ReactiveComboBox (this ), 1 , false )
80
103
}
0 commit comments