# ai-project **Repository Path**: projectzone/ai-project ## Basic Information - **Project Name**: ai-project - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-07-13 - **Last Updated**: 2025-07-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AI Prog Project Documentation ## Project Overview AI Prog is an AI interactive application that integrates various AI capabilities, including text conversation, deep thinking, document summarization, image generation, MCP interaction, multimodal interaction, and RAG (Retrieval-Augmented Generation). The project is divided into two parts: the backend (`ai-prog`) and the frontend (`ai-ui`). The backend is built using the Spring Boot framework and integrates Spring AI with Alibaba's DashScope API to provide robust AI service support. The frontend is developed based on the React framework and provides a user interaction interface. ## Key Features - **Text Conversation**: Provides basic AI chat functionality. - **Deep Thinking**: Supports more complex reasoning and thinking processes. - **Document Summarization**: Extracts summaries from document content. - **Image Generation**: Generates images based on prompts. - **MCP Interaction**: Supports MCP protocol interaction. - **RAG Support**: AI responses based on retrieval-augmented generation. - **Support for Multiple AI Models**: Supports multiple AI models through configuration. ## Directory Structure ``` . ├── ai-prog # Backend Spring Boot project └── ai-ui # Frontend React project ``` ## Backend (ai-prog) ### Technologies Used - Spring Boot - Spring AI - DashScope API - MySQL (used for storing chat history) - Java 17+ ### Main Components - **AiProgApplication.java**: Spring Boot startup class. - **BaseController.java**: Provides basic APIs, such as model list retrieval and health checks. - **ChatController.java**: Provides API interfaces for `/chat` and `/deep-thinking/chat`. - **ChatService.java**: Encapsulates the logic for calling DashScope. - **Model Configuration Classes**: Includes `SystemPromptConfig`, `DeepThinkPromptTemplateConfig`, `DocsSummarizerPromptTemplate.java`. - **Exception Handling**: `GlobalExceptionHandler.java` handles global exceptions and returns a unified `Result` response. - **Utility Class**: `ModelsUtils.java` is used to load the list of models supported by DashScope. ### Configuration Details - DashScope API Key is configured in the `spring.ai.dashscope.api-key` field of `application.yml`. - MySQL configuration is located in the `spring.ai.chat.memory.repository.jdbc.mysql` field of `application.yml`. ## Frontend (ai-ui) ### Technologies Used - React - TypeScript - Vite - Ant Design - PNPM package manager ### Page Features - **ChatPage**: Text conversation page. - **FunctionCallingPage**: Demonstrates the function calling process and architecture. - **DocSummaryPage**: Document summarization feature page. - **ImageGenPage**: Image generation feature page. - **McpPage**: MCP protocol interaction page. - **RagPage**: Retrieval-Augmented Generation (RAG) feature page. - **MultiModalPage**: Multimodal interaction page. ### Main Components - **PromptInput**: User input field. - **ChatConversationView**: Displays the chat history. - **ResponseBubble**: Displays AI responses, supporting text, function calls, and thinking processes. - **FunctionMenu**: Navigation menu for features. - **TipsModal**: Modal box for feature tips. ### State Management - State is managed using Jotai: - `conversation.store.ts`: Manages chat history. - `functionMenu.store.ts`: Manages feature menu states. - `modelConfig.store.ts`: Manages model configurations. ### Theme Support - Supports light/dark theme switching, configured in `theme.css` and `useTheme.ts`. ## Project Setup ### Starting the Backend 1. Ensure JDK 17 or higher is installed. 2. Install Maven and import the project. 3. Configure the API Key and MySQL database in `application.yml`. 4. Run the SQL script `ai-prog/src/main/resources/db/init.sql` to initialize the database. 5. Launch the project by running `AiProgApplication.java`. ### Starting the Frontend 1. Ensure Node.js and pnpm are installed. 2. Navigate to the `ai-ui` directory. 3. Install dependencies: `pnpm install`. 4. Start the development server: `pnpm dev`. 5. Open a browser and visit `http://localhost:5173`. ## API Interface Documentation - **GET /api/v1/dashscope/getModels**: Retrieves the list of models supported by DashScope. - **GET /api/v1/health**: Health check endpoint. - **POST /api/v1/chat**: Basic text conversation interface. - **POST /api/v1/deep-thinking/chat**: Deep thinking conversation interface. ## Exception Handling - Uses a unified response format `Result` to return success or failure information. - Exception Types: - `AIException`: AI-related exceptions. - `AppException`: Application-level exceptions. - `MethodArgumentNotValidException`: Request parameter validation failure. ## Contribution Guidelines Contributions are welcome! Please follow these guidelines: - Fork the project and create a new branch. - Submit clear and well-documented Pull Requests. - Update `README.md` to reflect new features or changes. - Ensure consistent code style. ## License This project is licensed under the MIT License. Please refer to the [LICENSE](LICENSE) file for details.