Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix settings opening #25

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading