Content
ang AI> **AI-driven Next-Generation Enterprise Resource Planning System** - AI as the primary driving force, reshaping enterprise business management.
## 📸 Interface Preview
| Home | AI Conversation | Intelligent Dashboard |
|------|--------|---------|
| Quick Search + Function Entrance | Natural Language Interaction | Data Indicator Visualization |
## 🎯 Function Introduction
| Function | Description |
|------|------|
| 🤖 **AI Intelligent Conversation** | Natural language inquiry orders, inventory, sales analysis, conversation as operation |
| 📊 **Intelligent Dashboard** | Today's orders, sales, inventory warning, and other key indicators at a glance |
| 📦 **Order Management** | E-commerce orders, offline orders, multi-channel aggregation management |
| 📦 **** | Product library,, classification, and brand |
📊 **Inventory Management Multi-warehouse inventory, in of storage, warning reminders 🧠 **NL** | Natural language automatically converted to SQL query, zero-threshold data analysis |
| 📚 **RAG Knowledge Base** | Document vectorized storage, intelligent retrieval, and enhanced Q&A |
| 🔌 **MCP Protocol** | Model Context Protocol, AI programmable interface open |
| 🔗 **Open Integration** | OpenAPI connects to old ERP systems, smooth data migration |
## 🏗️ System Architecture
```
──┐
│ Frontend Layer (Vue 3 + TS) │
│ Conversation Panel │ Intelligent Dashboard │ Global Search Management Page │
──────────────────┤
API Layer (Spring Boot 4.1) │
│ /api/ai/chat │ /api/ai/ping │ SSE Push │
├──────────────────────────────────────────────────┤
│ AI Agent Orchestration Layer │
│ Order Agent │ Agent │ Analysis Agent │
├──────────────────────────────────────────────────┤
│ AI Core │
│ NL2SQL │ RAG │ Prediction Engine │ Embedding│
├──────────────────────────────────────────────────┤
│ Data Layer │
│ PostgreSQL │ PGVector │ Redis │
└──────────────────────────────────────────────────┘
```
## 🛠️ Technology Stack
| Component | Selection | Version |
|------|------|------|
| Backend Framework | Spring Boot | 4.1.0 |
| AI Framework | Spring AI | 2.0.0 |
| Database | PostgreSQL | 16+ |
| Vector Database | PGVector (PostgreSQL plugin) | — |
| Cache | Redis | 7+ |
| Frontend Framework | Vue 3 + TypeScript | 3.4+ |
| UI Component Library | Element 2.6+ |
| Build Tool | Vite | 5.4+ |
| AI Model | DeepSeek Chat (cloud) | — |
| Protocol | MCP (Model Context Protocol) | — |
## 📁 Project Module
```
qihang-ai-erp/
├── ai-common/ # Common module: tool class, unified return, exception system
├── ai-infrastructure/ # AI infrastructure: ChatClient, model routing, vector library
├── ai-agent/ # AI Agent orchestration: Agent registration, tool definition, workflow
├── ai-nl2sql/ # NL2SQL engine: natural language to SQL query
├── ai-rag/ # RAG knowledge base: document management, vector retrieval, enhanced Q&A
├── ai-business/ # Business core: order, product, inventory, customer model
├── ai-integration/ # Integration layer: connect old ERP OpenAPI, MCP protocol
├── ai-api/ # API layer: Controller, security configuration, application entry
├── ai-mcp-server/ # MCP Server: expose AI Tool capabilities
└── ai-frontend/ # Frontend: Vue 3 + TypeScript + Element Plus
```
## 🚀 Environment Requirements
| Dependency | Version Requirement | Purpose |
|------|---------|------|
| Java | 17+ (recommended 21) | Backend operation |
| Node.js | 20+ | Frontend build and operation |
| Maven | 3.8+ | Backend build |
| Docker | Optional | Quick start PostgreSQL / Redis |
| PostgreSQL | 16+ | Main database |
| Redis | 7+ | Cache / session management |
## 📦 Docker Environment Preparation
### PostgreSQL (main database + PGVector)
```bash
docker run -d \
--name qihang-postgres \
-e POSTGRES_DB=qihang_ai_platform \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
postgres:16
```
**Database Connection Parameters:**
| Parameter | Value |
|------|-----|
| Host | localhost |
| Port | 5432 |
| Database Name | qihang_ai_platform |
| Username | postgres |
| Password | postgres |
| JDBC URL | `jdbc:postgresql://127.0.0.1:5432/qihang_ai_platform` |
> **Note:** If you need to use PGVector vector functionality, you need to enter the container to install the plugin:
> ```bash
> docker exec -it qihang-postgres psql -U postgres -d qihang_ai_platform -c "CREATE EXTENSION IF NOT EXISTS vector;"
> ```
### Redis (cache)
```bash
docker run -d \
--name qihang-redis \
-p 6379:6379 \
redis:7
```
**Redis Connection Parameters:**
| Parameter | Value |
|------|-----|
| Host | localhost |
| Port | 6379 |
| Database | 0 |
### Verify Container Status
```bash
docker ps
# Expected output: qihang-postgres and qihang-red both in Up status
```
## 🔧 Backend Operation
### 1️⃣ Configure API Key
This platform uses **DeepSeek Chat** as the AI model by default (compatible with OpenAI protocol), and you need to set the API Key:
```bash
# Linux / macOS
export DEEPSEEK_API_KEY=sk-your-deepseek-api-key
# Windows (CMD)
set DEEPSEEK_API_KEY=sk-your-deepseek-api-key
# Windows (PowerShell)
$env:DEEPSEEK_API_KEY="sk-your-deepseek-api-key"
```
> **💡 Tip:** You can also directly fill in `ai-api/src/main/resources/application-dev.yml`:
> ```yaml
> spring:
> ai:
> openai:
> api-key: sk-your-deepseek-api-key
> ```
### 2️⃣ Compile and Package
```bash
# Execute in the project root directory
mvn clean install -DskipTests
```
### 3️⃣ Start Backend Service
```bash
# Method 1: Maven directly starts (recommended)
mvn spring-boot:run -pl ai-api -Dspring-boot.run.profiles=dev
# Method 2: Package and then run
cd ai-api
mvn spring-boot:run -Dspring-boot.run.profiles=dev
```
### 4️⃣ Verify Backend
```bash
curl http://localhost:8099/api/ai/ping
```
**Expected Return:**
```json
{"code":200,"data":"Qihang service is running","msg":"Operation successful"}
```
### 5️⃣ Backend Configuration Description
Core configuration is located in `ai-api/src/main/resources/application.yml`:
```yaml
server:
port: 8099 # Service port
spring:
datasource: # PostgreSQL database
url: jdbc:postgresql://127.0.0.1:5432/qihang_ai_platform
username: postgres
password: postgres
data:
redis: # Redis cache
host: 127.0.0.1
port: 6379
ai:
openai:
base-url: https://api.deepseek.com/v1 # AI model address
api-key: ${DEEPSEEK_API_KEY:} # API Key (environment variable)
chat:
options:
model: deepseek-chat # Model name
temperature: 0.7
max-tokens: 4096
```
## 🖥️ Frontend Operation
### 1️⃣ Install Dependencies
```bash
cd ai-frontend
npm install
```
### 2️⃣ Start Development Server
```bash
npm run dev
```
### 3️⃣ Access Frontend
Open the browser to access: **http://localhost:3000**
### 4️⃣ Frontend Configuration Description
The frontend uses Vite to proxy and forward API requests to the backend, configured in `ai-frontend/vite.config.ts`:
```typescript
export default defineConfig({
server: {
port: 3000, // Frontend development server port
proxy: {
'/api': { // API request proxy
target: 'http://localhost:8099', // Backend address
changeOrigin: true,
},
},
})
```
### 5️⃣ Frontend Pages
| Route | Page | Function |
|------|------|------|
| `/` | Home | Quick search + card |
| `/chat` | AI Conversation | Natural language interaction with AI, data query, analysis |
| `/dashboard` | Intelligent Dashboard | Key indicator visualization display |
## ⚡ Quick Start (One-Click Guide)
```bash
# 1. Start database (Docker)
docker run -d --name qihang-postgres -GRES_DB=qihang_ai_platform POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -p :5432 postgres:16
docker run -d --name qihang-redis -p 6379::7
2. Set API Key
export DEEPSEEK_API_KEY=sk-your-deepseek-api-key
# 3. Start backend
mvn clean install -DskipTests
mvn spring-boot:run -pl -Dspring-boot.run.profiles=dev
# 4. New terminal - start frontend
cd ai-frontend
npm install
npm run dev
# 5. Open browser to access http://localhost:3000
```
## 🧪 API Interface Overview
| Method | Path | Description |
|------|------|------|
| GET | `/api/ai/ping` | Health check |
| POST | `/api/ai/chat` | AI conversation interface |
| GET | `/api-docs` | OpenAPI documentation (SpringDoc) |
| GET | `/swagger-ui.html` | Swagger UI interface |
## 🔗 Relationship with Qihang AI ERP
This platform and old ERP (qihang-erp-open) have a **parallel collaboration** relationship:
| Scenario | Relationship Description |
|------|---------|
| Independent use | ✅ This platform is completely independent, with all data capabilities |
| E-commerce connection | 🔌 Optional synchronization of old ERP e-commerce order data through OpenAPI |
| Data import | 📥 Support for importing historical data from old ERP (Excel/CSV) |
**This platform does not depend on the old ERP**, and the old ERP is just one of many data sources.
## 📄 Design Document
See [docs/AI-NATIVE-ERP-DESIGN.md](docs/AI-NATIVE-ERP-DESIGN.md)
## 📌 Version Plan
| Version | Core Delivery |
|------|------|---------|
| v1.0 | Phase 1 | AI conversation + NL2SQL query + basic business module |
| v2.0 | Phase 2 | AI + RAG knowledge base |
| v3.0 | Phase 3 | Intelligent supply chain + MCP protocol |
| v4.0 | Phase 4 | Multi-channel sales + AI workflow |