Switch order of literals to prevent NullPointerException (#1)

Co-authored-by: pixeebot[bot] <23113631+pixeebot@users.noreply.github.com>
This commit is contained in:
pixeebot[bot]
2023-09-20 08:43:06 -04:00
committed by GitHub
parent 768514e768
commit ca5624169a

View File

@@ -52,7 +52,7 @@ public class OpenAiAutoConfiguration {
@Bean
public OpenAiService theoOpenAiService(OpenAiProperties openAiProperties) {
if (openAiProperties.getBaseUrl().equals("https://api.openai.com")) {
if ("https://api.openai.com".equals(openAiProperties.getBaseUrl())) {
if (!StringUtils.hasText(openAiProperties.getApiKey())) {
throw new IllegalArgumentException(
"You must provide an API key with the property name " + CONFIG_PREFIX + ".api-key");