# CodeNexusAI **Repository Path**: yangchangling/code-nexus-ai ## Basic Information - **Project Name**: CodeNexusAI - **Description**: Spring生态+Sonatype Nexus AI底座+代码生成/安全检测/评审 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-20 - **Last Updated**: 2026-03-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # CodeNexusAI ## 项目介绍 CodeNexusAI 是一个基于 Sonatype Nexus AI 的 AI 代码生成与检测智能体,旨在为开发团队提供智能代码生成、安全检测和代码评审功能,提高开发效率和代码质量。 ## 核心功能 1. **多模型支持**:支持豆包、DeepSeek、Kimi、GPT、Gemini 等国内外大模型,带熔断降级 2. **向量库切换**:支持 PostgreSQL+pgvector、Milvus 向量库,企业级多模态 RAG 知识库 3. **Nexus 集成**:深度集成 Sonatype Nexus Repository/Lifecycle,实现供应链安全检测 4. **代码生成**:Spring Boot 微服务模板生成,基于 Initializr 骨架 + RAG 增强 5. **代码检测**:代码安全检测、依赖安全扫描、代码质量分析 6. **K8s 部署**:完整的 Kubernetes 部署配置,支持高可用性 ## 技术栈 - **Java 17** - **Spring Boot 3.2.10** - **Spring Cloud 2023.0.3** - **Spring Cloud Alibaba 2023.0.3.0** - **Spring AI 1.1.5** - **PostgreSQL + pgvector** - **Redis** - **Kubernetes** ## 环境要求 - JDK 17+ - Maven 3.6+ - PostgreSQL 14+ (with pgvector extension) - Redis 6+ - Kubernetes 1.20+ - Sonatype Nexus Repository 3.60+ ## 快速启动 ### 1. 配置环境变量 ```bash # 豆包 API Key export DOBAO_API_KEY=your-doubao-api-key # Nexus API Key export NEXUS_API_KEY=your-nexus-api-key # Nexus Base URL export NEXUS_BASE_URL=http://your-nexus-host:8081 ``` ### 2. 编译项目 ```bash cd ai-code-agent-parent mvn clean package -DskipTests ``` ### 3. 部署到 Kubernetes ```bash # 创建命名空间 kubectl create namespace ai-code-agent # 部署配置 kubectl apply -f ai-code-agent-deploy/src/main/resources/k8s/deployment.yaml ``` ### 4. 访问 API API 文档地址:`http://ai-code-agent.example.com/swagger-ui.html` ## 核心 API ### 代码生成 - **POST /api/code-agent/generate/spring-boot** - 生成 Spring Boot 微服务代码 ### 代码检测 - **POST /api/code-agent/detect/security** - 检测代码安全性 - **POST /api/code-agent/detect/dependency** - 检测依赖安全性 ## 配置说明 ### 应用配置 主要配置文件:`application.yaml` ```yaml spring: application: name: ai-code-agent cloud: nacos: config: server-addr: nacos:8848 file-extension: yaml namespace: your-namespace ai: openai: api-key: ${DOBAO_API_KEY} base-url: https://ark.cn-beijing.volces.com/api/v3 chat: options: model: doubao-4.0 vectorstore: type: pgvector nexus: ai: enabled: true base-url: ${NEXUS_BASE_URL} api-key: ${NEXUS_API_KEY} ``` ### 向量库配置 - **pgvector**:使用 PostgreSQL + pgvector 扩展 - **milvus**:使用 Milvus 向量数据库 ## 部署指南 ### Kubernetes 部署 1. **创建命名空间**:`kubectl create namespace ai-code-agent` 2. **部署配置**:`kubectl apply -f k8s/deployment.yaml` 3. **查看状态**:`kubectl get pods -n ai-code-agent` ### 本地开发 1. **启动 PostgreSQL**:确保 pgvector 扩展已安装 2. **启动 Redis**:用于对话记忆存储 3. **启动 Nacos**:用于配置管理 4. **运行应用**:`mvn spring-boot:run -pl ai-code-agent-api` ## 项目结构 ``` ai-code-agent-parent/ # 父工程,统一依赖管理 ├── ai-code-agent-common/ # 公共模块:统一响应、异常、工具类 ├── ai-code-agent-llm-core/ # 大模型核心:多模型工厂、熔断降级 ├── ai-code-agent-rag-core/ # RAG核心:向量库切换、增量更新 ├── ai-code-agent-nexus-integration/ # Nexus集成:API客户端、安全工具 ├── ai-code-agent-service/ # 业务服务:代码生成/检测核心逻辑 ├── ai-code-agent-api/ # 对外API:REST接口、OpenAPI文档 ├── ai-code-agent-starter/ # 自动配置Starter └── ai-code-agent-deploy/ # 部署配置:Dockerfile、K8s YAML、SQL ``` ## 贡献指南 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request ## 许可证 MIT License