Files
2026Technology-Competition/README.md
T
lhl 84d3b87da3 docs: 输出语言功能文档收尾(README/design.md/计划/opencode忽略)
- README 新增 --output-language 参数表、中文模板用法、auto 推导规则与中文场景注意
- design.md §6.2.1 新增输出语言控制设计(贯通链路/auto推导/生成期强制/标签本地化);
  §7.2 十项校验清单 → 11 项(新增语言一致性维度)
- 计划文档验收复选框勾选
- .gitignore 加入 .opencode/(AI 工具本地配置不入库)
2026-08-26 00:45:09 +08:00

90 lines
3.0 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
```
## 试运行
默认输入为 `samples/` 下既有样本(追加改修·股票场景 + 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 samples\要件定義_追加改修_股票.xlsx `
--template samples\概要設計書テンプレート.docx `
--rules samples\概要設計做成説明書.docx samples\記入規則.docx `
--existing-system samples\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 samples\概要设计书模板_中文.docx `
--output-language zh `
--output output\output.docx
```
`samples\概要设计书模板_中文.docx` 为日文模板的完整镜像(7 章锚点 `section:*` 原样保留),由
`scripts/make_zh_template.py` 生成,可随时用该脚本重新生成。
**中文场景注意**:若规则文档(作成说明书/记入规则)仍为日文,`auto` 推导会倾向日文——请显式
`--output-language zh`,不要依赖 auto。
## 测试
```powershell
python -m pytest
```
全量单测 + 覆盖率检查(红线 `fail_under = 99`)。