diff --git a/plugin-copilot/src/main/java/appland/copilotChat/CopilotAppMapEnvProvider.java b/plugin-copilot/src/main/java/appland/copilotChat/CopilotAppMapEnvProvider.java index 0193ebba..94fa559b 100644 --- a/plugin-copilot/src/main/java/appland/copilotChat/CopilotAppMapEnvProvider.java +++ b/plugin-copilot/src/main/java/appland/copilotChat/CopilotAppMapEnvProvider.java @@ -4,6 +4,7 @@ import appland.copilotChat.copilot.GitHubCopilotService; import appland.rpcService.AppLandJsonRpcService; import appland.settings.AppMapApplicationSettingsService; +import appland.settings.AppMapSecureApplicationSettingsService; import com.intellij.ide.plugins.PluginManager; import java.util.Map; @@ -37,7 +38,9 @@ public static boolean isGitHubCopilotIntegrationEnabled() { */ public static boolean hasCustomModelSettings() { var environment = AppMapApplicationSettingsService.getInstance().getCliEnvironment(); - return environment.containsKey(AppLandJsonRpcService.OPENAI_API_KEY) + return AppMapSecureApplicationSettingsService.getInstance().hasOpenAIKey() + || environment.containsKey(AppLandJsonRpcService.OPENAI_API_KEY) + || environment.containsKey(AppLandJsonRpcService.OPENAI_BASE_URL) || environment.containsKey(AppLandJsonRpcService.AZURE_OPENAI_API_KEY); } diff --git a/plugin-core/src/main/java/appland/rpcService/AppLandJsonRpcService.java b/plugin-core/src/main/java/appland/rpcService/AppLandJsonRpcService.java index 2aaf3a31..be56d1b8 100644 --- a/plugin-core/src/main/java/appland/rpcService/AppLandJsonRpcService.java +++ b/plugin-core/src/main/java/appland/rpcService/AppLandJsonRpcService.java @@ -19,10 +19,11 @@ public interface AppLandJsonRpcService extends Disposable { String OPENAI_API_KEY = "OPENAI_API_KEY"; String AZURE_OPENAI_API_KEY = "AZURE_OPENAI_API_KEY"; + String OPENAI_BASE_URL = "OPENAI_BASE_URL"; // all environment variables, which define LLM settings of Navie Set LLM_ENV_VARIABLES = Set.of( OPENAI_API_KEY, - "OPENAI_BASE_URL", + OPENAI_BASE_URL, "APPMAP_NAVIE_MODEL", "APPMAP_NAVIE_TOKEN_LIMIT", AZURE_OPENAI_API_KEY, diff --git a/plugin-core/src/main/java/appland/settings/AppMapSecureApplicationSettings.java b/plugin-core/src/main/java/appland/settings/AppMapSecureApplicationSettings.java index 978a4d6d..b91a91ad 100644 --- a/plugin-core/src/main/java/appland/settings/AppMapSecureApplicationSettings.java +++ b/plugin-core/src/main/java/appland/settings/AppMapSecureApplicationSettings.java @@ -1,5 +1,6 @@ package appland.settings; +import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.Nullable; public interface AppMapSecureApplicationSettings { @@ -7,4 +8,8 @@ public interface AppMapSecureApplicationSettings { String getOpenAIKey(); void setOpenAIKey(@Nullable String key); + + default boolean hasOpenAIKey() { + return StringUtil.isNotEmpty(getOpenAIKey()); + } }