File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
src/main/kotlin/cc/unitmesh/devti/settings Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class AutoDevSettingsConfigurable : Configurable {
14
14
15
15
override fun apply () = component.exportSettings(AutoDevSettingsState .getInstance())
16
16
17
- override fun reset () = component.applySettings(AutoDevSettingsState .getInstance())
17
+ override fun reset () = component.applySettings(AutoDevSettingsState .getInstance(), true )
18
18
override fun getPreferredFocusedComponent (): JComponent ? = null
19
19
20
20
@Nullable
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ class LLMSettingComponent(private val settings: AutoDevSettingsState) {
79
79
private val currentLLMParams: List <LLMParam >
80
80
get() {
81
81
return llmGroups[_currentSelectedEngine ]
82
- ? : throw IllegalStateException (" Unknown engine: ${settings.aiEngine } " )
82
+ ? : throw IllegalStateException (" Unknown engine: ${aiEngineParam.value } " )
83
83
}
84
84
85
85
private fun FormBuilder.addLLMParams (llmParams : List <LLMParam >): FormBuilder = apply {
@@ -120,10 +120,11 @@ class LLMSettingComponent(private val settings: AutoDevSettingsState) {
120
120
121
121
122
122
fun applySettings (settings : AutoDevSettingsState , updateParams : Boolean = false) {
123
- panel.removeAll()
124
- if (updateParams) {
125
- updateParams(settings)
123
+
124
+ if (updateParams && engineChanged(settings). also { updateParams(settings) } ) {
125
+ return
126
126
}
127
+ panel.removeAll()
127
128
128
129
formBuilder
129
130
.addLLMParam(languageParam)
@@ -231,6 +232,10 @@ class LLMSettingComponent(private val settings: AutoDevSettingsState) {
231
232
settings.delaySeconds != delaySecondsParam.value
232
233
}
233
234
235
+ private fun engineChanged (settings : AutoDevSettingsState ): Boolean {
236
+ return settings.aiEngine != aiEngineParam.value
237
+ }
238
+
234
239
init {
235
240
applySettings(settings)
236
241
}
You can’t perform that action at this time.
0 commit comments