# LongArticleSearchAgent 长文供给寻找 Agent ## 1. 项目结构 ``` LongArticleSearchAgent/ ├── app.py # 应用入口 ├── pyproject.toml # 项目元信息 & 工具配置 ├── requirements.txt # Python 依赖 ├── Makefile # 常用命令快捷方式 ├── Dockerfile # 容器构建 ├── .env.example # 环境变量模板 │ ├── src/ │ ├── agent/ # Agent 业务逻辑(待开发) │ │ │ ├── config/ # 配置层(Pydantic Settings) │ │ ├── agent_config.py # 聚合配置入口 │ │ ├── api/ │ │ │ └── deepseek.py # DeepSeek LLM 配置 │ │ ├── aliyun/ │ │ │ └── log.py # 阿里云日志配置 │ │ └── database/ │ │ └── mysql_config.py # MySQL 数据库配置 │ │ │ ├── core/ # 核心层 │ │ ├── api/v1/ # API 路由 & 端点 │ │ │ ├── endpoints/ │ │ │ │ └── health.py # 健康检查端点 │ │ │ ├── middleware/ │ │ │ │ ├── error_handler.py # 全局异常处理 │ │ │ │ └── response.py # 统一响应构建器 R │ │ │ ├── routes/ │ │ │ │ └── route.py # 路由统一注册 │ │ │ └── utils/ │ │ │ └── deps.py # API 依赖容器 │ │ ├── bootstrap/ │ │ │ ├── logging_config.py # 统一日志配置 │ │ │ └── resource_manager.py # 应用生命周期管理 │ │ └── dependency/ │ │ └── dependencies.py # DI 容器(dependency_injector) │ │ │ └── infra/ # 基础设施层 │ ├── database/ │ │ └── mysql/ │ │ └── async_mysql_pool.py # 异步 MySQL 连接池 │ └── trace/ │ └── logging/ │ └── log_service.py # 阿里云日志服务 │ └── tests/ # 测试 ├── conftest.py # 公共 fixtures ├── unit/ │ └── test_config.py └── integration/ └── test_health.py ``` ## 2. 快速开始 ```bash # 安装依赖 make install # 复制环境变量模板并填写真实配置 cp .env.example .env # 开发模式运行(热重载) make dev # 生产模式运行 make run ``` ## 3. 常用命令 | 命令 | 说明 | |------|------| | `make install` | 安装 Python 依赖 | | `make dev` | 开发模式启动(热重载) | | `make run` | 生产模式启动 | | `make test` | 运行测试 | | `make lint` | 代码检查 | | `make format` | 代码格式化 | | `make docker-build` | 构建 Docker 镜像 | | `make docker-run` | 以 Docker 容器运行 | ## 4. 环境变量 参考 [.env.example](.env.example) 查看所有需要配置的环境变量。 ## 5. License [MIT](LICENSE)