diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/application/LangChain4JApplicationService.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/application/LangChain4jApplicationService.java similarity index 68% rename from src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/application/LangChain4JApplicationService.java rename to src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/application/LangChain4jApplicationService.java index 2dfcfdf8009..1576bb54e8c 100644 --- a/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/application/LangChain4JApplicationService.java +++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/application/LangChain4jApplicationService.java @@ -1,17 +1,17 @@ package tech.jhipster.lite.generator.server.springboot.langchain4j.application; import org.springframework.stereotype.Service; -import tech.jhipster.lite.generator.server.springboot.langchain4j.domain.LangChain4JModuleFactory; +import tech.jhipster.lite.generator.server.springboot.langchain4j.domain.LangChain4jModuleFactory; import tech.jhipster.lite.module.domain.JHipsterModule; import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties; @Service -public class LangChain4JApplicationService { +public class LangChain4jApplicationService { - private final LangChain4JModuleFactory factory; + private final LangChain4jModuleFactory factory; - public LangChain4JApplicationService() { - factory = new LangChain4JModuleFactory(); + public LangChain4jApplicationService() { + factory = new LangChain4jModuleFactory(); } public JHipsterModule buildModule(JHipsterModuleProperties properties) { diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4JModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4jModuleFactory.java similarity index 91% rename from src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4JModuleFactory.java rename to src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4jModuleFactory.java index 9465f047371..09dbe3d6efa 100644 --- a/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4JModuleFactory.java +++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4jModuleFactory.java @@ -11,7 +11,7 @@ import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties; import tech.jhipster.lite.shared.error.domain.Assert; -public class LangChain4JModuleFactory { +public class LangChain4jModuleFactory { private static final String API_KEY_DEMO_COMMENT = "You can temporarily use 'demo' key, which is provided for free for demonstration purposes"; @@ -30,13 +30,13 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) { //@formatter:off return moduleBuilder(properties) - .documentation(documentationTitle("Dev tools"), SOURCE.template("langchain4j.md")) + .documentation(documentationTitle("LangChain4j"), SOURCE.template("langchain4j.md")) .javaDependencies() .addDependency(GROUP_ID, ARTIFACT_ID, VERSION_SLUG) .addDependency(GROUP_ID, OPEN_AI_ARTIFACT_ID, VERSION_SLUG) .and() .springMainProperties() - .set(LANGCHAIN4J_PROPERTY_API_KEY, propertyValue("${OPENAI_API_KEY}")) + .set(LANGCHAIN4J_PROPERTY_API_KEY, propertyValue("demo")) .comment(LANGCHAIN4J_PROPERTY_API_KEY, comment(API_KEY_DEMO_COMMENT)) .set(propertyKey("langchain4j.open-ai.chat-model.model-name"), propertyValue("gpt-4o-mini")) .set(propertyKey("langchain4j.open-ai.chat-model.log-requests"), propertyValue("true")) diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/infrastructure/primary/LangChain4JModuleConfiguration.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/infrastructure/primary/LangChain4jModuleConfiguration.java similarity index 79% rename from src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/infrastructure/primary/LangChain4JModuleConfiguration.java rename to src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/infrastructure/primary/LangChain4jModuleConfiguration.java index b9a427a5837..870e2f54041 100644 --- a/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/infrastructure/primary/LangChain4JModuleConfiguration.java +++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/langchain4j/infrastructure/primary/LangChain4jModuleConfiguration.java @@ -5,22 +5,22 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import tech.jhipster.lite.generator.server.springboot.langchain4j.application.LangChain4JApplicationService; +import tech.jhipster.lite.generator.server.springboot.langchain4j.application.LangChain4jApplicationService; import tech.jhipster.lite.module.domain.resource.JHipsterModuleOrganization; import tech.jhipster.lite.module.domain.resource.JHipsterModulePropertiesDefinition; import tech.jhipster.lite.module.domain.resource.JHipsterModuleResource; @Configuration -class LangChain4JModuleConfiguration { +class LangChain4jModuleConfiguration { @Bean - JHipsterModuleResource langChain4JModule(LangChain4JApplicationService langChain4J) { + JHipsterModuleResource langChain4jModule(LangChain4jApplicationService langChain4j) { return JHipsterModuleResource.builder() .slug(LANGCHAIN4J) .propertiesDefinition(JHipsterModulePropertiesDefinition.builder().addProjectBaseName().addIndentation().build()) - .apiDoc("LangChain4J", "Add LangChain4j") + .apiDoc("LangChain4j", "Add LangChain4j") .organization(JHipsterModuleOrganization.builder().addDependency(SPRING_BOOT).build()) .tags("server", "spring", "spring-boot", "langchain4j") - .factory(langChain4J::buildModule); + .factory(langChain4j::buildModule); } } diff --git a/src/test/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4JModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4jModuleFactoryTest.java similarity index 93% rename from src/test/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4JModuleFactoryTest.java rename to src/test/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4jModuleFactoryTest.java index 15e4afb3c67..b4d83f5ce08 100644 --- a/src/test/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4JModuleFactoryTest.java +++ b/src/test/java/tech/jhipster/lite/generator/server/springboot/langchain4j/domain/LangChain4jModuleFactoryTest.java @@ -15,10 +15,10 @@ @UnitTest @ExtendWith(MockitoExtension.class) -class LangChain4JModuleFactoryTest { +class LangChain4jModuleFactoryTest { @InjectMocks - private LangChain4JModuleFactory factory; + private LangChain4jModuleFactory factory; @Test void shouldCreateModule() { @@ -29,6 +29,7 @@ void shouldCreateModule() { JHipsterModule module = factory.buildModule(properties); assertThatModuleWithFiles(module, pomFile()) + .hasFiles("documentation/langchain4j.md") .hasFile("pom.xml") .containing("") .containing( @@ -57,7 +58,7 @@ void shouldCreateModule() { open-ai: chat-model: # You can temporarily use 'demo' key, which is provided for free for demonstration purposes - api-key: ${OPENAI_API_KEY} + api-key: demo log-requests: 'true' log-responses: 'true' model-name: gpt-4o-mini