Skip to content

Commit

Permalink
Merge pull request #25 from devchat-ai/fix-settings-opening
Browse files Browse the repository at this point in the history
Fix settings opening
  • Loading branch information
pplam authored Dec 11, 2023
2 parents 4adac3e + 2b72664 commit 6f64442
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,13 @@ package ai.devchat.devchat.handler

import ai.devchat.devchat.BaseActionHandler
import ai.devchat.devchat.DevChatActions
import ai.devchat.idea.settings.DevChatSettingsConfigurable
import com.alibaba.fastjson.JSONObject
import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.options.ShowSettingsUtil


class ShowSettingDialogRequestHandler(metadata: JSONObject?, payload: JSONObject?) : BaseActionHandler(metadata, payload) {
override val actionName: String = DevChatActions.SHOW_SETTING_DIALOG_REQUEST
override fun action() {
val project = handler?.project
val dataContext = DataContext { dataId -> project.takeIf { CommonDataKeys.PROJECT.name == dataId }}
val settingsAction = ActionManager.getInstance().getAction("ShowSettings")
val event = AnActionEvent.createFromDataContext(ActionPlaces.POPUP, null, dataContext)
ApplicationManager.getApplication().invokeLater { settingsAction.actionPerformed(event) }
ShowSettingsUtil.getInstance().editConfigurable(project, DevChatSettingsConfigurable.get())
ShowSettingsUtil.getInstance().showSettingsDialog(handler?.project, "DevChat")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class DevChatSettingsComponent {

init {
panel = FormBuilder.createFormBuilder()
.addLabeledComponent(JBLabel("api_base"), apiBaseText, 1, false)
.addLabeledComponent(JBLabel("api_key"), apiKeyText, 2, false)
.addLabeledComponent(JBLabel("max_log_count"), maxLogCountText, 3, false)
.addLabeledComponent(JBLabel("default_model"), defaultModelText, 4, false)
.addLabeledComponent(JBLabel("API base"), apiBaseText, 1, false)
.addLabeledComponent(JBLabel("API key"), apiKeyText, 2, false)
.addLabeledComponent(JBLabel("Max log count"), maxLogCountText, 3, false)
.addLabeledComponent(JBLabel("Default model"), defaultModelText, 4, false)
.addComponentFillVertically(JPanel(), 0)
.panel
defaultModelText.selectedItem = "gpt-3.5-turbo"
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/ai/devchat/idea/settings/SupportedModels.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package ai.devchat.idea.settings

val supportedModels = setOf(
"gpt-3.5",
"gpt-3.5-turbo",
// "gpt-3.5-turbo-1106",
"gpt-3.5-16k",
"gpt-3.5-turbo-16k",
"gpt-4",
// "gpt-4-1106-preview",
"claude-2",
Expand Down

0 comments on commit 6f64442

Please sign in to comment.