### Install Aipexbase Frontend (Bash) Source: https://github.com/kuafuai/aipexbase/blob/main/README.md Commands to install Node.js dependencies and start the Aipexbase management console locally. This is an optional step after setting up the backend. Navigate to the 'frontend' directory, run 'npm install', and then 'npm run dev' to start the console. ```bash cd frontend npm install npm run dev ``` -------------------------------- ### Run Docker Compose Services Source: https://github.com/kuafuai/aipexbase/blob/main/docs/INSTALL.md Starts the AIPEXBASE services defined in the docker-compose.yaml file in detached mode. Requires Docker and Docker Compose to be installed. ```bash docker-compose up -d ``` -------------------------------- ### Install Aipexbase Backend (Bash) Source: https://github.com/kuafuai/aipexbase/blob/main/README.md Steps to clone the Aipexbase repository and start the backend service locally using Maven. Requires Java 1.8+, Node.js 18+, and MySQL 8.0+. After cloning, navigate to the project directory, import the SQL script, configure the database connection, and run the Spring Boot application. ```bash git clone https://github.com/kuafuai/aipexbase.git cd aipexbase # Import SQL Script to Local MySQL Database [SQL](./install/mysql/init.sql) cd backend/src/main/resources # Modify the default JDBC configuration in application-mysql.yml file mvn spring-boot:run # Service starts at http://localhost:8080 ``` -------------------------------- ### MCP (Model Context Protocol) Integration Source: https://context7.com/kuafuai/aipexbase/llms.txt Integrate AI IDE tools like Cursor with AIPEXBASE using MCP for seamless backend generation. Provides configuration details for IDEs and server setup. ```APIDOC ## MCP (Model Context Protocol) Integration ### Description Configure AI IDE tools to integrate with AIPEXBASE using MCP for seamless backend generation. ### Method Not applicable (Configuration examples provided) ### Endpoint Not applicable ### Parameters N/A ### Request Example #### IDE Configuration (e.g., Cursor) ```json { "mcpServers": { "aipexbase-mcp-server": { "url": "http://your-domain-or-ip:8080/mcp/sse?token=coding123" } } } ``` #### Server Configuration (`application.yml`) ```yaml mcp: server: name: baas-mcp-server version: 1.0.0 message-endpoint: /mcp/message sse-endpoint: /mcp/sse ``` ### Response N/A ``` -------------------------------- ### Nginx Proxy Configuration for AIPEXBASE Source: https://github.com/kuafuai/aipexbase/blob/main/docs/INSTALL.md Example Nginx configuration for proxying requests to AIPEXBASE services. This snippet shows how to configure locations for the root, baas-api, and mcp services, including important proxy headers and timeouts for long connections. ```nginx location / { root /usr/share/nginx; try_files $uri $uri/ /index.html; } location /baas-api { proxy_pass http://1.1.1.1:8080; rewrite ^/baas-api/(.*)$ /$1 break; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } location /mcp { proxy_pass http://1.1.1.1:8080; proxy_set_header Host $host; # Preserve client real IP proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Connection ''; proxy_http_version 1.1; proxy_buffering off; proxy_cache off; # Maintain long connection proxy_read_timeout 86400s; proxy_send_timeout 86400s; } ``` -------------------------------- ### Dynamic CRUD Operations - Add, Query, Update, Delete Records Source: https://context7.com/kuafuai/aipexbase/llms.txt Unified API for performing CRUD operations on any database table without writing backend code. Supports add, update, delete, get, list, page, and batch operations with filtering and ordering capabilities. Requires Bearer token authentication and specifies table name and method as URL parameters. ```bash # Add a new record to the "users" table curl -X POST "http://localhost:8080/api/data/invoke?table=users&method=add" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "username": "john_doe", "email": "john@example.com", "age": 28, "status": "active" }' # Query paginated data from the "users" table curl -X POST "http://localhost:8080/api/data/invoke?table=users&method=page" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "pageNum": 1, "pageSize": 10, "filters": { "status": "active" }, "orderBy": "created_at desc" }' # Update a record curl -X POST "http://localhost:8080/api/data/invoke?table=users&method=update" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "id": 12345, "email": "newemail@example.com", "status": "inactive" }' # Delete records in batch curl -X POST "http://localhost:8080/api/data/invoke?table=users&method=deletebatch" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "ids": [12345, 12346, 12347] }' ``` -------------------------------- ### Get WeChat OAuth URL (Bash) Source: https://context7.com/kuafuai/aipexbase/llms.txt A cURL command to request the WeChat OAuth URL from the AIPEXBASE backend. This is used for integrating WeChat login, particularly for Chinese users. Requires a POST request with JSON payload and an Authorization header. ```bash # Get WeChat OAuth URL curl -X POST "http://localhost:8080/get_mp_url" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" # Response: # { # "code": 0, # "data": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx123456&redirect_uri=https://your-domain.com/callback&response_type=code&scope=snsapi_base&state=123421#wechat_redirect", ``` -------------------------------- ### Dynamic Data Operations API Source: https://context7.com/kuafuai/aipexbase/llms.txt Perform unified CRUD operations (add, update, delete, get, list, page, batch) on any database table without writing backend code. This API is essential for managing your application's data dynamically. ```APIDOC ## POST /api/data/invoke ### Description Performs CRUD operations (add, update, delete, get, list, page, batch) on specified database tables. ### Method POST ### Endpoint `/api/data/invoke?table={tableName}&method={operation}` ### Parameters #### Query Parameters - **table** (string) - Required - The name of the database table to operate on. - **method** (string) - Required - The CRUD operation to perform (e.g., `add`, `update`, `delete`, `get`, `list`, `page`, `deletebatch`). #### Request Body - **fields** (object) - Required for `add`, `update`, `get`, `list`, `page` - Key-value pairs representing the data to be added, updated, or filtered. - **id** (number) - Required for `update`, `get` - The ID of the record to update or retrieve. - **ids** (array of numbers) - Required for `deletebatch` - An array of IDs to delete. - **pageNum** (number) - Optional for `page` - The page number for pagination. - **pageSize** (number) - Optional for `page` - The number of items per page. - **filters** (object) - Optional for `page` - Key-value pairs for filtering records. - **orderBy** (string) - Optional for `page` - The field and direction to order the results (e.g., `created_at desc`). ### Request Example (Add) ```json { "username": "john_doe", "email": "john@example.com", "age": 28, "status": "active" } ``` ### Request Example (Page) ```json { "pageNum": 1, "pageSize": 10, "filters": { "status": "active" }, "orderBy": "created_at desc" } ``` ### Response #### Success Response (200) - **code** (number) - 0 for success. - **data** (any) - The result of the operation (e.g., new record ID, list of records, number of affected rows). - **message** (string) - "success" for success. #### Response Example (Add) ```json { "code": 0, "data": 12345, "message": "success" } ``` #### Response Example (Page) ```json { "code": 0, "data": { "list": [ { "id": 12345, "username": "john_doe", "email": "john@example.com", "age": 28, "status": "active", "created_at": "2023-10-27T10:00:00Z" } ], "total": 100, "pageNum": 1, "pageSize": 10 }, "message": "success" } ``` ``` -------------------------------- ### Create Payment Order - Multiple Gateway Support Source: https://context7.com/kuafuai/aipexbase/llms.txt Unified payment order creation supporting multiple payment gateways (WeChat Pay, Stripe, mock). Accepts amount, currency, and payment method parameters. Returns order ID and payment URL for customer redirect. ```bash curl -X POST "http://localhost:8080/generalOrder/create" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "amount": 99.99, "currency": "USD", "paymentMethod": "stripe", "description": "Premium subscription - Monthly", "metadata": { "userId": 12345, "plan": "premium" } }' ``` -------------------------------- ### Retrieve Available Payment Methods Source: https://context7.com/kuafuai/aipexbase/llms.txt List all available payment methods configured on the platform. Returns array of supported payment gateways including WeChat Pay, Stripe, and mock payment option. ```bash curl -X GET "http://localhost:8080/generalOrder/payMethod" \ -H "Authorization: Bearer YOUR_TOKEN" ``` -------------------------------- ### Generate Images from Text - Text-to-Image Source: https://context7.com/kuafuai/aipexbase/llms.txt AI image generation endpoint that creates images from natural language text descriptions. Returns URL to generated image file. Supports complex scene descriptions and artistic style specifications. ```bash curl -X POST "http://localhost:8080/api/pic/word2pic" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "text": "A futuristic city skyline at sunset with flying cars" }' ``` -------------------------------- ### Docker Compose for AIPEXBASE Deployment (Bash) Source: https://context7.com/kuafuai/aipexbase/llms.txt Defines the Docker Compose configuration for deploying AIPEXBASE, including the backend service, MySQL database, and Redis cache. Environment variables are used to configure database connections, cache types, storage, and upload paths. ```bash # Docker Compose deployment version: '3.8' services: aipexbase: image: aipexbase/backend:latest ports: - "8080:8080" environment: - DB_TYPE=mysql - MYSQL_HOST=mysql - MYSQL_PORT=3306 - MYSQL_DATABASE=aipexbase - MYSQL_USER=root - MYSQL_PASSWORD=password - CACHE_TYPE=redis - REDIS_HOST=redis - REDIS_PORT=6379 - STORAGE_TYPE=local - UPLOAD_PATH=/data/uploads volumes: - ./uploads:/data/uploads depends_on: - mysql - redis mysql: image: mysql:8.0 environment: - MYSQL_ROOT_PASSWORD=password - MYSQL_DATABASE=aipexbase volumes: - mysql_data:/var/lib/mysql redis: image: redis:7-alpine ports: - "6379:6379" volumes: mysql_data: ``` -------------------------------- ### User Registration with Custom Fields Source: https://context7.com/kuafuai/aipexbase/llms.txt Dynamic user registration endpoint supporting custom registration fields with automatic table creation. Accepts username, email, password, phone, and nested profile objects. Returns created user details including ID upon successful registration. ```bash # Register a new user with custom fields curl -X POST "http://localhost:8080/login/register?table=users" \ -H "Content-Type: application/json" \ -d '{ "username": "jane_smith", "email": "jane@example.com", "password": "SecurePass456!", "phone": "+1234567890", "profile": { "firstName": "Jane", "lastName": "Smith", "dateOfBirth": "1995-06-15" } }' ``` -------------------------------- ### Application Configuration Source: https://context7.com/kuafuai/aipexbase/llms.txt Environment-based configuration for the application, including database, cache, storage, authentication, and file upload settings. ```APIDOC ## Application Configuration ### Description Environment-based configuration supporting MySQL, Redis, S3 storage, and multiple authentication providers. ### Method Not applicable (Configuration files provided) ### Endpoint Not applicable ### Parameters N/A ### Request Example #### `application.yml` Configuration ```yaml server: port: 8080 app: profile: /data/uploadPath version: 1.0.0 # Database configuration (MySQL) spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/aipexbase?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai username: root password: your_password # Cache configuration (local or redis) cache: type: local # Options: local, redis # Storage configuration (local or S3) storage: type: local # Options: local, s3 s3: access_key: your_access_key secret_key: your_secret_key endpoint: https://s3.amazonaws.com bucket_name: aipexbase region: us-east-1 # Token expiration (in minutes) token: expireTime: 43200 # 30 days # File upload limits spring: servlet: multipart: max-request-size: 100MB max-file-size: 50MB ``` #### Docker Compose Deployment ```yaml version: '3.8' services: aipexbase: image: aipexbase/backend:latest ports: - "8080:8080" environment: - DB_TYPE=mysql - MYSQL_HOST=mysql - MYSQL_PORT=3306 - MYSQL_DATABASE=aipexbase - MYSQL_USER=root - MYSQL_PASSWORD=password - CACHE_TYPE=redis - REDIS_HOST=redis - REDIS_PORT=6379 - STORAGE_TYPE=local - UPLOAD_PATH=/data/uploads volumes: - ./uploads:/data/uploads depends_on: - mysql - redis mysql: image: mysql:8.0 environment: - MYSQL_ROOT_PASSWORD=password - MYSQL_DATABASE=aipexbase volumes: - mysql_data:/var/lib/mysql redis: image: redis:7-alpine ports: - "6379:6379" volumes: mysql_data: ``` ### Response N/A ``` -------------------------------- ### Configure MCP Server in Cursor Settings Source: https://github.com/kuafuai/aipexbase/blob/main/docs/IntegrationAI.md JSON configuration snippet for adding AIPEXBASE MCP server to Cursor IDE settings. Replace the domain/IP address and API token with your application's credentials obtained from the AIPEXBASE admin panel. ```json { "mcpServers": { "aipexbase-mcp-server": { "url": "http://your-domain-or-ip/mcp/sse?token=coding123" } } } ``` -------------------------------- ### Frontend Integration with aipexbase.js SDK (JavaScript) Source: https://context7.com/kuafuai/aipexbase/llms.txt Integrate the AIPEXBASE frontend SDK (aipexbase.js) to perform data operations and call AI capabilities. Requires initialization with a base URL and API token. ```javascript // Frontend integration with aipexbase.js SDK import { AipexBase } from 'aipexbase'; // Initialize the SDK const api = new AipexBase({ baseURL: 'http://your-domain.com', token: 'your_api_key_token' }); // Perform data operations const users = await api.data.list('users', { filters: { status: 'active' }, pageSize: 20 }); // Add a new record const newRecord = await api.data.add('books', { title: 'The Great Gatsby', author: 'F. Scott Fitzgerald', publishDate: '1925-04-10', available: true }); // Call AI capabilities const aiResponse = await api.text.text2text({ text: 'Summarize this article', prompt: 'You are a helpful assistant' }); ``` -------------------------------- ### Process Text with AI - Text-to-Text Source: https://context7.com/kuafuai/aipexbase/llms.txt AI-powered text processing endpoint supporting conversation context and custom system prompts. Enables complex text transformations, summaries, and contextual responses. Returns processed text output with optional conversation tracking. ```bash curl -X POST "http://localhost:8080/api/text/text2text" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "text": "Explain quantum computing in simple terms", "prompt": "You are a helpful assistant that explains complex topics simply", "conversationId": "conv_12345" }' ``` -------------------------------- ### Application Configuration (YAML) Source: https://context7.com/kuafuai/aipexbase/llms.txt Configure application settings including server port, profile paths, database (MySQL), cache (local/Redis), storage (local/S3), token expiration, and file upload limits. This YAML file is typically located at backend/src/main/resources/application.yml. ```yaml # backend/src/main/resources/application.yml server: port: 8080 app: profile: /data/uploadPath version: 1.0.0 # Database configuration (MySQL) spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/aipexbase?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai username: root password: your_password # Cache configuration (local or redis) cache: type: local # Options: local, redis # Storage configuration (local or S3) storage: type: local # Options: local, s3 s3: access_key: your_access_key secret_key: your_secret_key endpoint: https://s3.amazonaws.com bucket_name: aipexbase region: us-east-1 # Token expiration (in minutes) token: expireTime: 43200 # 30 days # File upload limits spring: servlet: multipart: max-request-size: 100MB max-file-size: 50MB ``` -------------------------------- ### MCP Server Configuration for IDEs (JSON) Source: https://context7.com/kuafuai/aipexbase/llms.txt Configure AI IDEs like Cursor to connect to AIPEXBASE using the Model Context Protocol (MCP). This involves adding the server details to the IDE's settings, including the server URL and an authentication token. ```json // Configuration for Cursor or other MCP-compatible IDEs // Add to Cursor settings > MCP Servers { "mcpServers": { "aipexbase-mcp-server": { "url": "http://your-domain-or-ip:8080/mcp/sse?token=coding123" } } } ``` -------------------------------- ### User Registration Source: https://context7.com/kuafuai/aipexbase/llms.txt Dynamically register new users. This endpoint supports custom registration fields and can automatically create tables if they don't exist. ```APIDOC ## POST /login/register ### Description Registers a new user, allowing for custom fields and automatic table creation based on the `table` query parameter. ### Method POST ### Endpoint `/login/register?table={tableName}` ### Parameters #### Query Parameters - **table** (string) - Required - The name of the table to register the user into (e.g., `users`). #### Request Body - **fields** (object) - Required - Key-value pairs representing the user's data, including custom fields. The structure depends on the `table` specified. - Example fields for `users` table: - **username** (string) - Required - The user's unique username. - **email** (string) - Required - The user's email address. - **password** (string) - Required - The user's password. - **phone** (string) - Optional - The user's phone number. - **profile** (object) - Optional - Nested object for additional profile information (e.g., `firstName`, `lastName`, `dateOfBirth`). ### Request Example ```json { "username": "jane_smith", "email": "jane@example.com", "password": "SecurePass456!", "phone": "+1234567890", "profile": { "firstName": "Jane", "lastName": "Smith", "dateOfBirth": "1995-06-15" } } ``` ### Response #### Success Response (200) - **code** (number) - 0 for success. - **data** (object) - Information about the newly registered user, typically including their `id` and other submitted fields. - **message** (string) - "success" for success. #### Response Example ```json { "code": 0, "data": { "id": 12346, "username": "jane_smith", "email": "jane@example.com", "phone": "+1234567890", "profile": { "firstName": "Jane", "lastName": "Smith", "dateOfBirth": "1995-06-15" } }, "message": "success" } ``` ``` -------------------------------- ### POST /api/pic/word2pic Source: https://context7.com/kuafuai/aipexbase/llms.txt Generate images from text descriptions using AI image generation services. ```APIDOC ## POST /api/pic/word2pic ### Description Generate images from text descriptions using AI image generation services. ### Method POST ### Endpoint /api/pic/word2pic ### Parameters #### Request Body - **text** (string) - Required - A text description for the image to be generated. ### Request Example ```json { "text": "A futuristic city skyline at sunset with flying cars" } ``` ### Response #### Success Response (200) - **code** (integer) - Indicates the status of the operation. - **data** (string) - A URL to the generated image. - **message** (string) - A message indicating the result of the operation. #### Response Example ```json { "code": 0, "data": "https://your-domain.com/images/generated_xyz789.png", "message": "success" } ``` ``` -------------------------------- ### User Authentication - Email Login Source: https://context7.com/kuafuai/aipexbase/llms.txt Authenticate users via email and a verification code. This API supports sending verification codes and logging in with them. ```APIDOC ## POST /login/mail/sendCode ### Description Sends an email verification code to the specified email address. ### Method POST ### Endpoint `/login/mail/sendCode` ### Parameters #### Request Body - **phone** (string) - Required - The user's email address. ### Request Example ```json { "phone": "user@example.com" } ``` ### Response #### Success Response (200) - **code** (number) - 0 for success. - **data** (string) - The verification code sent. - **message** (string) - "success" for success. #### Response Example ```json { "code": 0, "data": "123456", "message": "success" } ``` --- ## POST /login/mail ### Description Logs in a user using their email address and a verification code, returning a JWT token. ### Method POST ### Endpoint `/login/mail` ### Parameters #### Request Body - **phone** (string) - Required - The user's email address. - **code** (string) - Required - The verification code received. ### Request Example ```json { "phone": "user@example.com", "code": "123456" } ``` ### Response #### Success Response (200) - **code** (number) - 0 for success. - **data** (string) - The JWT token for authenticated sessions. - **message** (string) - "success" for success. #### Response Example ```json { "code": 0, "data": "eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjEyMzQ1Njc4OSJ9.xyz", "message": "success" } ``` ``` -------------------------------- ### Invoke Third-Party API with Authentication Source: https://context7.com/kuafuai/aipexbase/llms.txt Call configured third-party APIs through a unified interface with automatic billing and authentication. Supports custom request/response parsing based on API configuration. Requires valid Bearer token authorization. ```bash curl -X POST "http://localhost:8080/api/translate_api" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "text": "Hello, world!", "source_lang": "en", "target_lang": "zh" }' ``` -------------------------------- ### MCP Tools Directory Path Source: https://github.com/kuafuai/aipexbase/blob/main/docs/IntegrationAI.md Backend directory path for contributing custom MCP tools to AIPEXBASE. This location contains Java-based MCP tool implementations that can be extended for additional functionality. ```bash ../backend/src/main/java/com/kuafuai/manage/mcp/tool/ ``` -------------------------------- ### Convert Text to Speech - TTS Source: https://context7.com/kuafuai/aipexbase/llms.txt Converts text input to speech audio files using integrated TTS services. Returns a URL to the generated MP3 audio file. Supports various text inputs and audio quality configurations. ```bash curl -X POST "http://localhost:8080/api/text/tts" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "text": "Welcome to AIPEXBASE, the backend-as-a-service platform for AI applications." }' ``` -------------------------------- ### Payment Order Management API Source: https://context7.com/kuafuai/aipexbase/llms.txt Unified payment interface supporting multiple payment gateways including WeChat Pay, Stripe, and mock payments. ```APIDOC ## POST /generalOrder/create ### Description Create a payment order with specified amount, currency, payment method, and description. ### Method POST ### Endpoint /generalOrder/create ### Parameters #### Request Body - **amount** (number) - Required - The amount of the payment. - **currency** (string) - Required - The currency of the payment (e.g., 'USD'). - **paymentMethod** (string) - Required - The payment method to use (e.g., 'stripe', 'wechat'). - **description** (string) - Optional - A description for the payment. - **metadata** (object) - Optional - Additional metadata for the order. - **userId** (integer) - Optional - The ID of the user associated with the order. - **plan** (string) - Optional - The subscription plan associated with the order. ### Request Example ```json { "amount": 99.99, "currency": "USD", "paymentMethod": "stripe", "description": "Premium subscription - Monthly", "metadata": { "userId": 12345, "plan": "premium" } } ``` ### Response #### Success Response (200) - **code** (integer) - Indicates the status of the operation. - **data** (object) - Contains order details. - **orderId** (string) - The unique identifier for the created order. - **paymentUrl** (string) - The URL for processing the payment. - **status** (string) - The initial status of the order (e.g., 'pending'). - **message** (string) - A message indicating the result of the operation. #### Response Example ```json { "code": 0, "data": { "orderId": "ORD_20231119_12345", "paymentUrl": "https://checkout.stripe.com/pay/cs_test_abc123", "status": "pending" }, "message": "success" } ``` ## GET /generalOrder/payMethod ### Description Retrieve a list of available payment methods supported by the system. ### Method GET ### Endpoint /generalOrder/payMethod ### Parameters None ### Response #### Success Response (200) - **code** (integer) - Indicates the status of the operation. - **data** (array) - A list of available payment method names (e.g., ['wechat', 'stripe', 'mock']). - **message** (string) - A message indicating the result of the operation. #### Response Example ```json { "code": 0, "data": ["wechat", "stripe", "mock"], "message": "success" } ``` ## POST /generalOrder/query ### Description Query the status of a specific payment order. ### Method POST ### Endpoint /generalOrder/query ### Parameters #### Request Body - **orderId** (string) - Required - The unique identifier of the order to query. ### Request Example ```json { "orderId": "ORD_20231119_12345" } ``` ### Response #### Success Response (200) - **code** (integer) - Indicates the status of the operation. - **data** (object) - Contains the order status information. - **orderId** (string) - The unique identifier of the order. - **status** (string) - The current status of the order (e.g., 'paid', 'pending', 'failed'). - **message** (string) - A message indicating the result of the operation. #### Response Example ```json { "code": 0, "data": { "orderId": "ORD_20231119_12345", "status": "paid" }, "message": "success" } ``` ``` -------------------------------- ### User Authentication - Email Verification Code Login Source: https://context7.com/kuafuai/aipexbase/llms.txt Email-based authentication flow using verification codes for secure login without passwords. Includes endpoints to send verification codes to email addresses and authenticate using the received code. ```bash # Send email verification code curl -X POST "http://localhost:8080/login/mail/sendCode" \ -H "Content-Type: application/json" \ -d '{ "phone": "user@example.com" }' # Login with email and verification code curl -X POST "http://localhost:8080/login/mail" \ -H "Content-Type: application/json" \ -d '{ "phone": "user@example.com", "code": "123456" }' ``` -------------------------------- ### Dynamic Database Operations with Java Source: https://context7.com/kuafuai/aipexbase/llms.txt Perform CRUD operations, pagination, batch updates, and counting on dynamic database tables. This service supports multiple databases and requires an instance of DynamicDatabaseService. ```java // Save a new entity to a specific database @Autowired private DynamicDatabaseService userService; User newUser = new User(); newUser.setUsername("alice"); ewUser.setEmail("alice@example.com"); boolean saved = userService.save("app_database_123", newUser); // Query with pagination Page page = new Page<>(1, 10); Wrapper queryWrapper = Wrappers.lambdaQuery(User.class) .eq(User::getStatus, "active") .orderByDesc(User::getCreatedAt); Page result = userService.page("app_database_123", page, queryWrapper); // Update records User updateUser = new User(); updateUser.setId(12345L); updateUser.setEmail("newemail@example.com"); boolean updated = userService.updateById("app_database_123", updateUser); // Delete by ID boolean deleted = userService.removeById("app_database_123", 12345L); // Batch operations List users = Arrays.asList(user1, user2, user3); boolean batchSaved = userService.saveBatch("app_database_123", users); // Count records long count = userService.count("app_database_123", Wrappers.lambdaQuery(User.class).eq(User::getStatus, "active")); // List all records List allUsers = userService.list("app_database_123"); ``` -------------------------------- ### Dynamic Database Service API Source: https://context7.com/kuafuai/aipexbase/llms.txt Perform CRUD operations, batch operations, and query data across multiple databases with dynamic table and schema management. ```APIDOC ## Dynamic Database Service API ### Description Programmatic database operations with dynamic table and schema management, supporting all CRUD operations across multiple databases. ### Method Not applicable (Code examples provided in Java) ### Endpoint Not applicable (Operations are service-level) ### Parameters N/A ### Request Example ```java // Save a new entity to a specific database @Autowired private DynamicDatabaseService userService; User newUser = new User(); newUser.setUsername("alice"); newUser.setEmail("alice@example.com"); boolean saved = userService.save("app_database_123", newUser); // Query with pagination Page page = new Page<>(1, 10); Wrapper queryWrapper = Wrappers.lambdaQuery(User.class) .eq(User::getStatus, "active") .orderByDesc(User::getCreatedAt); Page result = userService.page("app_database_123", page, queryWrapper); // Update records User updateUser = new User(); updateUser.setId(12345L); updateUser.setEmail("newemail@example.com"); boolean updated = userService.updateById("app_database_123", updateUser); // Delete by ID boolean deleted = userService.removeById("app_database_123", 12345L); // Batch operations List users = Arrays.asList(user1, user2, user3); boolean batchSaved = userService.saveBatch("app_database_123", users); // Count records long count = userService.count("app_database_123", Wrappers.lambdaQuery(User.class).eq(User::getStatus, "active")); // List all records List allUsers = userService.list("app_database_123"); ``` ### Response #### Success Response (200) Boolean indicating success or failure for save, update, delete operations. Page object for query operations. List for list operations. Long for count operations. #### Response Example `true` (for successful save/update/delete) `Page` object (for query) `List` object (for list) `long` (for count) ``` -------------------------------- ### POST /api/translate_api Source: https://context7.com/kuafuai/aipexbase/llms.txt Dynamically invoke third-party APIs for translation with automatic billing, authentication, and result parsing. ```APIDOC ## POST /api/translate_api ### Description Call third-party APIs through a unified interface with automatic billing, authentication, and result parsing. ### Method POST ### Endpoint /api/translate_api ### Parameters #### Request Body - **text** (string) - Required - The text to be translated. - **source_lang** (string) - Required - The source language code (e.g., 'en'). - **target_lang** (string) - Required - The target language code (e.g., 'zh'). ### Request Example ```json { "text": "Hello, world!", "source_lang": "en", "target_lang": "zh" } ``` ### Response #### Success Response (200) - **code** (integer) - Indicates the status of the operation. - **data** (object) - Contains the translated text and confidence score. - **translated_text** (string) - The translated text. - **confidence** (number) - The confidence score of the translation. - **message** (string) - A message indicating the result of the operation. #### Response Example ```json { "code": 0, "data": { "translated_text": "你好,世界!", "confidence": 0.98 }, "message": "success" } ``` ``` -------------------------------- ### Extract Text from Images - OCR Recognition Source: https://context7.com/kuafuai/aipexbase/llms.txt Optical character recognition service that extracts text content from images using AI image recognition. Accepts image URLs and returns extracted text. Supports multiple image formats and languages. ```bash curl -X POST "http://localhost:8080/api/pic/pic2word" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "file": "https://your-domain.com/uploads/document.jpg" }' ``` -------------------------------- ### aipexbase.js SDK Integration Source: https://context7.com/kuafuai/aipexbase/llms.txt Frontend integration with the aipexbase.js SDK for performing data operations and calling AI capabilities. ```APIDOC ## aipexbase.js SDK Integration ### Description Frontend integration with aipexbase.js SDK for performing data operations and calling AI capabilities. ### Method Asynchronous functions provided by the SDK. ### Endpoint Base URL configured during SDK initialization. ### Parameters N/A ### Request Example ```javascript import { AipexBase } from 'aipexbase'; // Initialize the SDK const api = new AipexBase({ baseURL: 'http://your-domain.com', token: 'your_api_key_token' }); // Perform data operations const users = await api.data.list('users', { filters: { status: 'active' }, pageSize: 20 }); // Add a new record const newRecord = await api.data.add('books', { title: 'The Great Gatsby', author: 'F. Scott Fitzgerald', publishDate: '1925-04-10', available: true }); // Call AI capabilities const aiResponse = await api.text.text2text({ text: 'Summarize this article', prompt: 'You are a helpful assistant' }); ``` ### Response Results from data operations (e.g., lists of records, added record details) or AI model responses. ``` -------------------------------- ### User Authentication - Password Login Source: https://context7.com/kuafuai/aipexbase/llms.txt Authenticate users using JWT. Supports login via username/password, email/password, and phone/password. ```APIDOC ## POST /login/passwd ### Description Authenticates a user using their username and password, returning a JWT token upon successful login. ### Method POST ### Endpoint `/login/passwd` ### Parameters #### Request Body - **username** (string) - Required - The user's username. - **password** (string) - Required - The user's password. ### Request Example ```json { "username": "john_doe", "password": "SecurePass123!" } ``` ### Response #### Success Response (200) - **code** (number) - 0 for success. - **data** (string) - The JWT token for authenticated sessions. - **message** (string) - "success" for success. #### Response Example ```json { "code": 0, "data": "eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjEyMzQ1Njc4OSJ9.xyz", "message": "success" } ``` --- ## GET /getUserInfo ### Description Retrieves the current logged-in user's information using the provided JWT token. ### Method GET ### Endpoint `/getUserInfo` ### Parameters #### Headers - **Authorization** (string) - Required - `Bearer YOUR_JWT_TOKEN` ### Response #### Success Response (200) - **code** (number) - 0 for success. - **data** (object) - User details including id, username, email, and roles. - **message** (string) - "success" for success. #### Response Example ```json { "code": 0, "data": { "id": 12345, "username": "john_doe", "email": "john@example.com", "roles": ["user"] }, "message": "success" } ``` ``` -------------------------------- ### POST /api/text/tts Source: https://context7.com/kuafuai/aipexbase/llms.txt Convert text to speech audio files using integrated TTS services. ```APIDOC ## POST /api/text/tts ### Description Convert text to speech audio files using integrated TTS services. ### Method POST ### Endpoint /api/text/tts ### Parameters #### Request Body - **text** (string) - Required - The text to be converted to speech. ### Request Example ```json { "text": "Welcome to AIPEXBASE, the backend-as-a-service platform for AI applications." } ``` ### Response #### Success Response (200) - **code** (integer) - Indicates the status of the operation. - **data** (string) - A URL to the generated speech audio file. - **message** (string) - A message indicating the result of the operation. #### Response Example ```json { "code": 0, "data": "https://your-domain.com/audio/tts_abc123.mp3", "message": "success" } ``` ``` -------------------------------- ### POST /api/pic/pic2word Source: https://context7.com/kuafuai/aipexbase/llms.txt Extract text from images using OCR and AI image recognition services. ```APIDOC ## POST /api/pic/pic2word ### Description Extract text from images using OCR and AI image recognition services. ### Method POST ### Endpoint /api/pic/pic2word ### Parameters #### Request Body - **file** (string) - Required - A URL to the image file from which to extract text. ### Request Example ```json { "file": "https://your-domain.com/uploads/document.jpg" } ``` ### Response #### Success Response (200) - **code** (integer) - Indicates the status of the operation. - **data** (string) - The extracted text from the image. - **message** (string) - A message indicating the result of the operation. #### Response Example ```json { "code": 0, "data": "This is the extracted text from the image including all visible text content...", "message": "success" } ``` ``` -------------------------------- ### POST /api/text/text2text Source: https://context7.com/kuafuai/aipexbase/llms.txt AI-powered text processing with support for conversation context and custom prompts. ```APIDOC ## POST /api/text/text2text ### Description AI-powered text processing with support for conversation context and custom prompts. ### Method POST ### Endpoint /api/text/text2text ### Parameters #### Request Body - **text** (string) - Required - The input text to be processed. - **prompt** (string) - Optional - A custom prompt to guide the AI's response. - **conversationId** (string) - Optional - An identifier for maintaining conversation context. ### Request Example ```json { "text": "Explain quantum computing in simple terms", "prompt": "You are a helpful assistant that explains complex topics simply", "conversationId": "conv_12345" } ``` ### Response #### Success Response (200) - **code** (integer) - Indicates the status of the operation. - **data** (string) - The processed text output from the AI. - **message** (string) - A message indicating the result of the operation. #### Response Example ```json { "code": 0, "data": "Quantum computing uses quantum mechanics principles to process information...", "message": "success" } ``` ``` -------------------------------- ### Query Payment Order Status Source: https://context7.com/kuafuai/aipexbase/llms.txt Retrieve current status of a payment order using order ID. Returns order details including status, payment confirmation, and transaction information. ```bash curl -X POST "http://localhost:8080/generalOrder/query" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "orderId": "ORD_20231119_12345" }' ``` -------------------------------- ### Export Table Data to Excel via API Source: https://context7.com/kuafuai/aipexbase/llms.txt This command demonstrates how to export data from a specified table to an Excel file using a POST request to the /api/data/export endpoint. It allows filtering data based on criteria and selecting specific columns for the export. The request requires an authorization token and a JSON payload detailing the filters and columns. ```bash # Export data from a table to Excel curl -X POST "http://localhost:8080/api/data/export?table=users" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_TOKEN" \ -d '{ "filters": { "status": "active", "created_at": { "gte": "2025-01-01" } }, "columns": ["id", "username", "email", "created_at", "status"] }' \ --output users_export.xlsx # The response will be an Excel file with all matching records ``` -------------------------------- ### AIPEXBASE MCP Server Configuration (YAML) Source: https://context7.com/kuafuai/aipexbase/llms.txt Defines the configuration for the AIPEXBASE MCP server, specifying the server name, version, and the endpoints for messages and server-sent events (SSE). ```yaml # AIPEXBASE MCP Server Configuration # backend/src/main/resources/application.yml mcp: server: name: baas-mcp-server version: 1.0.0 message-endpoint: /mcp/message sse-endpoint: /mcp/sse ```