Conversation
Introduce a Java 17 `ai` module with Spring wiring, OpenAI ChatModel via LangChain4j, and a JSON REST endpoint. Move discover/MyBatis/servlet dependencies from the modules aggregator into `business` and `analysis` so `ai` can compile without the full discover stack. Use HTTPS for the Aliyun Maven repository in the root POM. Co-authored-by: ada.young <735529126@qq.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a new ai module utilizing langchain4j for OpenAI integration, including configuration, service, and REST controller layers. It also refactors dependency management by moving common dependencies from the parent modules/pom.xml to specific sub-modules (analysis and business) and updates the Aliyun repository to use HTTPS. Key feedback includes a critical Java version mismatch between the new module (Java 17) and the rest of the project (Java 8), which will lead to runtime errors, and a recommendation to centralize the mybatis-spring version property to avoid hardcoding.
Comment on lines
+19
to
+20
| <maven.compiler.source>17</maven.compiler.source> | ||
| <maven.compiler.target>17</maven.compiler.target> |
| <dependency> | ||
| <groupId>org.mybatis</groupId> | ||
| <artifactId>mybatis-spring</artifactId> | ||
| <version>2.0.4</version> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
本变更新增独立 Maven 子模块
modules/ai(Java 17),使用 LangChain4j 1.0 与OpenAiChatModel接入 OpenAI 兼容的聊天 API,并在 Spring MVC 中暴露 JSON 接口。主要改动
ai:ChatModelBean(未配置OPENAI_API_KEY时返回友好提示)、AiChatService、AiChatRestController(/rest/ai/chat)。modules父 POM 上的discover-website、MyBatis、Jodd、servlet-api 等依赖下沉到business与analysis,使ai模块可单独编译,不强制拉取 discover 全量传递依赖。pom.xml:将阿里云仓库 URL 从 HTTP 改为 HTTPS,避免在较新 Maven 上触发 HTTP 拦截。配置与调用
OPENAI_API_KEY(必填方可真实调用);可选OPENAI_MODEL(默认gpt-4o-mini)。GET {contextPath}/rest/ai/chat.json?message=你好(与现有*.json映射一致)。构建说明
在本环境中
discover-common-freemarker等私有构件无法从公共仓库解析,完整web模块编译需使用团队内部 Maven 仓库或本地已安装的对应 JAR。mvn -pl modules/ai -am compile已通过验证。