commit 7390df9ee99e3450b01c1a2c31a1b3bcbe7d41f2 Author: guanyuankai Date: Fri Dec 5 09:13:50 2025 +0800 feat: 初始化技术研发部开发规范与模板库 包含代码风格、Git规范、测试规范及相关IDE配置文件。 diff --git a/01技术研发部代码风格规范一览.docx b/01技术研发部代码风格规范一览.docx new file mode 100644 index 0000000..6ce9190 Binary files /dev/null and b/01技术研发部代码风格规范一览.docx differ diff --git a/02Git 版本控制与协作规范.docx b/02Git 版本控制与协作规范.docx new file mode 100644 index 0000000..d63fc8b Binary files /dev/null and b/02Git 版本控制与协作规范.docx differ diff --git a/03代码审查与 PR 协作规范.docx b/03代码审查与 PR 协作规范.docx new file mode 100644 index 0000000..3f63930 Binary files /dev/null and b/03代码审查与 PR 协作规范.docx differ diff --git a/04软件工程测试规范.docx b/04软件工程测试规范.docx new file mode 100644 index 0000000..96133de Binary files /dev/null and b/04软件工程测试规范.docx differ diff --git a/05API 设计与后端架构规范.docx b/05API 设计与后端架构规范.docx new file mode 100644 index 0000000..9c263c6 Binary files /dev/null and b/05API 设计与后端架构规范.docx differ diff --git a/06工程化与 CI.docx b/06工程化与 CI.docx new file mode 100644 index 0000000..9f946b8 Binary files /dev/null and b/06工程化与 CI.docx differ diff --git a/07文档与知识库规范.docx b/07文档与知识库规范.docx new file mode 100644 index 0000000..eaba19c Binary files /dev/null and b/07文档与知识库规范.docx differ diff --git a/08安全开发规范指南.docx b/08安全开发规范指南.docx new file mode 100644 index 0000000..1f58d75 Binary files /dev/null and b/08安全开发规范指南.docx differ diff --git a/ADR_Template.md b/ADR_Template.md new file mode 100644 index 0000000..d2f3fd8 --- /dev/null +++ b/ADR_Template.md @@ -0,0 +1,25 @@ +# ADR 000X: [简短的决策标题] + +* **状态**: [已提议 | 已通过 | 已废弃 | 已取代] +* **决策人**: [姓名] +* **日期**: [YYYY-MM-DD] + +## 1. 背景 (Context) +*描述我们需要解决的问题是什么,以及当前的限制条件。* +*例如:当前的标书生成速度过慢(平均 5分钟),因为是同步调用 LLM。并发量上来后,服务器阻塞严重。* + +## 2. 决策 (Decision) +*描述我们决定做什么。* +*例如:我们将引入 Celery + Redis 实现异步任务队列,将生成任务剥离出主线程。* + +## 3. 备选方案 (Alternatives) +*我们还考虑了什么方案?为什么没选?* +* **方案 A**:使用 Python 原生 asyncio。 + * *原因*:CPU 密集型任务下 asyncio 表现不佳,且无法跨机器扩展。 +* **方案 B**:使用 Kafka。 + * *原因*:对于当前体量,Kafka 运维成本过高,Redis 足够轻量。 + +## 4. 后果 (Consequences) +*决策带来的好处和坏处(权衡)。* +* **好**:API 响应时间降至 100ms;支持水平扩展 Worker 节点。 +* **坏**:增加了运维 Redis 和 Celery Worker 的复杂度;调试异步任务比同步代码困难。 \ No newline at end of file diff --git a/ChangeLog_template.md b/ChangeLog_template.md new file mode 100644 index 0000000..24471b1 --- /dev/null +++ b/ChangeLog_template.md @@ -0,0 +1,18 @@ +# Changelog + +本项目的所有显著更改都将记录在此文件中。 + +## [Unreleased] +### Added +- 新增了 Docker 部署脚本 (MR-102)。 +- 支持了 GPT-4o 模型接口。 + +## [1.0.1] - 2025-11-04 +### Fixed +- 修复了用户登录时 Token 过期导致的 500 错误 (#45)。 +- 修复了移动端 CSS 样式错乱问题。 + +## [1.0.0] - 2025-10-01 +### Added +- 初始化项目,完成基础架构搭建。 +- 实现标书生成的 MVP 版本。 \ No newline at end of file diff --git a/IntelliJ IDEA工具使用说明.docx b/IntelliJ IDEA工具使用说明.docx new file mode 100644 index 0000000..d29c35c Binary files /dev/null and b/IntelliJ IDEA工具使用说明.docx differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/README_Template.md b/README_Template.md new file mode 100644 index 0000000..e5570ed --- /dev/null +++ b/README_Template.md @@ -0,0 +1,63 @@ +# [Project Name] 项目名称 + + + +📖 项目简介 +这里写项目描述。例如:本项目是“南方电网标书生成系统”的后端服务,基于 LLM 实现标书内容的自动化生成与审核。 + +🛠 技术栈 +- **Language**: Python 3.10+ +- **Framework**: FastAPI, LangChain +- **Database**: PostgreSQL, Redis +- **Infra**: Docker, K8s + +⚡ 快速开始 (Quick Start) + +1. 环境准备 +确保本地已安装: +- Docker & Docker Compose +- Python 3.10+ (推荐使用 Conda) + +2. 安装依赖 +克隆仓库 +git clone [http://gitlab.example.com/group/project.git](http://gitlab.example.com/group/project.git) +cd project +配置环境变量 (务必复制 .env.example) +cp .env.example .env +安装依赖 +pip install -r requirements.txt + +3. 本地运行 +启动数据库等中间件 +docker-compose up -d db redis +启动服务 +uvicorn main:app --reload +访问 http://localhost:8000/docs 查看 API 文档。 + +🏗 架构与目录结构 +目录结构 +/src + /api # 接口层 + /core # 核心配置与工具 + /services # 业务逻辑 + /models # 数据库模型 +tests/ # 单元测试 +docs/ # 详细文档 + +. +├─docs # 详细文档 +├─src +│ ├─api # 接口层 +│ ├─core # 核心配置与工具 +│ ├─models # 数据库模型 +│ └─services # 业务逻辑 +└─tests # 单元测试 + +架构图 +这里插入图片链接 + +👥 维护者 +· Owner:@管元恺(oldpipe0123@gmail.com) +· Backup:@陈长文 + +🤝 贡献指南(公司项目不需要) \ No newline at end of file diff --git a/VS Code工具使用说明.docx b/VS Code工具使用说明.docx new file mode 100644 index 0000000..e3ce8e1 Binary files /dev/null and b/VS Code工具使用说明.docx differ diff --git a/cpp/.clang-format b/cpp/.clang-format new file mode 100644 index 0000000..1a19d76 --- /dev/null +++ b/cpp/.clang-format @@ -0,0 +1,5 @@ +BasedOnStyle: Google +IndentWidth: 4 +ColumnLimit: 100 +DerivePointerAlignment: false +PointerAlignment: Left \ No newline at end of file diff --git a/java/checkstyle.xml b/java/checkstyle.xml new file mode 100644 index 0000000..ad1b014 --- /dev/null +++ b/java/checkstyle.xml @@ -0,0 +1,483 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/java-style.xm b/java/java-style.xm new file mode 100644 index 0000000..7572aa2 --- /dev/null +++ b/java/java-style.xm @@ -0,0 +1,337 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/javaScript/.prettierrc b/javaScript/.prettierrc new file mode 100644 index 0000000..eaf3ea3 --- /dev/null +++ b/javaScript/.prettierrc @@ -0,0 +1,6 @@ +{ + "semi": true, + "singleQuote": true, + "tabWidth": 4, + "printWidth": 100 +} \ No newline at end of file diff --git a/pull_request_template.md b/pull_request_template.md new file mode 100644 index 0000000..c2acc21 --- /dev/null +++ b/pull_request_template.md @@ -0,0 +1,17 @@ +## 📝 变更目的 (Objective) +## 🛠 变更内容 (Changes) +- [ ] 核心逻辑:修改了 X 算法的权重计算方式 +- [ ] 数据库:新增 `user_status` 字段 +- [ ] 配置:在 `config.yaml` 中添加了 Redis 超时设置 + +## 📸 测试截图/证据 (Screenshots / Proof) +## 🧪 测试计划 (Test Plan) +1. 单元测试:运行 `pytest tests/auth` 通过 +2. 手动测试:模拟用户登录失败 3 次,验证验证码是否弹出 + +## ⚠️ 风险与副作用 (Risks & Side Effects) +## ✅ 自查清单 (Self Checklist) +- [ ] 我的代码遵循项目的代码风格 (Lint 通过) +- [ ] 我已经添加了必要的注释/文档 +- [ ] 我没有提交敏感信息 (Passwords/Tokens) +- [ ] 本地测试全部通过 \ No newline at end of file diff --git a/python/.flake8 b/python/.flake8 new file mode 100644 index 0000000..89bc282 --- /dev/null +++ b/python/.flake8 @@ -0,0 +1,5 @@ +[flake8] +max-line-length = 100 +# 忽略某些与 Black 冲突的规则 (如 E203) +extend-ignore = E203 +exclude = .git,__pycache__,docs/source/conf.py,old,build,dist \ No newline at end of file diff --git a/python/pyproject.toml b/python/pyproject.toml new file mode 100644 index 0000000..90c857f --- /dev/null +++ b/python/pyproject.toml @@ -0,0 +1,4 @@ +[tool.black] +line-length = 100 +target-version = ['py310'] +include = '\.pyi?$' \ No newline at end of file diff --git a/vscode/extensions.json b/vscode/extensions.json new file mode 100644 index 0000000..c0b9565 --- /dev/null +++ b/vscode/extensions.json @@ -0,0 +1,22 @@ +{ + "recommendations": [ + "ms-python.python", + "ms-python.black-formatter", + "ms-python.flake8", + + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + + "vscjava.vscode-java-pack", + "shengchen.vscode-checkstyle", + + "editorconfig.editorconfig", + "eamodio.gitlens", + "mhutchie.git-graph" + ], + + "unwantedRecommendations": [] +} diff --git a/vscode/settings.json b/vscode/settings.json new file mode 100644 index 0000000..3b22a08 --- /dev/null +++ b/vscode/settings.json @@ -0,0 +1,39 @@ +// .vscode/settings.json +{ + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, + + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter" + }, + + "C_Cpp.clang_format_style": "file", + + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + } + }, + + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + } + }, + + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + + "[java]": { + "editor.defaultFormatter": "redhat.java" }, + "java.format.settings.url": "java-style.xml", + "java.format.settings.profile": "GoogleStyle", + "java.checkstyle.enabled": true, + "java.checkstyle.configuration": "${workspaceFolder}/checkstyle.xml", + "java.checkstyle.version": "10.12.0" +} \ No newline at end of file diff --git a/大纲.docx b/大纲.docx new file mode 100644 index 0000000..af8fffc Binary files /dev/null and b/大纲.docx differ diff --git a/技术研发部开发规范速查清单.docx b/技术研发部开发规范速查清单.docx new file mode 100644 index 0000000..81613cc Binary files /dev/null and b/技术研发部开发规范速查清单.docx differ