Content
# My AI Agent 🤖
## Project Introduction
My AI Agent is an intelligent agent service built on the Spring Boot and Spring AI frameworks, integrating modern large model capabilities to provide features such as conversation memory and multimodal interaction. This project achieves an intelligent human-computer interaction experience by integrating Alibaba Cloud's Lingji large model service.
## System Architecture
The project adopts a modular design, mainly including:
- **Core Service Module**: Web service based on Spring Boot
- **AI Conversation Module**: Integrates Spring AI with Alibaba Cloud's large model capabilities
- **Memory Persistence Module**: Implements local file persistence for conversation states
- **Image Search Service**: Independent MCP service module
## Core Features
- ✅ **Intelligent Conversation**: Accesses Alibaba Cloud's Lingji model, supporting natural language interaction
- ✅ **Conversation Memory**: File system-based conversation memory persistence, maintaining contextual coherence
- ✅ **Health Check**: Provides service status monitoring interface
- ✅ **Image Search**: Independent module supporting image-based search functionality
## Tech Stack
- **Backend Framework**: Spring Boot 3.4.x
- **AI Framework**: Spring AI (1.0.0-M6.x)
- **Large Model Access**:
- Alibaba Cloud DashScope SDK (2.19.1)
- Spring AI Alibaba (1.0.0-M6.1)
- Ollama integration
- **Serialization Tool**: Kryo
- **Build Tool**: Maven 3.9.9
- **Other Tools**:
- Hutool (5.8.37)
- Lombok
- **Runtime Environment**: Java 21
## Quick Start
### Environment Requirements
- JDK 21+
- Maven 3.9+
- Alibaba Cloud account and API Key (for accessing the Lingji model)
### Installation and Running
1. Clone the project to your local machine
```bash
git clone https://github.com/your-username/my-ai-agent.git
cd my-ai-agent
```
2. Configure environment variables
```bash
# Alibaba Cloud API Key (required)
export ALIBABA_API_KEY=your_api_key_here
```
3. Build the project
```bash
./mvnw clean package
```
4. Run the main application
```bash
java -jar target/my-ai-agent-0.0.1-SNAPSHOT.jar
```
5. Run the image search service (optional)
```bash
cd my-image-search-mcp-server
../mvnw spring-boot:run
```
## Project Structure
```
my-ai-agent/
├── src/main/java/com/yam/myaiagent/
│ ├── chatmemory/ # Conversation memory implementation
│ ├── constant/ # Constant definitions
│ ├── controller/ # HTTP interface controllers
│ ├── service/ # Business logic services
│ └── MyAiAgentApplication.java # Application entry point
├── my-image-search-mcp-server/ # Image search service module
├── .mvn/ # Maven wrapper configuration
├── pom.xml # Maven project configuration
└── README.md # Project documentation
```
## Configuration Instructions
Main configuration items include:
- **Chat Memory Storage Path**: Defaults to the `/tmp` folder under the project root directory
- **Model Parameters**: Large model parameter settings can be adjusted in the application configuration
- **Service Port**: Defaults to the standard Spring Boot port 8080
## API Interfaces
### Health Check
```
GET /health
Response: "ok"
```
### Other Interfaces
_Detailed API documentation to be added_
## Advanced Features
### File-Persistent Conversation Memory
The project implements a file-persistent conversation memory mechanism based on Kryo serialization, supporting the saving and restoring of conversation states, ensuring coherence and contextual understanding in conversations.
### Image Search Service
The independent image search module adopts the Spring AI MCP service architecture, providing multimodal interaction capabilities.
## Contribution Guidelines
Contributions to the project are welcome! Please follow these steps:
1. Fork this repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Create a Pull Request
## License
This project is open-source under the Apache License 2.0. Please refer to the LICENSE file for details.
## Contact Information
If you have any questions or suggestions, feel free to reach out to us via Issues or through the following means:
- Email: xzhuzhu961@gmail.com
---
Happy using! 🚀