diff --git a/AGENTS copy.md b/AGENTS copy.md deleted file mode 100644 index 758fe2b0..00000000 --- a/AGENTS copy.md +++ /dev/null @@ -1,196 +0,0 @@ -# AGENTS.md — HXOPS 协作与开发规范 - -> 本文件是 **AI 编程助手(Cursor / Codex 等)和团队成员的统一入口**。 -> 原则:**只写最关键的强约束、速览与索引,详细内容一律链接到 `docs/` 下的权威文档**,避免双份维护。 -> 修改本文件请走正常评审;规则若与 `docs/` 冲突,以 `docs/` 中的专项文档为准。 - ---- - -## 1. 项目速览 - -**Enterprise AI Gateway(HXOPS)**:企业级 AI 聚合网关,统一管理/分发 AI Agent(Dify 应用),提供统一对话入口、RBAC 权限、全链路审计与个性化工作台。 - -| 层 | 技术栈 | -| --- | --- | -| 前端 | Vue 3 (Composition API) + TypeScript + Vite + TailwindCSS + Pinia + Vue Router + Vue I18n | -| 后端 | Flask (Python 3.12) + Gevent + SQLAlchemy 2.0 + Flask-Migrate(Alembic) + Gunicorn | -| 数据/基建 | PostgreSQL + Redis + Nginx + Supervisor + Docker Compose | -| 集成 | Dify、企业微信、OA/HR(SQLServer)、PLM(Oracle)、MinIO | -| 研发协作 | Gitee 托管 + Jenkins CI/CD(dev/test/prod 多环境) | - -完整背景见 **[docs/project_context.md](docs/project_context.md)**。 - ---- - -## 2. 技术架构统一(新功能选型) - -> 仓库历史代码后端为 Flask,仍按原栈维护;**新功能/新模块**统一向以下技术栈收敛: - -- **后端**:优先使用 **Python + FastAPI**(异步、Pydantic 校验、自动 OpenAPI 文档)。 -- **前端**:优先使用 **Vue 3 + TailwindCSS**(Composition API + TypeScript)。 -- 数据访问继续使用 **SQLAlchemy 2.0**;数据库迁移继续使用 **Alembic**(见 §8)。 -- 选型有特殊需要偏离上述约定时,须在评审/提交说明中给出理由。 - ---- - -## 3. 目录地图(改代码前先定位) - -```text -backend/app/ - api/ # Blueprint 路由(admin / chat / agents / knowledge_base / shipping_notice ...) - services/ # 业务逻辑(dify、oa_*、plm_oracle、minio_service、wecom_* ...) - models.py # SQLAlchemy 模型(改这里必须配套迁移,见 §8) - response_utils.py / errors.py / decorators.py # 统一返回、异常、权限装饰器 -backend/migrations/ # Alembic 迁移文件 -frontend/src/ - features/ # 按业务域组织(admin / auth / chat) - composables/# Hooks(如 useChat.ts) - views/ components/ i18n.ts -scripts/ # 部署与运维脚本(deploy_compose.sh、healthcheck.sh ...) -docs/ # 权威文档(规范、上下文、流程、发布说明) -``` - -**约定**:新逻辑优先放入对应 `services/`(后端)或 `features/composables/`(前端),复用既有 `response_utils` / `errors` / `decorators` 模式,不要另造轮子。 - ---- - -## 4. 常用命令 - -```bash -# 后端 -cd backend && source venv/bin/activate -python run.py # 启动开发服务器 -flask db migrate -m "msg" && flask db upgrade # 数据库迁移 - -# 前端 -cd frontend && npm run dev # 开发 -npm run build # 改动了 frontend/ 必须保证 build 通过 - -# 部署(与 Jenkins 一致,示例:prod) -./scripts/deploy_compose.sh prod true true true -docker compose logs -f hxops-backend -``` - ---- - -## 5. 代码规范与注释 - -> **适用范围**:**新建或调整**业务代码(人工与 AI Agent 均适用)。Agent 持久规则见 **[`.cursor/rules/code-comments.mdc`](.cursor/rules/code-comments.mdc)**。 - -### 5.1 文件层注释(必须) - -每个源文件顶部须有块注释,说明: - -1. **用途**:本文件在模块/业务流程中的职责。 -2. **引用关系**:主要 `import` / 依赖的上游模块或文件(不必列全量 import,列关键依赖即可)。 -3. **逻辑关系**:与同级或上下游文件如何协作(谁调用谁、数据/状态如何流转)。 - -| 语言/形态 | 写法 | -| --- | --- | -| 前端 TS/JS | 文件首行 `/** ... */`(JSDoc 块注释) | -| Vue SFC | 写在 `