Files
2026Technology-Competition/README.md
T
lhl becd3e1f57 chore(assets): 参赛提交规范红线修复(ASCII 化 + 相对路径)
按《参赛成果物提交规范·赛道一》§6 红线:
- samples/ 目录改名 sample/(git mv,保留历史)
- 10 个中日文样本文件 + docs 参赛手册 PDF 重命名为 ASCII
  (requirements_*/template_*/rules_*/contestant-handbook.pdf)
- tests/test_zh_template.py 硬编码绝对路径 D:\00_project\Genesis 改为相对路径
- 全局更新 21 个活动文件引用;历史日志/审查文档不改(追加说明记录)
全量 pytest 431 passed / 99.15%
2026-08-26 14:15:52 +08:00

90 lines
2.9 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.
# Genesis — 概要设计书自动生成 Agent
读取 Excel 版要件定义、概要设计做成说明书、概要设计模板、概要设计书记入规则和图表规则等输入资料,自动生成符合规范的 Word 版概要设计书(追加/改修场景会结合既有系统源码做影响调查)。
## 安装
```powershell
# 1. 创建虚拟环境并安装依赖(Python >= 3.11
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e ".[dev]"
# 2. 配置 LLM API Key(真实模式必需;离线 --fake 模式可跳过)
# 编辑 .env(已被 .gitignore 忽略,密钥不入库):
# GENESIS_INFERENCE__API_KEY=sk-xxx
# 可选:
# GENESIS_INFERENCE__BASE_URL=https://api.deepseek.com
# GENESIS_INFERENCE__MODEL=deepseek-chat
```
## 试运行
默认输入为 `sample/` 下既有样本(追加改修·股票场景 + sunOnly 既有系统 + 真实概要设计书模板)。
### 离线 Fake 模式(无需 API key,验证整条管线)
```powershell
python scripts/run_trial.py --fake
```
### 真实 LLM 模式(需先在 .env 配置 API Key
```powershell
python scripts/run_trial.py
```
### 输出
- `output/output.docx` — 概要设计书
- `output/impact-report.json` — 影响调查书(JSON,独立可下载)
`output/` 已加入 `.gitignore`,试运行产物不入库。
### 自定义输入
```powershell
python scripts/run_trial.py `
--requirement sample\requirements_enhancement_stock.xlsx `
--template sample\template_design_ja.docx `
--rules sample\rules_design_ja.docx sample\rules_entry_ja.docx `
--existing-system sample\existing-system `
--language java `
--output output\output.docx
```
### 输出语言(--output-language
生成概要设计书正文的自然语言由 `--output-language` 控制,取值:
| 取值 | 行为 |
|---|---|
| `auto`(默认) | 跟随章节标题:标题含日文假名 → 日文;否则看规则文档主导脚本(作成说明书/记入规则为日文 → 日文) |
| `zh` | 强制简体中文(正文程序化校验:混入日文假名会被重试/硬失败) |
| `ja` | 强制日文(正文程序化校验:纯汉字段落疑似中文会被重试/硬失败) |
表格数据始终照抄源 Excel 原文(不翻译),见 design.md §7.2。
**生成中文概要设计书**需配合中文模板:
```powershell
python scripts/run_trial.py `
--template sample\template_design_zh.docx `
--output-language zh `
--output output\output.docx
```
`sample\template_design_zh.docx` 为日文模板的完整镜像(7 章锚点 `section:*` 原样保留),由
`scripts/make_zh_template.py` 生成,可随时用该脚本重新生成。
**中文场景注意**:若规则文档(作成说明书/记入规则)仍为日文,`auto` 推导会倾向日文——请显式
`--output-language zh`,不要依赖 auto。
## 测试
```powershell
python -m pytest
```
全量单测 + 覆盖率检查(红线 `fail_under = 99`)。