diff --git a/README.md b/README.md index c055eb9..44a82af 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ 这是一个基于FastAPI的聊天API服务,使用OpenAI格式的请求来调用pipeline.invoke方法进行聊天。 +## Docker Installation + +For production deployment using Docker, see the [Installation Guide](README_INSTALL.md). + ## 安装依赖 ```bash @@ -140,15 +144,35 @@ npm install ### Start the `front_apis` server -The frontend talks to the `front_apis` FastAPI service, which by default listens on `http://127.0.0.1:8001`. +The frontend talks to the `front_apis` FastAPI service, which by default listens on `http://127.0.0.1:8500`. From the project root: ```bash -uvicorn fastapi_server.front_apis:app --reload --host 0.0.0.0 --port 8001 +uvicorn fastapi_server.front_apis:app --reload --host 0.0.0.0 --port 8500 ``` -You can change the URL by setting `VITE_FRONT_API_BASE_URL` in `frontend/.env` (defaults to `http://127.0.0.1:8001`). +Or run directly: +```bash +python fastapi_server/front_apis.py +``` + +### Backend run modes + +Run whichever backend mode you need from the project root: + +```bash +# admin/control plane only (/v1/... frontend APIs) +uvicorn fastapi_server.front_apis:app --reload --host 0.0.0.0 --port 8500 + +# DashScope chat runtime only (/apps/... and /v1/apps/... APIs) +uvicorn fastapi_server.server_dashscope:app --reload --host 0.0.0.0 --port 8588 + +# combined mode: one process serves both front_apis + DashScope endpoints +uvicorn fastapi_server.combined:app --reload --host 0.0.0.0 --port 8500 +``` + +You can change the URL by setting `VITE_FRONT_API_BASE_URL` in `frontend/.env` (defaults to `http://127.0.0.1:8500`). ### Start the development server diff --git a/README_INSTALL.md b/README_INSTALL.md new file mode 100644 index 0000000..9a44578 --- /dev/null +++ b/README_INSTALL.md @@ -0,0 +1,256 @@ +# Installation Guide + +This guide explains how to install and run the LangChain Agent application using Docker. + +## Prerequisites + +- Docker (version 20.10 or later) +- Docker Compose (version 2.0 or later, or use `docker compose` command) + +## Quick Start + +1. **Run the installation script:** + ```bash + ./scripts/shell_scripts/install.sh + ``` + + This script will: + - Check for required tools (Docker, docker-compose) + - Create a `.env` file with default configuration + - Build Docker images (or use pre-loaded images) + - Start all services (PostgreSQL, Backend API, Nginx) + +2. **Access the application:** + - Frontend: http://localhost (or http://localhost:80) + - Backend API: http://localhost:8500 + - Database: localhost:5432 + +## Installation for China / Offline Use + +If Docker Hub is slow or inaccessible in your region: + +### Option 1: Use Chinese Docker Mirrors + +Configure Docker to use Chinese registry mirrors: + +```bash +sudo tee /etc/docker/daemon.json <