init repo

This commit is contained in:
liuyuanchuang
2025-12-10 18:33:37 +08:00
commit 48e63894eb
2408 changed files with 1053045 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
---
description:
globs:
alwaysApply: false
---
# API Structure
The API follows a versioned structure under the path prefix `/doc_ai/v1/`.
- [api/router.go](mdc:api/router.go): Main router setup that connects all API endpoints
- API endpoints are organized by domain:
- Formula: [api/v1/formula/](mdc:api/v1/formula)
- OSS (Object Storage): [api/v1/oss/](mdc:api/v1/oss)
- Task: [api/v1/task/](mdc:api/v1/task)
- User: [api/v1/user/](mdc:api/v1/user)
Each domain has its own router setup and controller implementation.

View File

@@ -0,0 +1,27 @@
---
description:
globs:
alwaysApply: false
---
# Configuration System
The application uses a YAML-based configuration system:
- [config/](mdc:config): Configuration directory
- Environment-specific configuration files:
- `config_dev.yaml`: Development environment configuration
- `config_prod.yaml`: Production environment configuration
The configuration is loaded at startup in [main.go](mdc:main.go) using the `config.Init()` function, with the environment specified via command-line flags:
```
go run main.go -env dev # Run with dev configuration
go run main.go -env prod # Run with production configuration
```
Configuration includes settings for:
- Database connection
- Redis cache
- Logging
- Server port and mode
- External service credentials

View File

@@ -0,0 +1,25 @@
---
description:
globs:
alwaysApply: false
---
# Deployment Configuration
The project includes Docker configuration for containerized deployment:
- [Dockerfile](mdc:Dockerfile): Container definition for the application
- [docker-compose.yml](mdc:docker-compose.yml): Multi-container deployment configuration
The application can be built and deployed using:
```bash
# Build and run with Docker Compose
docker-compose up -d
# Build Docker image directly
docker build -t document_ai .
docker run -p 8080:8080 document_ai
```
The project also includes CI/CD configuration:
- [.gitlab-ci.yml](mdc:.gitlab-ci.yml): GitLab CI/CD pipeline configuration

View File

@@ -0,0 +1,21 @@
---
description:
globs:
alwaysApply: false
---
# Internal Architecture
The internal directory contains the core business logic of the application:
- [internal/model/](mdc:internal/model): Data models and domain entities
- [internal/service/](mdc:internal/service): Business logic services
- [internal/storage/](mdc:internal/storage): Data persistence layer
- [internal/storage/dao/](mdc:internal/storage/dao): Database access objects
- [internal/storage/cache/](mdc:internal/storage/cache): Redis cache implementation
The application follows a layered architecture with clear separation between:
1. HTTP handlers (in api/)
2. Business logic (in internal/service/)
3. Data access (in internal/storage/)
This design promotes maintainability and testability by decoupling components.

View File

@@ -0,0 +1,16 @@
---
description:
globs:
alwaysApply: false
---
# Project Overview
Document AI is a Go-based application for document processing and analysis. The project is structured using a clean architecture pattern with:
- [main.go](mdc:main.go): The application entry point that configures and launches the HTTP server
- [config/](mdc:config): Configuration files and initialization
- [api/](mdc:api): API endpoints and HTTP handlers
- [internal/](mdc:internal): Core business logic and implementation
- [pkg/](mdc:pkg): Shared utilities and helper packages
The application uses the Gin web framework for HTTP routing and middleware functionality.

View File

@@ -0,0 +1,18 @@
---
description:
globs:
alwaysApply: false
---
# Utility Packages
The `pkg` directory contains shared utilities and functionality:
- [pkg/common/](mdc:pkg/common): Common middleware and shared functionality
- [pkg/constant/](mdc:pkg/constant): Constants used throughout the application
- [pkg/jwt/](mdc:pkg/jwt): JWT authentication utilities
- [pkg/oss/](mdc:pkg/oss): Object Storage Service client implementation
- [pkg/sms/](mdc:pkg/sms): SMS service integration
- [pkg/utils/](mdc:pkg/utils): General utility functions
- [pkg/httpclient/](mdc:pkg/httpclient): HTTP client utilities
These packages provide reusable components that can be used across different parts of the application without creating circular dependencies.