### Local Development Setup Source: https://lobehub.com/docs/development/agents/agent-index-and-submit Clone the repository and install dependencies for local development. This is the initial step for contributing or running the project locally. ```bash git clone https://github.com/lobehub/lobe-chat-agents.git cd lobe-chat-agents bun install ``` -------------------------------- ### Successful Startup Log Example (Local Mode) Source: https://lobehub.com/docs/self-hosting/platform/docker-compose This log output indicates that the LobeHub server has started successfully and is accessible locally. ```log [Database] Start to migration... ✅ database migration pass. ------------------------------------- ▲ Next.js 16.x.x - Local: http://localhost:3210 - Network: http://0.0.0.0:3210 ✓ Starting... ✓ Ready in 95ms ``` -------------------------------- ### Successful Startup Log Example (Port Mode) Source: https://lobehub.com/docs/self-hosting/platform/docker-compose This log output confirms that the LobeHub server has started successfully and is accessible via the network IP. ```log [Database] Start to migration... ✅ database migration pass. ------------------------------------- ▲ Next.js 16.x.x - Local: http://your_server_ip:3210 - Network: http://0.0.0.0:3210 ✓ Starting... ✓ Ready in 95ms ``` -------------------------------- ### Production Redis Configuration with Authentication Source: https://lobehub.com/docs/self-hosting/advanced/redis Example configuration for a production Redis setup, including authentication, TLS, and a standard prefix. ```shell REDIS_URL=redis://localhost:6379 REDIS_PASSWORD=your-strong-password REDIS_PREFIX=lobechat REDIS_TLS=true ``` -------------------------------- ### Example Settings Object Source: https://lobehub.com/docs/self-hosting/advanced/settings-url-share An example of a settings object in JSON format that can be used for importing. ```json { "keyVaults": { "openai": { "apiKey": "user-key" } } } ``` -------------------------------- ### Install Dokploy Source: https://lobehub.com/docs/self-hosting/platform/dokploy Use this command to install Dokploy on your server. ```Shell curl -sSL https://dokploy.com/install.sh | sh ``` -------------------------------- ### System Prompt for Customer Support Agent Source: https://lobehub.com/docs/usage/getting-started/resource This is an example of a system prompt to guide an agent's behavior when accessing product documentation. It emphasizes searching the knowledge base, citing sources, and handling uncertainty. ```plaintext You are a customer support agent with access to our product documentation. When answering product questions: 1. Always search the knowledge base first 2. Cite specific documents in your responses 3. If unsure, read the full document for context 4. If you can't find info, let the user know ``` -------------------------------- ### Install and Run Codex CLI Source: https://lobehub.com/docs/usage/agent/codex This snippet shows how to install the Codex CLI and run it once to initiate the sign-in process. Sign-in is handled at the CLI level. ```bash npm install -g @lobehub/codex codex ``` -------------------------------- ### Best Practice: Start with -all Source: https://lobehub.com/docs/self-hosting/advanced/model-list Recommends starting model list configuration with `-all` to hide default models, followed by explicitly adding desired models like `gpt-4o` and `gpt-4o-mini`. ```shell OPENAI_MODEL_LIST=-all,+gpt-4o,+gpt-4o-mini ``` -------------------------------- ### Install Project Dependencies with PNPM Source: https://lobehub.com/docs/development/basic/setup-development Install all necessary project dependencies using PNPM. ```shell pnpm i ``` -------------------------------- ### Example Model List Configuration Source: https://lobehub.com/docs/self-hosting/advanced/model-list Illustrates adding specific models, removing others, and customizing display names. This example shows how to add `qwen-7b-chat` and `glm-6b`, remove `gpt-3.5-turbo`, and rename `gpt-4-0125-preview` to `gpt-4-turbo`. ```plaintext +qwen-7b-chat,+glm-6b,-gpt-3.5-turbo,gpt-4-0125-preview=gpt-4-turbo ``` -------------------------------- ### Example Prompts for Video Generation Source: https://lobehub.com/docs/usage/getting-started/generation These examples demonstrate how to describe scenes, motion, and camera techniques for video generation. Focus on verbs and shot language for better results. ```plaintext "A red fox trotting through fresh snow at golden hour, breath visible in the cold air, slow tracking shot, cinematic" ``` ```plaintext "An astronaut floating into a colorful nebula, slow dolly-in, dreamy atmosphere, soft volumetric light" ``` ```plaintext "A cup of coffee being poured in macro slow motion, steam rising, shallow depth of field, commercial product shot" ``` -------------------------------- ### PostgreSQL Database Connection URL Example Source: https://lobehub.com/docs/self-hosting/platform/dokploy This is an example of a PostgreSQL database connection URL. Ensure the port is unused and accessible externally. ```Shell postgresql://postgres:wAbLxfXSwkxxxxxx@45.577.281.48:5432/postgres ``` -------------------------------- ### Examples of Model Extension Configurations Source: https://lobehub.com/docs/self-hosting/advanced/model-list Provides specific examples of how to configure models with their maximum token limits and various extension capabilities such as Function Calling, Vision, and Image Generation. ```plaintext chatglm-6b=ChatGLM 6B<4096> ``` ```plaintext spark-v3.5=讯飞星火 v3.5<8192:fc> ``` ```plaintext gemini-1.5-flash-latest=Gemini 1.5 Flash<16000:vision> ``` ```plaintext o3-mini=OpenAI o3-mini<200000:reasoning:fc> ``` ```plaintext qwen-max-latest=Qwen Max<32768:search:fc> ``` ```plaintext gpt-4-all=ChatGPT Plus<128000:fc:vision:file> ``` ```plaintext gemini-2.0-flash-exp-image-generation=Gemini 2.0 Flash (Image Generation) Experimental<32768:imageOutput:vision> ``` -------------------------------- ### HTTP/HTTPS Connection Example Source: https://lobehub.com/docs/usage/community/mcp-market Example configuration for an MCP server using HTTP/HTTPS, suitable for cloud services and remote APIs. ```JSON { "type": "http", "url": "https://api.example.com/mcp", "headers": { "Authorization": "Bearer YOUR_API_TOKEN" } } ``` -------------------------------- ### Effective Prompt Structure Example Source: https://lobehub.com/docs/usage/getting-started/generation This example demonstrates a structured approach to writing effective prompts for image generation, outlining key components like subject, style, setting, and technical details. ```plaintext [Subject] [Style/Medium] [Setting/Background] [Lighting] [Mood] [Technical details] ``` -------------------------------- ### View Usage Statistics Source: https://lobehub.com/docs/usage/subscription/how-to-check-credit-usage This example describes how to view the current month's computing usage on the Usage Statistics page. ```text On the **Usage Statistics** page, you can view the computing usage for the current month. ``` -------------------------------- ### STDIO Connection Example Source: https://lobehub.com/docs/usage/community/mcp-market Example configuration for an MCP server using the STDIO connection type, typically for local tools and scripts. ```JSON { "type": "stdio", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/workspace"] } ``` -------------------------------- ### Start LobeHub Development Server Source: https://lobehub.com/docs/development/basic/setup-development Launch the LobeHub development server to access the application in your browser. ```shell bun run dev ``` -------------------------------- ### S3 Bucket Name Example Source: https://lobehub.com/docs/self-hosting/environment-variables/s3 Enter the name of your S3 storage bucket. This is a required field. ```bash my-bucket ``` -------------------------------- ### ComfyUI Authentication Configuration Examples Source: https://lobehub.com/docs/development/basic/comfyui-development Provides examples for configuring LobeComfyUI with different authentication methods: none, basic, bearer token, and custom headers. Ensure the baseURL is correctly set for each configuration. ```typescript // No authentication const comfyUI = new LobeComfyUI({ baseURL: 'http://localhost:8000', authType: 'none' }); ``` ```typescript // Basic authentication const comfyUI = new LobeComfyUI({ baseURL: 'https://your-comfyui-server.com', authType: 'basic', username: 'your-username', password: 'your-password' }); ``` ```typescript // Bearer Token const comfyUI = new LobeComfyUI({ baseURL: 'https://your-comfyui-server.com', authType: 'bearer', apiKey: 'your-api-key' }); ``` ```typescript // Custom headers const comfyUI = new LobeComfyUI({ baseURL: 'https://your-comfyui-server.com', authType: 'custom', customHeaders: { 'X-API-Key': 'your-custom-key', 'Authorization': 'Custom your-token' } }); ``` -------------------------------- ### Image Generation Prompt Examples Source: https://lobehub.com/docs/usage/getting-started/generation Illustrative examples of detailed prompts for image generation, showcasing how to specify subject, style, lighting, and quality for desired outcomes. ```plaintext "A futuristic city skyline at sunset, digital art, cyberpunk style, neon lights reflecting on wet streets, cinematic lighting, 4K detail" ``` ```plaintext "A cozy coffee shop interior, watercolor illustration, warm golden light streaming through windows, potted plants on windowsills, soft and inviting atmosphere" ``` ```plaintext "A product photo of a minimalist leather wallet on a clean white background, studio lighting, sharp focus, commercial photography style" ``` -------------------------------- ### Create Deployment Directory Source: https://lobehub.com/docs/self-hosting/platform/docker-compose Execute these commands to create a directory for configuration and database files and navigate into it. ```bash mkdir lobehub && cd lobehub ``` -------------------------------- ### Generate JWT Client Secret with Node.js Source: https://lobehub.com/docs/self-hosting/auth/providers/apple Use this Node.js example to generate a JWT client secret required for Apple Sign In. Ensure you have the 'jsonwebtoken' package installed. Replace placeholders with your actual Team ID, Services ID, and Key ID. ```javascript // Example using Node.js const jwt = require('jsonwebtoken'); const fs = require('fs'); const privateKey = fs.readFileSync('AuthKey_XXXXX.p8'); const token = jwt.sign({}, privateKey, { algorithm: 'ES256', expiresIn: '180d', // Max 6 months issuer: 'YOUR_TEAM_ID', audience: 'https://appleid.apple.com', subject: 'YOUR_SERVICES_ID', // Client ID keyid: 'YOUR_KEY_ID', }); ``` -------------------------------- ### Install Claude Code CLI with Script Source: https://lobehub.com/docs/usage/agent/claude-code Use this command to install the Claude Code CLI using the recommended installation script. Ensure you have curl installed. ```shell curl -fsSL https://claude.ai/install.sh | bash ``` -------------------------------- ### Install Ollama on Linux Source: https://lobehub.com/docs/usage/providers/ollama Installs Ollama on Linux using a curl script. Alternatively, manual installation is available. ```Shell curl -fsSL https://ollama.com/install.sh | sh ``` -------------------------------- ### Start Docker Services Source: https://lobehub.com/docs/development/basic/setup-development Launch all required development services, including PostgreSQL, Redis, RustFS, and SearXNG, using Docker Compose. ```shell bun run dev:docker ``` -------------------------------- ### Install vLLM using Conda Source: https://lobehub.com/docs/usage/providers/vllm Installs vLLM within a Conda-managed Python environment. Ensure Conda is installed and configured. ```Shell conda create -n myenv python=3.12 -y conda activate myenv pip install vllm ``` -------------------------------- ### Install Claude Code CLI with Homebrew Source: https://lobehub.com/docs/usage/agent/claude-code Install the Claude Code CLI on macOS using Homebrew. This is an alternative installation method. ```shell brew install --cask claude-code ``` -------------------------------- ### Path-Style vs Virtual-Host URL Examples Source: https://lobehub.com/docs/self-hosting/environment-variables/s3 Illustrates the URL structure differences between path-style and virtual-host access modes for S3 buckets and objects. ```text path-style: s3.example.net/mybucket/config.env virtual-host: mybucket.s3.example.net/config.env ``` -------------------------------- ### Install vLLM using uv Source: https://lobehub.com/docs/usage/providers/vllm Installs vLLM within a new Python environment managed by uv. Ensure uv is installed first. ```Shell uv venv myenv --python 3.12 --seed source myenv/bin/activate uv pip install vllm ``` -------------------------------- ### Install Codex CLI with Homebrew Source: https://lobehub.com/docs/usage/agent/codex Use this command to install the Codex CLI on macOS using Homebrew. This is a recommended installation method for macOS users. ```bash brew install --cask codex ``` -------------------------------- ### Configure SSRF Protection Scenarios Source: https://lobehub.com/docs/self-hosting/environment-variables/basic Examples demonstrating SSRF protection configurations for different deployment scenarios. Scenario 1 is recommended for public deployments, blocking all private IPs. Scenario 2 allows private IPs for internal deployments. Scenario 3 is a hybrid approach. ```bash # Scenario 1: Public deployment (recommended) # Block all private IP addresses for security SSRF_ALLOW_PRIVATE_IP_ADDRESS=0 ``` ```bash # Scenario 2: Internal deployment # Allow all private IP addresses to access internal image servers SSRF_ALLOW_PRIVATE_IP_ADDRESS=1 ``` ```bash # Scenario 3: Hybrid deployment (most common) # Block private IPs by default, but allow specific trusted internal servers SSRF_ALLOW_PRIVATE_IP_ADDRESS=0 SSRF_ALLOW_IP_ADDRESS_LIST=192.168.1.100,10.0.0.50 ``` -------------------------------- ### Install Codex CLI with npm Source: https://lobehub.com/docs/usage/agent/codex Use this command to install the Codex CLI globally via npm. Ensure Node.js and npm are installed on your system. ```bash npm install -g @openai/codex ``` -------------------------------- ### Configure Migration Environment Variables Source: https://lobehub.com/docs/self-hosting/migration/v2/auth/clerk-to-betterauth Set up the .env file with necessary variables for migration mode, database connections, Clerk API keys, and optional settings like database driver and dry run mode. ```shell # ============================================ # Migration mode: test or prod # Recommended: Start with test mode to verify on a test database, # then switch to prod after confirming everything works # ============================================ CLERK_TO_BETTERAUTH_MODE=test # ============================================ # Database connection (uses corresponding variable based on mode) # TEST_ prefix for test environment, PROD_ prefix for production # ============================================ TEST_CLERK_TO_BETTERAUTH_DATABASE_URL=postgresql://user:pass@test-host:5432/testdb PROD_CLERK_TO_BETTERAUTH_DATABASE_URL=postgresql://user:pass@prod-host:5432/proddb # ============================================ # Clerk API keys (for exporting user data via API) # Get from Clerk Dashboard: Configure → Developers → API Keys # ============================================ TEST_CLERK_TO_BETTERAUTH_CLERK_SECRET_KEY=sk_test_xxx PROD_CLERK_TO_BETTERAUTH_CLERK_SECRET_KEY=sk_live_xxx # ============================================ # Database driver (optional) # neon: Neon serverless driver (default) # node: node-postgres driver # ============================================ CLERK_TO_BETTERAUTH_DATABASE_DRIVER=neon # ============================================ # Dry Run mode (optional) # Set to 1 to only print logs without modifying the database # Recommended: Enable for first run, disable after verification # ============================================ CLERK_TO_BETTERAUTH_DRY_RUN=1 ``` -------------------------------- ### Install Comfy-Manager Manually Source: https://lobehub.com/docs/usage/providers/comfyui Use this method for a direct installation of Comfy-Manager by cloning the repository into your ComfyUI custom_nodes directory. Ensure you restart the ComfyUI server after installation. ```shell # Navigate to ComfyUI's custom_nodes directory cd ComfyUI/custom_nodes # Clone the Comfy-Manager repository git clone https://github.com/ltdrdata/ComfyUI-Manager.git # Restart the ComfyUI server # After restarting, you should see a "Manager" button in the UI ``` -------------------------------- ### Read Documentation with Agent Source: https://lobehub.com/docs/usage/help Use this prompt to instruct an agent to read the help documentation. ```shell Read https://lobehub.com/docs/usage/help ``` -------------------------------- ### Install Comfy-Manager with One-Click Script Source: https://lobehub.com/docs/usage/providers/comfyui This script automates the Comfy-Manager installation process. Run it from your ComfyUI root directory. ```shell # Run from the ComfyUI root directory curl -fsSL https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/install.sh | bash ``` -------------------------------- ### Example S3_ENDPOINT Configuration Source: https://lobehub.com/docs/self-hosting/advanced/s3 Example of how to set the S3_ENDPOINT for Cloudflare R2. Ensure the endpoint does not include the bucket name. ```shell S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com ``` -------------------------------- ### Download Docker Compose and Environment Files Source: https://lobehub.com/docs/self-hosting/platform/docker-compose Download the docker-compose.yml and .env.example files to set up your LobeHub deployment. Rename .env.example to .env to apply your custom configurations. ```Shell curl -O https://raw.githubusercontent.com/lobehub/lobehub/HEAD/docker-compose/deploy/docker-compose.yml curl -O https://raw.githubusercontent.com/lobehub/lobehub/HEAD/docker-compose/deploy/.env.example mv .env.example .env ``` -------------------------------- ### Start Docker Compose Services Source: https://lobehub.com/docs/self-hosting/platform/docker-compose Use this command to start all services defined in the docker-compose.yml file in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Install Ollama Model via CLI Source: https://lobehub.com/docs/usage/providers/ollama Installs a specific Ollama model, such as llama3, using the Ollama command-line interface. ```Shell ollama pull llama3 ``` -------------------------------- ### Fetch and Execute Deployment Script Source: https://lobehub.com/docs/self-hosting/platform/docker-compose Download and run the LobeHub setup script. The '-l en' flag sets the language to English. ```bash bash <(curl -fsSL https://lobe.li/setup.sh) -l en ``` -------------------------------- ### Install Claude Code CLI Source: https://lobehub.com/docs/usage/agent/claude-code Install the Claude Code CLI using npm. This is a prerequisite for using the agent in LobeHub. ```bash npm install -g claude ``` -------------------------------- ### Local Development Redis Configuration Source: https://lobehub.com/docs/self-hosting/advanced/redis Example configuration for setting up Redis for local development, including URL and a development-specific prefix. ```shell REDIS_URL=redis://localhost:6379 REDIS_PREFIX=lobechat-dev ``` -------------------------------- ### Example Task Prompt Source: https://lobehub.com/docs/usage/agent/scheduled-task This is an example of a prompt that can be used for a scheduled task. It specifies the content to analyze and the desired format for the output. ```plaintext Analyze today's top tech news and summarize: 1. Major product launches 2. Funding announcements 3. Industry trends Format as a brief executive summary. ``` -------------------------------- ### Configuring Multiple Model Providers Source: https://lobehub.com/docs/self-hosting/advanced/model-list Demonstrates how to configure model lists for multiple providers simultaneously, including OpenAI, Anthropic, and Google. Each provider has its API key and model list defined separately. ```shell # OpenAI — curated list OPENAI_API_KEY=sk-... OPENAI_MODEL_LIST=-all,+gpt-4o,+gpt-4o-mini # Anthropic — long context backup ANTHROPIC_API_KEY=sk-ant-... ANTHROPIC_MODEL_LIST="+claude-3-opus-20240229=Claude 3 Opus<200000:vision:fc>,+claude-3-5-sonnet-20241022=Claude 3.5 Sonnet<200000:vision:fc" # Google GOOGLE_API_KEY=... GOOGLE_MODEL_LIST="+gemini-1.5-pro=Gemini 1.5 Pro<1000000:vision:fc>" ``` -------------------------------- ### Verify Comfy-Manager Installation Source: https://lobehub.com/docs/usage/providers/comfyui After installing Comfy-Manager, verify its successful integration by restarting the ComfyUI server and checking for the 'Manager' button in the UI. ```text 1. Restart the ComfyUI server 2. Visit http://localhost:8000 3. You should see a "Manager" button in the bottom-right corner ``` -------------------------------- ### Inspect RustFS Service and Initialization Logs Source: https://lobehub.com/docs/self-hosting/platform/docker-compose View logs for the RustFS service and its initialization process to troubleshoot file upload failures. Also, verify if the required bucket has been created. ```shell docker compose logs rustfs docker compose logs rustfs-init ``` ```shell docker compose exec rustfs ls /data/lobe ``` -------------------------------- ### Start vLLM server Source: https://lobehub.com/docs/usage/providers/vllm Starts a vLLM server with the specified model. The server is compatible with the OpenAI API protocol and defaults to http://localhost:8000. ```Shell vllm serve Qwen/Qwen2.5-1.5B-Instruct ``` -------------------------------- ### Best Practice: Use Descriptive Display Names Source: https://lobehub.com/docs/self-hosting/advanced/model-list Illustrates using user-friendly and meaningful display names for models, such as 'GPT-4o (Recommended)' and 'GPT-4o Mini (Fast & Cheap)', to improve user experience. ```shell OPENAI_MODEL_LIST="gpt-4o=GPT-4o (Recommended),gpt-4o-mini=GPT-4o Mini (Fast & Cheap)" ``` -------------------------------- ### Configure Development Environment Variables Source: https://lobehub.com/docs/development/basic/setup-development Copy example environment files for Docker services and the Next.js development server. These files should be edited to match your specific configuration needs. ```shell # Docker services configuration cp docker-compose/dev/.env.example docker-compose/dev/.env # Next.js development server configuration cp .env.example.development .env ```