docs(quickstart): 更新快速开始文档以支持Nginx反向代理配置 - 修改环境变量配置方式,从直接创建.env文件改为复制模板文件 - 添加必需和可选配置项的详细说明 - 更新Docker Compose启动命令以使用正确的路径 - 增加Nginx反向代理访问方式的说明 - 为本地开发模式添加额外的数据库配置说明 fix(readme): 修正部署说明中的环境变量配置方法 - 将硬编码的环境变量配置改为使用模板文件复制方式 - 更新Docker Compose启动命令路径 - 补充Nginx反向代理访问说明 - 修正数据库配置注意事项 feat(backend): 支持从环境变量读取数据库连接配置 - 添加os模块导入 - 修改DB_URI配置逻辑,优先从环境变量读取 - 适配Docker和本地开发环境的不同数据库连接地址 refactor(docker): 优化Docker Compose配置支持Nginx代理 - 限制后端端口仅本机访问 - 修改前端API URL为相对路径,通过Nginx代理访问 - 限制前端端口仅本机访问 refactor(frontend): 适配Nginx反向代理后端API调用 - 将硬编码的后端API地址改为相对路径 - 支持通过Nginx代理转发请求到后端服务 chore(scripts): 更新启动脚本中的访问地址提示信息 - 修改前端启动成功后的访问地址提示 - 添加Nginx代理访问方式的说明 ```
This commit is contained in:
27
README.md
27
README.md
@@ -104,21 +104,24 @@ Agent1/
|
||||
|
||||
### 方式一:Docker Compose(推荐)
|
||||
|
||||
```bash
|
||||
# 1. 配置 .env 文件
|
||||
echo "ZHIPUAI_API_KEY=your_key_here" > .env
|
||||
```
|
||||
# 1. 配置环境变量
|
||||
cp .env.example .env
|
||||
# 编辑 .env 文件,填入真实的 API Key
|
||||
|
||||
# 2. 启动所有服务
|
||||
docker compose up -d --build
|
||||
docker compose -f docker/docker-compose.yml up -d --build
|
||||
|
||||
# 3. 访问应用
|
||||
# 前端: http://localhost:8501
|
||||
# 后端: http://localhost:8001
|
||||
# 如果配置了 Nginx 反向代理:http://your-domain.com 或 http://your-server-ip
|
||||
# 如果未配置 Nginx(直接访问):
|
||||
# - 前端: http://localhost:8501
|
||||
# - 后端 API: http://localhost:8001
|
||||
```
|
||||
|
||||
### 方式二:本地开发模式
|
||||
|
||||
```bash
|
||||
```
|
||||
# 1. 启动 PostgreSQL
|
||||
docker run -d --name postgres-langgraph \
|
||||
-e POSTGRES_PASSWORD=mysecretpassword \
|
||||
@@ -178,7 +181,7 @@ streamlit run frontend.py
|
||||
|
||||
在 `tools.py` 中添加新的 `@tool` 装饰函数:
|
||||
|
||||
```python
|
||||
```
|
||||
@tool
|
||||
def my_new_tool(param: str) -> str:
|
||||
"""
|
||||
@@ -200,7 +203,7 @@ def my_new_tool(param: str) -> str:
|
||||
|
||||
在 `agent.py` 的 `initialize()` 方法中添加模型配置:
|
||||
|
||||
```python
|
||||
```
|
||||
model_configs = {
|
||||
"zhipu": self._create_zhipu_llm,
|
||||
"local": self._create_local_llm,
|
||||
@@ -227,7 +230,7 @@ model_configs = {
|
||||
|
||||
在 `.env` 文件中配置:
|
||||
|
||||
```env
|
||||
```
|
||||
# 智谱 AI API Key(必需)
|
||||
ZHIPUAI_API_KEY=your_api_key_here
|
||||
|
||||
@@ -242,6 +245,10 @@ VLLM_LOCAL_KEY=token-abc123
|
||||
postgresql://postgres:mysecretpassword@localhost:5432/langgraph_db
|
||||
```
|
||||
|
||||
**注意**:
|
||||
- **本地开发模式**:使用 `localhost` 或 `127.0.0.1`
|
||||
- **Docker Compose 部署**:后端容器内应使用服务名 `postgres`(通过环境变量 `DB_URI` 自动配置)
|
||||
|
||||
如使用 Docker Compose,数据库会在内部网络中自动配置。
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user