LibreChat-图文并茂手把手教你搭建自己的AI机器人 Step-by-step guide to building your own chatbot

LibreChat是什么 | About LibreChat

  • LibreChat是一个革命性的人工智能聊天机器人,采用了先进的技术,如OpenAI、GPT-4 Vision、Bing、Anthropic、OpenRouter、Google Gemini等。LibreChat完全开源,支持自托管,为用户提供了极大的灵活性和自定义选项。
  • LibreChat is a revolutionary artificial intelligence chatbot that adopts advanced technologies such as OpenAI, GPT-4 Vision, Bing, Anthropic, OpenRouter, Google Gemini, etc. LibreChat is fully open source and supports self-hosting, providing users with great flexibility and customization options.

📌 使用 npm 本地安装 LibreChat | Install LibreChat Locally Using npm

🔧 前提条件 | Prerequisites

  1. Node.js 18+:

  2. Git:

  3. MongoDB (可选) | MongoDB (Optional):

    • 云托管方案 | Cloud-hosted solution
      MongoDB Atlas (cloud.mongodb.com)
    • 本地部署方案 | Self-hosted solution:
      MongoDB Community Server (mongodb.com/try)

🚀 安装流程 | Installation Process

1. 克隆仓库 | Clone Repository

git clone https://github.com/danny-avila/LibreChat.git
cd LibreChat  # 进入项目目录 | Enter project directory

2. 配置文件 | Configure Environment

# Windows 用户用 copy 命令 | Windows users use copy command
cp .env.example .env
  • 配置数据库 | Configure Database:
    .env 文件中设置 MONGO_URI
    Set MONGO_URI in .env file
    示例/Example: mongodb://localhost:27017/LibreChat

3. 安装依赖 | Install Dependencies

npm ci  # 严格依赖安装 | Strict dependency installation

4. 构建前端 | Build Frontend

npm run frontend  # 生成静态资源 | Generate static assets

image

5. 启动服务 | Start Backend

npm run backend  # 运行Node.js服务器 | Run Node.js server

image

6. 访问应用 | Access Application

打开浏览器访问:http://localhost:3080
Open browser at:http://localhost:3080
image
image
image


🔄 更新指南 | Update Guide

  1. 停止服务 | Stop Running Instance
    Ctrl+C 终止进程
    Terminate process with Ctrl+C

  2. 同步最新代码 | Sync Latest Code

    git pull origin main
    
  3. 清理缓存 | Clean Cache

    npm run clean
    
  4. 重建前端 | Rebuild Frontend

    npm run frontend
    
  5. 重启服务 | Restart Service

    npm run backend
    

⚙️ 高级配置 | Advanced Configurations

功能 Function 配置说明 Configuration
向量搜索 Vector Search 需安装Meilisearch Requires Meilisearch setup
自定义API Custom APIs 修改.env的API_ENDPOINT Edit API_ENDPOINT in .env
多模型支持 Multi-Model 配置多个OPENAI_MODELS Configure multiple OPENAI_MODELS
身份验证 Authentication 启用ALLOW_SOCIAL_LOGIN Enable ALLOW_SOCIAL_LOGIN

🛠️ 故障排查 | Troubleshooting

  1. 端口冲突 | Port Conflict

    # 修改端口号 | Change port number
    echo PORT=4000 >> .env
    
  2. 依赖安装失败 | Dependency Failure

    rm -rf node_modules  # 删除依赖 | Remove dependencies
    npm cache clean --force  # 清理缓存 | Clear cache
    npm ci  # 重新安装 | Reinstall
    
  3. MongoDB连接问题 | MongoDB Connection
    检查防火墙是否开放27017端口
    Check firewall for port 27017 access


📚 完整文档资源 | Full Documentation

Conclusion | 结语

  • That's all for today~ - | 今天就写到这里啦~

  • Guys, ( ̄ω ̄( ̄ω ̄〃 ( ̄ω ̄〃)ゝ See you tomorrow~~ | 小伙伴们,( ̄ω ̄( ̄ω ̄〃 ( ̄ω ̄〃)ゝ我们明天再见啦~~

  • Everyone, be happy every day! 大家要天天开心哦

  • Welcome everyone to point out any mistakes in the article~ | 欢迎大家指出文章需要改正之处~

  • Learning has no end; win-win cooperation | 学无止境,合作共赢

  • Welcome all the passers-by, boys and girls, to offer better suggestions! ~~~ | 欢迎路过的小哥哥小姐姐们提出更好的意见哇~~

image

posted @ 2025-10-10 00:25  糖~豆豆  阅读(39)  评论(0)    收藏  举报
Live2D