Skip to content

Commit fca0563

Browse files
committed
feat(settings): update UI and schema handling for AutoDev #257
- Add "(可选)" to optional settings in Chinese locale. - Reorder project configurables and add new JSON schema extensions. - Update schema file provider to use VfsUtil for resource handling. - Adjust UI layout in LLMSettingComponent. - Bump plugin version to 2.0.0-ALPHA1.
1 parent 36a5c7d commit fca0563

File tree

6 files changed

+27
-27
lines changed

6 files changed

+27
-27
lines changed

core/src/223/main/resources/META-INF/autodev-core.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
id="cc.unitmesh.devti.settings.AutoDevSettingsConfigurable"
1212
displayName="AutoDev"/>
1313

14+
<projectConfigurable provider="cc.unitmesh.devti.settings.devops.AutoDevDevOpsConfigurableProvider"
15+
parentId="cc.unitmesh.devti.settings.AutoDevSettingsConfigurable"
16+
id="cc.unitmesh.autodevDevOps"
17+
bundle="messages.AutoDevBundle" key="settings.autodev.devops"/>
18+
1419
<projectConfigurable provider="cc.unitmesh.devti.agent.configurable.CoUnitToolConfigurableProvider"
1520
parentId="cc.unitmesh.devti.settings.AutoDevSettingsConfigurable"
1621
id="cc.unitmesh.counit"
@@ -26,11 +31,6 @@
2631
id="cc.unitmesh.autodevCoder"
2732
bundle="messages.AutoDevBundle" key="settings.autodev.coder"/>
2833

29-
<projectConfigurable provider="cc.unitmesh.devti.settings.devops.AutoDevDevOpsConfigurableProvider"
30-
parentId="cc.unitmesh.devti.settings.AutoDevSettingsConfigurable"
31-
id="cc.unitmesh.autodevDevOps"
32-
bundle="messages.AutoDevBundle" key="settings.autodev.devops"/>
33-
3434
<applicationService serviceImplementation="cc.unitmesh.devti.settings.AutoDevSettingsState"/>
3535

3636
<applicationService

core/src/233/main/resources/META-INF/autodev-core.xml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
id="cc.unitmesh.devti.settings.AutoDevSettingsConfigurable"
1212
displayName="AutoDev"/>
1313

14+
<projectConfigurable provider="cc.unitmesh.devti.settings.devops.AutoDevDevOpsConfigurableProvider"
15+
parentId="cc.unitmesh.devti.settings.AutoDevSettingsConfigurable"
16+
id="cc.unitmesh.autodevDevOps"
17+
bundle="messages.AutoDevBundle" key="settings.autodev.devops"/>
18+
1419
<projectConfigurable provider="cc.unitmesh.devti.agent.configurable.CoUnitToolConfigurableProvider"
1520
parentId="cc.unitmesh.devti.settings.AutoDevSettingsConfigurable"
1621
id="cc.unitmesh.counit"
@@ -26,11 +31,6 @@
2631
id="cc.unitmesh.autodevCoder"
2732
bundle="messages.AutoDevBundle" key="settings.autodev.coder"/>
2833

29-
<projectConfigurable provider="cc.unitmesh.devti.settings.devops.AutoDevDevOpsConfigurableProvider"
30-
parentId="cc.unitmesh.devti.settings.AutoDevSettingsConfigurable"
31-
id="cc.unitmesh.autodevDevOps"
32-
bundle="messages.AutoDevBundle" key="settings.autodev.devops"/>
33-
3434
<applicationService serviceImplementation="cc.unitmesh.devti.settings.AutoDevSettingsState"/>
3535

3636
<applicationService
@@ -80,6 +80,11 @@
8080
implementation="cc.unitmesh.devti.gui.snippet.error.CodeBlockIntentionActionFilter"/>
8181
</extensions>
8282

83+
<extensions defaultExtensionNs="JavaScript.JsonSchema">
84+
<ProviderFactory implementation="cc.unitmesh.devti.custom.schema.AutoDevJsonSchemaProviderFactory"/>
85+
<ProviderFactory implementation="cc.unitmesh.devti.custom.schema.AutoDevPromptJsonSchemaProviderFactory"/>
86+
</extensions>
87+
8388
<extensionPoints>
8489
<extensionPoint qualifiedName="cc.unitmesh.autoDevIntention"
8590
beanClass="com.intellij.codeInsight.intention.IntentionActionBean"

core/src/main/kotlin/cc/unitmesh/devti/custom/schema/CustomAgentSchemaFileProvider.kt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package cc.unitmesh.devti.custom.schema
22

33
import com.intellij.openapi.application.runReadAction
44
import com.intellij.openapi.project.Project
5+
import com.intellij.openapi.vfs.VfsUtil
56
import com.intellij.openapi.vfs.VirtualFile
67
import com.jetbrains.jsonSchema.extension.JsonSchemaFileProvider
7-
import com.jetbrains.jsonSchema.extension.JsonSchemaProviderFactory
88
import com.jetbrains.jsonSchema.extension.SchemaType
99

1010
const val CUSTOM_AGENT_FILE_NAME = "AutoDevCustomAgentFile.json"
@@ -23,16 +23,10 @@ class CustomAgentSchemaFileProvider(val project: Project): JsonSchemaFileProvide
2323
}
2424

2525
override fun getName(): String = "AutoDevCustomAgentFile"
26-
27-
override fun getSchemaFile(): VirtualFile? {
28-
return JsonSchemaProviderFactory.getResourceFile(this::class.java, customAgentSchemaFile)
29-
}
30-
31-
override fun getSchemaType(): SchemaType {
32-
return SchemaType.schema
33-
}
26+
override fun getSchemaFile() = VfsUtil.findFileByURL(javaClass.getResource(CUSTOM_AGENT_SCHEMA_FILE)!!)
27+
override fun getSchemaType(): SchemaType = SchemaType.embeddedSchema
3428

3529
companion object {
36-
private const val customAgentSchemaFile = "autodev-custom-agent.json"
30+
private const val CUSTOM_AGENT_SCHEMA_FILE = "autodev-custom-agent.json"
3731
}
3832
}

core/src/main/kotlin/cc/unitmesh/devti/settings/LLMSettingComponent.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class LLMSettingComponent(private val settings: AutoDevSettingsState) {
3737
settings.customPrompts,
3838
AutoDevBundle.messageWithLanguageFromLLMSetting("autodev.custom.prompt.placeholder"),
3939
CUSTOM_AGENT_FILE_NAME
40-
).apply { LanguageChangedCallback.placeholder("autodev.custom.prompt.placeholder", this, 1) }
40+
).apply {
41+
LanguageChangedCallback.placeholder("autodev.custom.prompt.placeholder", this, 1)
42+
}
4143
}
4244

4345
private val currentLLMParams: List<LLMParam>
@@ -96,7 +98,6 @@ class LLMSettingComponent(private val settings: AutoDevSettingsState) {
9698
.addLLMParams(currentLLMParams)
9799
.addLLMParam(maxTokenLengthParam)
98100
.addLLMParam(delaySecondsParam)
99-
.addSeparator()
100101
.addComponent(panel {
101102
if (project != null) {
102103
testLLMConnection(project)
@@ -108,8 +109,8 @@ class LLMSettingComponent(private val settings: AutoDevSettingsState) {
108109
}
109110
}
110111
})
111-
.addVerticalGap(2)
112112
.addSeparator()
113+
.addVerticalGap(2)
113114
.addLabeledComponent(jBLabel("settings.autodev.coder.customEnginePrompt", 1), customEnginePrompt, 1, true)
114115
.addComponentFillVertically(JPanel(), 0)
115116
.panel

core/src/main/resources/messages/AutoDevBundle_zh.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ settings.customEngineServerParam=LLM 服务器 URL
6161
settings.customModelParam=模型名称
6262
settings.customEngineTokenParam=LLM 服务器密钥
6363

64-
settings.delaySecondsParam=请求延迟秒数
64+
settings.delaySecondsParam=请求延迟秒数(可选)
6565
settings.customEngineResponseFormatParam=自定义响应格式(Json 路径)
6666
settings.customEngineResponseTypeParam=自定义响应类型
6767
settings.customEngineRequestBodyFormatParam=自定义请求主体格式(Json)
@@ -99,7 +99,7 @@ settings.autodev.coder.generateTest=生成测试
9999
settings.autodev.coder.useCustomAIEngineWhenInlayCodeComplete=使用自定义 AI 模型
100100
settings.autodev.coder.useCustomAIEngineWhenInlayCodeComplete.tips=使用自定义LLM来进行代码补全
101101
settings.autodev.coder.delaySecondsParam=请求延迟秒数
102-
settings.autodev.coder.maxTokenLengthParam=最大 token 长度
102+
settings.autodev.coder.maxTokenLengthParam=最大 token 长度(可选)
103103
settings.autodev.coder.customEngineResponseTypeParam=自定义响应类型
104104
settings.autodev.coder.customEngineResponseFormatParam=自定义响应格式(Json 路径)
105105
settings.autodev.coder.customEngineRequestBodyFormatParam=自定义请求 Body 格式(Json)
@@ -196,4 +196,4 @@ batch.nothing.to.testing=没有要 AutoTest 的内容
196196
intentions.chat.code.test.verify=验证测试中
197197
open\ documents=Open Documents
198198
settings.autodev.llm.key.not.set=LLM 密钥未设置
199-
settings.autodev.coder.testConnectionButton.tips=请记得在修改后 OpenAI 点击应用,再进行测试!
199+
settings.autodev.coder.testConnectionButton.tips=请记得在修改后点击应用,再进行测试!

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pluginGroup = com.phodal.autodev
77
pluginName = AutoDev
88
pluginRepositoryUrl = https://github.com/unit-mesh/auto-dev
99
# SemVer format -> https://semver.org
10-
pluginVersion = 1.9.0
10+
pluginVersion = 2.0.0-ALPHA1
1111

1212
# Supported IDEs: idea, pycharm
1313
baseIDE=idea

0 commit comments

Comments
 (0)