From 50f11dfc9c35a15e6cb298dda01d2cfc4ed57d14 Mon Sep 17 00:00:00 2001 From: Geoffrey Kwan Date: Tue, 16 Apr 2024 10:26:03 -0400 Subject: [PATCH] feat(AI Chat): Add authoring config param for whether chat gpt is enabled (#271) --- .../web/controllers/author/project/AuthorAPIController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/wise/portal/presentation/web/controllers/author/project/AuthorAPIController.java b/src/main/java/org/wise/portal/presentation/web/controllers/author/project/AuthorAPIController.java index 8810660b5..6b3b243b0 100644 --- a/src/main/java/org/wise/portal/presentation/web/controllers/author/project/AuthorAPIController.java +++ b/src/main/java/org/wise/portal/presentation/web/controllers/author/project/AuthorAPIController.java @@ -48,6 +48,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ObjectNode; +import org.apache.commons.lang3.StringUtils; import org.json.JSONException; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; @@ -398,6 +399,7 @@ protected HashMap getAuthorProjectConfig(Authentication auth, config.put("projectAssetURL", contextPath + "/api/author/project/asset/" + project.getId()); config.put("projectBaseURL", projectBaseURL); config.put("previewProjectURL", contextPath + "/preview/unit/" + project.getId()); + config.put("chatGptEnabled", !StringUtils.isEmpty(appProperties.getProperty("OPENAI_API_KEY"))); config.put("cRaterRequestURL", contextPath + "/api/c-rater"); config.put("importStepsURL", contextPath + "/api/author/project/importSteps/" + project.getId());