Files
auto_agent/README.md
T
2026-05-16 18:55:44 +08:00

42 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 进入项目目录并提交代码(Windows 下路径为 .\Agent\)
cd Agent
git add .
git commit -m "修改内容的说明"
git push
# 创建并激活虚拟环境(Linux/macOS 用 source,Windows 用 myenv\Scripts\activate)
python -m venv myenv
source myenv/bin/activate || myenv/Scripts/activate
# 升级 pip 并安装核心依赖
python -m pip install --upgrade pip
pip install -U langchain langchain-openai python-dotenv
# 以可编辑模式安装当前项目(配置见 pyproject.toml)
pip install -e .
# 安装 LangGraph CLI(开发模式)
pip install "langgraph-cli[inmem]"
# 可选:安装数据库相关依赖(psycopg2-binary 用于 PostgreSQL)
pip install sqlalchemy pymysql loguru psycopg2-binary
# 环境变量配置
# Copy .env.example to .env and fill in the required values before running the app.
cp .env.example .env
# 必须填写的变量:
# .env.example
# 启动 Web 对话服务(推荐)
# 确保在 Agent 目录下,且 PYTHONPATH 包含 src 目录
cd ./Agent
export PYTHONPATH=src:$PYTHONPATH # Linux/macOS
# 或 Windows PowerShell: $env:PYTHONPATH="src;$env:PYTHONPATH"
uvicorn agent.web.server:app --host 127.0.0.1 --port 8765
# API 为两阶段调用:POST /api/chat/start(落盘用户消息) + POST /api/chat/complete(推理)
# 前端已按此顺序调用。
# (可选)通过 Cloudflare Tunnel 暴露公网
cloudflared tunnel --url http://localhost:8765