docs(详细设计): 新增Word回填导出设计
This commit is contained in:
65
docs/详细设计/skill/模板选择Skill.md
Normal file
65
docs/详细设计/skill/模板选择Skill.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# 模板选择Skill 设计
|
||||
|
||||
## 1. Skill 定位
|
||||
|
||||
`模板选择Skill` 负责根据目标输出类型选择可用 Word 模板,并校验模板适用流程和版本状态。
|
||||
|
||||
英文实现标识建议使用 `WordTemplateSelectSkill`。
|
||||
|
||||
## 2. 输入
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class WordTemplateSelectInput:
|
||||
template_id: str
|
||||
target_output_type: str
|
||||
workflow_type: str = "registration"
|
||||
```
|
||||
|
||||
## 3. 输出
|
||||
|
||||
```python
|
||||
@dataclass
|
||||
class WordTemplateSelectOutput:
|
||||
template_id: str
|
||||
template_version: str
|
||||
template_file_path: Path
|
||||
template_type: str
|
||||
validation_warnings: list[dict]
|
||||
```
|
||||
|
||||
## 4. 核心方法
|
||||
|
||||
### 4.1 `run(input) -> WordTemplateSelectOutput`
|
||||
|
||||
主入口方法。
|
||||
|
||||
### 4.2 `load_template(template_id) -> WordTemplate`
|
||||
|
||||
读取模板记录。
|
||||
|
||||
### 4.3 `validate_template(template, workflow_type) -> TemplateValidationResult`
|
||||
|
||||
校验模板适用性。
|
||||
|
||||
## 5. 技术实现
|
||||
|
||||
使用技术:
|
||||
|
||||
1. Django ORM
|
||||
2. Django Storage
|
||||
3. 模板元数据 YAML
|
||||
|
||||
## 6. 异常处理
|
||||
|
||||
1. 模板不存在:任务失败。
|
||||
2. 模板文件丢失:任务失败。
|
||||
3. 模板未启用:任务失败。
|
||||
4. 流程不匹配:任务失败。
|
||||
|
||||
## 7. 测试要点
|
||||
|
||||
1. 能选择启用模板。
|
||||
2. 禁用模板不可用。
|
||||
3. 流程不匹配时报错。
|
||||
|
||||
Reference in New Issue
Block a user