Skip to content

Commit 46efe24

Browse files
committed
feat: add json path for config
1 parent cd413c3 commit 46efe24

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

src/main/kotlin/cc/unitmesh/devti/settings/AppSettingsComponent.kt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
package cc.unitmesh.devti.settings
22

3+
import cc.unitmesh.devti.AutoDevBundle
4+
import com.intellij.collaboration.messages.CollaborationToolsBundle
35
import com.intellij.json.JsonLanguage
6+
import com.intellij.jsonpath.JsonPathFileType
47
import com.intellij.jsonpath.psi.JsonPathFile
58
import com.intellij.openapi.editor.colors.EditorColorsUtil
69
import com.intellij.openapi.editor.ex.EditorEx
710
import com.intellij.openapi.project.ProjectManager
811
import com.intellij.openapi.ui.ComboBox
12+
import com.intellij.ui.EditorTextField
913
import com.intellij.ui.LanguageTextField
1014
import com.intellij.ui.components.JBLabel
1115
import com.intellij.ui.components.JBPasswordField
@@ -33,21 +37,29 @@ class AppSettingsComponent(settings: AutoDevSettingsState) {
3337
private val aiEngine = ComboBox(AI_ENGINES)
3438
private val customEngineServer = JBTextField()
3539
private val customEngineToken = JBTextField()
36-
private val customEngineResponseFormat = JBTextField()
40+
val project = ProjectManager.getInstance().openProjects.firstOrNull()
41+
42+
private val customEngineResponseFormat by lazy {
43+
object : EditorTextField(project, JsonPathFileType.INSTANCE) {
44+
45+
}.apply {
46+
setOneLineMode(true)
47+
setPlaceholder(AutoDevBundle.message("autodev.custom.response.format.placeholder"))
48+
}
49+
}
50+
3751
private val language = ComboBox(HUMAN_LANGUAGES)
3852
private val maxTokenLengthInput = JBTextField()
3953

4054
private val customEnginePrompt by lazy {
41-
val project = ProjectManager.getInstance().openProjects.firstOrNull()
42-
4355
object : LanguageTextField(JsonLanguage.INSTANCE, project, "") {
4456
override fun createEditor(): EditorEx {
4557

4658
return super.createEditor().apply {
4759
setShowPlaceholderWhenFocused(true)
4860
setHorizontalScrollbarVisible(false)
4961
setVerticalScrollbarVisible(true)
50-
setPlaceholder("Enter custom prompt here")
62+
setPlaceholder(AutoDevBundle.message("autodev.custom.prompt.placeholder"))
5163

5264

5365
val scheme = EditorColorsUtil.getColorSchemeForBackground(this.colorsScheme.defaultBackground)

src/main/resources/messages/AutoDevBundle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ intentions.companion.api.name=Talk with API
4444
intentions.companion.api.family.name=AutoDev: Talk with API
4545
intentions.living.documentation.name=Generate Living Doc
4646
intentions.living.documentation.family.name=Generate documentation
47-
intentions.request.background.process.title=LLM is processing your request
47+
intentions.request.background.process.title=LLM is processing your request
48+
autodev.custom.response.format.placeholder=Use json path, for example: `$.choices[0].delta.content`
49+
autodev.custom.prompt.placeholder=Custom your prompt here

0 commit comments

Comments
 (0)