doc_parser_skill: - New: verify_flowchart.py (flowchart validation) - Updated: LLM.py (multi-provider: DeepSeek + DashScope) - Updated: image_parser.py (logic tree support, external prompts) - Updated: SKILL.md, prompts/image_prompt.md conflict_detection_skill: - Updated: LLM.py (multi-provider sync) - Updated: detect_conflicts.py (logic tree text conversion) ir_generation_skill: - Replaced old scripts/LLM.py + ir_generator.py with standalone project - New: main.py, config.py, step1-3_*.py, ensemble_merge.py - New: prompts/, tests/ subdirectories tests: - New: acceptance/ test suite with schema validation - Fixed: conftest no longer globally skips non-acceptance tests - Updated: test_sample.py for new ir_generation structure Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
请分析这张图片,判断类型并输出文字描述和(如适用)结构化逻辑树。
|
||||
|
||||
## 判断图片类型
|
||||
|
||||
如果是 **流程图 / 架构图 / 状态图 / 时序图 / 活动图**,你需要输出三项内容:
|
||||
1. 类型标签
|
||||
2. **嵌套逻辑树 JSON**(见下方格式)
|
||||
3. 文字描述
|
||||
|
||||
如果是 **其他类型**(UI原型图 / 界面截图 / 设计稿 / 手机屏幕截图 / 网页截图等),只输出类型标签和简要文字描述。
|
||||
|
||||
## 嵌套逻辑树 JSON 格式(仅流程图/架构图/状态图/时序图/活动图需要)
|
||||
|
||||
**核心原则:用嵌套的 `children` 数组表达流程的层级关系,而不是用 id 引用。** 这种格式更贴近流程图的自然结构,每个节点的后续步骤直接嵌套在其下方。
|
||||
|
||||
### 节点类型
|
||||
|
||||
| 类型 | 含义 | 对应形状 |
|
||||
|------|------|----------|
|
||||
| `start` | 起始节点 | 椭圆/圆角矩形 |
|
||||
| `end` | 结束节点 | 椭圆/圆角矩形 |
|
||||
| `process` | 处理/状态节点 | 矩形/圆角矩形 |
|
||||
| `decision` | 判断节点 | 菱形 |
|
||||
| `action` | 动作节点 | 矩形 |
|
||||
|
||||
### 非判断节点的 children 格式
|
||||
|
||||
对于 `start`、`end`、`process`、`action` 节点,`children` 是一个数组,包含后续步骤节点:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "n1",
|
||||
"name": "节点名称",
|
||||
"type": "process",
|
||||
"children": [
|
||||
{
|
||||
"id": "n2",
|
||||
"name": "下一个步骤",
|
||||
"type": "action",
|
||||
"children": [...]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 判断节点的 children 格式
|
||||
|
||||
对于 `decision` 节点,`children` 是一个数组,每个元素包含 `condition`(分支条件)和 `node`(该分支对应的子节点):
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "n5",
|
||||
"name": "是否满足条件?",
|
||||
"type": "decision",
|
||||
"children": [
|
||||
{
|
||||
"condition": "是",
|
||||
"node": {
|
||||
"id": "n6",
|
||||
"name": "满足条件时的动作",
|
||||
"type": "action",
|
||||
"children": [...]
|
||||
}
|
||||
},
|
||||
{
|
||||
"condition": "否",
|
||||
"node": {
|
||||
"id": "n7",
|
||||
"name": "不满足条件时的动作",
|
||||
"type": "action",
|
||||
"children": [...]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 结束节点
|
||||
|
||||
`end` 节点没有 `children` 字段:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "n10",
|
||||
"name": "流程结束",
|
||||
"type": "end"
|
||||
}
|
||||
```
|
||||
|
||||
### 完整示例
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "n1",
|
||||
"name": "开关状态",
|
||||
"type": "start",
|
||||
"children": [
|
||||
{
|
||||
"id": "n2",
|
||||
"name": "开启",
|
||||
"type": "process",
|
||||
"children": [
|
||||
{
|
||||
"id": "n3",
|
||||
"name": "是否在目标场景?",
|
||||
"type": "decision",
|
||||
"children": [
|
||||
{
|
||||
"condition": "否",
|
||||
"node": {
|
||||
"id": "n4",
|
||||
"name": "不受限",
|
||||
"type": "end"
|
||||
}
|
||||
},
|
||||
{
|
||||
"condition": "是",
|
||||
"node": {
|
||||
"id": "n5",
|
||||
"name": "车速是否≥15km/h且持续5秒?",
|
||||
"type": "decision",
|
||||
"children": [
|
||||
{
|
||||
"condition": "否",
|
||||
"node": {
|
||||
"id": "n6",
|
||||
"name": "不受限",
|
||||
"type": "end"
|
||||
}
|
||||
},
|
||||
{
|
||||
"condition": "是",
|
||||
"node": {
|
||||
"id": "n7",
|
||||
"name": "暂停功能",
|
||||
"type": "action",
|
||||
"children": [
|
||||
{
|
||||
"id": "n8",
|
||||
"name": "发起Toast提示",
|
||||
"type": "end"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "n9",
|
||||
"name": "关闭",
|
||||
"type": "process",
|
||||
"children": [
|
||||
{
|
||||
"id": "n10",
|
||||
"name": "不受限",
|
||||
"type": "end"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 规则
|
||||
|
||||
1. 每条从根节点到 `end` 节点的路径必须是完整的逻辑链
|
||||
2. `decision` 节点的 `children` 必须穷举所有分支(通常为"是/否"),每条分支包含 `condition` 和 `node`
|
||||
3. 只有 `end` 节点没有 `children` 字段,其他所有节点都应该有 `children`
|
||||
4. 节点 id 使用 "n1", "n2", "n3"... 格式,按流程图从上到下、从左到右的顺序编号
|
||||
5. 仔细阅读图片中的每个判断条件和分支走向,确保分支目标节点正确
|
||||
6. 如果流程图中某个分支的后续步骤在图片中没有展示,将其标记为 `end` 节点,`name` 设为"(图中未展示)"
|
||||
7. **如果图片包含多个独立的流程图**(例如上半部分和下半部分分别描述不同场景),使用一个统一的 `process` 根节点将它们组织在一起。例如图片中有"策略A"和"策略B"两个流程,结构为:
|
||||
```json
|
||||
{
|
||||
"id": "n1",
|
||||
"name": "策略总览",
|
||||
"type": "process",
|
||||
"children": [
|
||||
{"id": "n2", "name": "策略A流程", "type": "process", "children": [...]},
|
||||
{"id": "n3", "name": "策略B流程", "type": "process", "children": [...]}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 输出格式
|
||||
|
||||
**1. 类型标签(单独一行):**
|
||||
type: <flowchart|architecture|state|sequence|activity|other>
|
||||
|
||||
**2. 逻辑树 JSON(仅上述5种类型,以 logic_tree: 开头,后跟 JSON 对象):**
|
||||
logic_tree:
|
||||
{...}
|
||||
|
||||
**3. 文字描述(以 description: 开头):**
|
||||
description:
|
||||
该图片的详细文字描述。对于流程图/架构图等类型,这里提供自然语言总结;对于其他类型,这是唯一的描述内容。
|
||||
|
||||
不要输出 ``` 代码块包裹符号,不要输出 ---YAML--- 分隔符,不要添加任何额外的解释或问候语。
|
||||
Reference in New Issue
Block a user