From c9dd143f5e0b33bd511ab6923a2b4b01e92a62f9 Mon Sep 17 00:00:00 2001 From: Blarc Date: Sun, 16 Apr 2023 20:59:35 +0200 Subject: [PATCH] feat(settings): Add "More prompts" button. --- CHANGELOG.md | 3 +++ .../github/blarc/ai/commits/intellij/plugin/AICommitsBundle.kt | 3 ++- .../intellij/plugin/settings/AppSettingsConfigurable.kt | 3 ++- src/main/resources/messages/MyBundle.properties | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca4da8c..bba2cc2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog ## [Unreleased] +### Added +- Add more prompts button to settings. + ### Changed - Use jtokkit library for getting max content length for a model and check if prompt is too large. diff --git a/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/AICommitsBundle.kt b/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/AICommitsBundle.kt index 8f19366..678499e 100644 --- a/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/AICommitsBundle.kt +++ b/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/AICommitsBundle.kt @@ -15,7 +15,8 @@ private const val BUNDLE = "messages.MyBundle" object AICommitsBundle : DynamicBundle(BUNDLE) { - public val URL_BUG_REPORT = URL("https://github.com/Blarc/ai-commits-intellij-plugin/issues") + val URL_BUG_REPORT = URL("https://github.com/Blarc/ai-commits-intellij-plugin/issues") + val URL_PROMPTS_DISCUSSION = URL("https://github.com/Blarc/ai-commits-intellij-plugin/discussions/18"); @Suppress("SpreadOperator") @JvmStatic diff --git a/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/AppSettingsConfigurable.kt b/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/AppSettingsConfigurable.kt index 9559516..737d0ba 100644 --- a/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/AppSettingsConfigurable.kt +++ b/src/main/kotlin/com/github/blarc/ai/commits/intellij/plugin/settings/AppSettingsConfigurable.kt @@ -15,7 +15,6 @@ import com.intellij.ui.CommonActionsPanel import com.intellij.ui.ToolbarDecorator import com.intellij.ui.components.JBLabel import com.intellij.ui.dsl.builder.* -import com.intellij.ui.util.maximumWidth import com.intellij.ui.util.minimumWidth import kotlinx.coroutines.* import java.util.* @@ -97,6 +96,8 @@ class AppSettingsConfigurable : BoundConfigurable(message("settings.general.grou label(message("settings.locale")).widthGroup("labelPrompt") comboBox(Locale.getAvailableLocales().toList().sortedBy { it.displayName }, AppSettingsListCellRenderer()) .bindItem(AppSettings.instance::locale.toNullableProperty()) + browserLink(message("settings.more-prompts"), AICommitsBundle.URL_PROMPTS_DISCUSSION.toString()) + .align(AlignX.RIGHT) } row { label(message("settings.prompt")).widthGroup("labelPrompt") diff --git a/src/main/resources/messages/MyBundle.properties b/src/main/resources/messages/MyBundle.properties index f5b3108..1c87ac3 100644 --- a/src/main/resources/messages/MyBundle.properties +++ b/src/main/resources/messages/MyBundle.properties @@ -49,4 +49,5 @@ settings.prompt.description=Description validation.unique=Value already exists. settings.openAIProxy=OpenAI proxy url settings.loadingModels=Loading OpenAI models... +settings.more-prompts=More prompts