Files
zeekerWatchmen/ref/ir_generation_new_skill/prompts/step2_ir_extraction.txt
T
2026-05-25 15:09:42 +08:00

163 lines
7.3 KiB
Plaintext
Executable File
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.
你是吉利汽车车机系统的需求分析专家。你的任务是基于给定的精准上下文包,为单个功能单元(Function Unit)提取详细的 **IR 规则(Intermediate Representation Rule**。
## 上下文
下面是一个功能单元的精准上下文包,包含了从原始需求文档中提取的相关文字、表格和逻辑树:
### 功能单元概要
- **unit_id**: {unit_id}
- **unit_name**: {unit_name}
- **unit_description**: {unit_description}
### 相关文字段落
{texts}
### 相关表格
{tables}
### 相关逻辑树
{logic_trees}
### 图文冲突仲裁(如有)
{resolved_conflicts}
## IR Schema
你需要为这个功能单元输出一个 **规则数组(rules)**。每条规则遵循以下 schema:
```json
{{
"rule_id": "{unit_id}-SYS-FG-01",
"description": "用完整的中文自然语言描述该规则的触发条件和行为,一句话概括",
"priority": "P0",
"sources": [
{{"type": "table", "section": "3.1.1", "row": 2, "text_snippet": "打断:车速≥15km/h..."}},
{{"type": "logic_tree", "image_id": "rId16", "node_ids": ["n19", "n21", "n23", "n25", "n26"]}}
],
"precondition": {{
"switch": "开启",
"app_type": "系统限制",
"app_state": "前台"
}},
"trigger": {{
"operator": "AND",
"conditions": [
{{"signal": "车速", "operator": ">=", "value": 15, "unit": "km/h"}},
{{"signal": "车速_持续时间", "operator": ">", "value": 5, "unit": "秒"}},
{{"signal": "档位", "operator": "!=", "value": "P"}}
]
}},
"actions": [
{{"type": "system", "description": "打断应用前台进程"}},
{{"type": "system", "description": "将应用调入后台"}},
{{"type": "user_interaction", "description": "显示Toast", "content": "在行车状态下无法使用该应用"}}
]
}}
```
### 字段说明(必读)
1. **rule_id**: 格式为 `{unit_id}-类型-序号`,其中类型可以是 SYS(系统行为)、UI(用户交互)、SDK(SDK 限制)。序号从 01 开始。
2. **description**: 完整但简洁地描述整个规则,包括前置条件、触发条件和所有动作。用中文。
3. **priority**: P0(核心安全规则)、P1(重要规则)、P2(边界情况)。
4. **sources**: 每条规则必须列出所有数据来源,包括:
- 引用的表格行(section, row, text_snippet
- 引用的逻辑树节点 ID 列表(image_id, node_ids)。**注意:node_ids 必须列举该规则在逻辑树中经历的所有 decision 和 action 节点。**
5. **precondition**: 规则生效的前置状态条件(开关状态、应用类型、应用前后台状态等)。可以是空对象 `{{}}` 如果无条件。
6. **trigger**: 触发条件对象,包含:
- `operator`: 条件组合方式,`"AND"` 或 `"OR"`
- `conditions`: 条件数组,每个条件必须有 `signal`(信号名)、`operator`(比较运算符)、`value`(数值或字符串)。如果有单位,加 `unit` 字段。
如果触发器是瞬时事件(如用户点击),使用 `event` 字段代替 `conditions`。
7. **actions**: 每个动作必须有 `type``"system"` 或 `"user_interaction"`)和 `description`。用户可见交互(Toast、弹窗、语音播报)必须用 `"user_interaction"` 类型,并包含 `content` 字段。
## Few-shot 示例
### 示例 1:行车娱乐限制(前台打断)
**输入上下文**:开关开启,系统限制类应用在前台,车速≥15km/h且持续>5秒且非P档时,打断应用并显示Toast。
**期望输出**
```json
{{
"rule_id": "FU-001-SYS-01",
"description": "开关开启时,系统限制类应用在前台,当车速≥15km/h且持续超过5秒且非P档时,系统打断应用前台进程、将应用调入后台,并弹出Toast提示'在行车状态下无法使用该应用'",
"priority": "P0",
"sources": [
{{"type": "table", "section": "3.1.1", "row": 2, "text_snippet": "行车娱乐限制:目标应用/功能处于前台时 ○ 打断:车速≥15km/h且持续5秒后..."}},
{{"type": "logic_tree", "image_id": "rId16", "node_ids": ["n2", "n8", "n9", "n11", "n13", "n19", "n21", "n23", "n25", "n26"]}}
],
"precondition": {{
"switch": "开启",
"app_type": "系统限制",
"app_state": "前台"
}},
"trigger": {{
"operator": "AND",
"conditions": [
{{"signal": "车速", "operator": ">=", "value": 15, "unit": "km/h"}},
{{"signal": "车速_持续时间", "operator": ">", "value": 5, "unit": "秒"}},
{{"signal": "档位", "operator": "!=", "value": "P"}}
]
}},
"actions": [
{{"type": "system", "description": "打断应用前台进程"}},
{{"type": "system", "description": "将应用调入后台"}},
{{"type": "user_interaction", "description": "显示Toast", "content": "在行车状态下无法使用该应用"}}
]
}}
```
### 示例 2:行车娱乐禁止(后台启动拦截)
**输入上下文**:开关开启,应用在后台且非前台,非P档时阻止应用启动,并提示。
**期望输出**
```json
{{
"rule_id": "FU-002-SYS-01",
"description": "开关开启时,目标应用处于后台,当档位非P档时,限制应用启动,并弹出Toast提示'请在P挡时使用该功能/应用'",
"priority": "P0",
"sources": [
{{"type": "table", "section": "3.1.1", "row": 2, "text_snippet": "行车娱乐禁止:目标应用/功能处于后台时 ○ 限制:非P挡时,限制目标应用/功能启用..."}},
{{"type": "logic_tree", "image_id": "rId17", "node_ids": ["n5", "n6"]}}
],
"precondition": {{
"switch": "开启",
"app_state": "后台"
}},
"trigger": {{
"operator": "AND",
"conditions": [
{{"signal": "应用请求启动", "operator": "==", "value": true}}
]
}},
"actions": [
{{"type": "system", "description": "限制应用/功能启用"}},
{{"type": "user_interaction", "description": "显示Toast", "content": "请在P挡时使用该功能/应用"}}
]
}}
```
## 关键要求
1. **信号和数值必须精确**:不要写"车速超过阈值",必须写 `"车速 >= 15 km/h"`。
2. **条件必须完整**:如果文档说"车速≥15km/h 且持续超过5秒 且非P档",这三个条件必须全部出现在 trigger.conditions 中。
3. **逻辑树节点必须追踪**:在 sources 中列出该规则在逻辑树中经历的所有 decision 节点和 action 节点。这样做是为了后续审计(检查逻辑树覆盖率)。
4. **优先图片逻辑树**:如果文字和图片存在矛盾,优先采用逻辑树中的路径,但保留文字作为补充参考(将两者都列入 sources)。
5. **动作类型区分**:系统行为(打断进程、限制启动)用 `"system"`,用户可见交互(Toast、弹窗、语音)用 `"user_interaction"`。
6. **多条规则**:如果一个功能单元包含多个独立的行为分支(如正常情况+异常情况),输出多条规则分别描述。规则之间通过 precondition 或 trigger 的条件值来区分。
7. **开关关闭状态**:如果功能单元涉及开关,也要考虑开关关闭时的行为。开关关闭时所有限制失效,这也是一条规则。
## 输出格式
**只输出 JSON 数组,不要有任何其他文字或 markdown 标记**
[
{{ ... }},
{{ ... }}
]
注意:即使只有一个规则,也必须用数组格式 `[...]`。