将输入文档转换为高质量手绘风格的 HTML 认知图,稳定输出类似 Napkin AI / Excalidraw 的效果。
核心特征:
用户文档
↓
[Phase 1] 内容理解 → Semantic JSON
↓
[Phase 2] 布局决策 → Layout JSON + 布局类型
↓
[Phase 3] HTML 渲染 → 使用模板生成完整 HTML
↓
[Phase 4] 质量检查 → 验证输出完整性
从输入文档提取语义结构,输出 Semantic JSON:
{
"title": "文档主标题",
"subtitle": "副标题(可选)",
"tagline": "一句话标语(可选)",
"core_message": "核心观点/结论",
"sections": [
{
"id": 1,
"title": "模块标题",
"color": "blue",
"summary": "模块摘要",
"description": "详细描述",
"dialog": {
"you": "用户可能问的问题",
"ai": "AI 可能的回答"
},
"icon": "🧠"
}
],
"flow_steps": [
{
"title": "步骤标题",
"description": "步骤说明",
"icon": "🎯"
}
],
"conclusions": [
{
"title": "结论区块标题",
"items": ["要点1", "要点2"]
}
]
}
| 颜色 | 背景色 | 文字色 | 适用场景 |
|---|---|---|---|
| ------ | -------- | -------- | ---------- |
| blue | #e3f2fd | #1565c0 | 思维、认知类 |
| green | #e8f5e9 | #2e7d32 | 复盘、成长类 |
| orange | #fff3e0 | #e65100 | 项目、拆解类 |
| red | #fce4ec | #c62828 | 目标、管理类 |
| pink | #ffebee | #d32f2f | 风险、警告类 |
| purple | #f3e5f5 | #7b1fa2 | 认知、提醒类 |
| teal | #e0f2f1 | #00695c | 战略、模拟类 |
根据 Semantic JSON 自动选择最合适的图形结构:
| 布局 | 适用场景 | 节点数 | 结构 |
|---|---|---|---|
| ------ | ---------- | -------- | ------ |
| radial(中心辐射) | 一个主题,多个能力/方面 | 3-7 | 中心+周围 |
| flow(流程图) | 步骤、SOP、教程 | 3-8 | 线性排列 |
| tree(知识树) | 知识体系、课程、框架 | 5-15 | 层级树状 |
| compare(对比图) | 新旧方案、优劣对比 | 2-6 | 左右对比 |
| timeline(时间线) | 发展历程、项目计划 | 3-8 | 时间轴 |
| matrix(矩阵图) | 分类、评估、决策 | 4-9 | 网格矩阵 |
IF sections 有明确顺序/步骤 → flow
IF sections 有层级关系 → tree
IF sections 有对比关系 → compare
IF sections 有时间信息 → timeline
IF sections 有分类/评估 → matrix
ELSE → radial (默认)
{
"layout": "radial",
"canvas_width": 1400,
"canvas_height": 1800,
"title": "AI第二大脑",
"nodes": [
{
"id": "center",
"type": "center",
"label": "AI智囊团",
"icon": "🤖",
"x": 700,
"y": 400
},
{
"id": "node1",
"type": "card",
"label": "思维模式校准",
"color": "blue",
"x": 200,
"y": 200
}
],
"edges": [
{"from": "center", "to": "node1"}
]
}
必须使用完整模板,参考 references/handdraw-template.html
必须包含:
手绘风格参数:
┌─────────────────────────────────────┐
│ [导出按钮] │
│ │
│ ┌───────────────────────────────┐ │
│ │ 标题区域 │ │
│ │ 主标题 + 副标题 + 标语 │ │
│ ───────────────────────────────┘ │
│ │
│ ┌───────────────────────────────┐ │
│ │ 主区域 │ │
│ │ ┌─────┐ ┌─────┐ │ │
│ │ │模块1│ ←→ │模块2│ │ │
│ │ └─────┘ └─────┘ │ │
│ │ ↕ ↕ │ │
│ │ ┌─────┐ ┌─────┐ │ │
│ │ │模块3│ ←→ │中心 │ │ │
│ │ └─────┘ └─────┘ │ │
│ ───────────────────────────────┘ │
│ │
│ ┌───────────────────────────────┐ │
│ │ 流程区域 │ │
│ │ 步骤1 → 步骤2 → 步骤3 │ │
│ └───────────────────────────────┘ │
│ │
│ ┌──────┐ ┌──────┐ ┌──────┐ │ │
│ │结论1 │ │结论2 │ │结论3 │ │ │
│ └──────┘ └──────┘ └──────┘ │ │
└─────────────────────────────────────┘
每个模块卡片必须包含:
<div class="module-node module-blue">
<div class="module-title">1. 思维模式校准</div>
<div class="module-desc">帮你识别思维盲区...</div>
<div class="dialog">
<div class="you">你:我是不是忽略了什么?</div>
<div class="ai">AI:你可能低估了...</div>
</div>
<div class="module-icon">🧠</div>
</div>
生成后必须验证:
| 问题 | 原因 | 解决 |
|---|---|---|
| ------ | ------ | ------ |
| 边框不显示 | RoughJS 未加载 | 检查 assets/js/rough.js 存在 |
| 箭头错位 | 坐标计算错误 | 重新计算节点中心 |
| 导出失败 | html2canvas 未加载 | 检查 assets/js/html2canvas.min.js 存在 |
| 字体不显示 | Google Fonts 加载慢 | 添加本地回退字体 |
{
"风险": "⚠️",
"目标": "🎯",
"AI": "🤖",
"增长": "",
"流程": "➡️",
"决策": "♟️",
"想法": "💡",
"团队": "👥",
"时间": "",
"金钱": "💰",
"安全": "🔒",
"数据": "📊",
"用户": "👤",
"系统": "⚙️",
"学习": "",
"思维": "🧠",
"复盘": "📋",
"项目": "🏗️",
"战略": "♟️",
"认知": "💭"
}
最终输出:
handdraw-YYYY-MM-DD-主题.htmlreferences/handdraw-template.html (必须参考)references/quality-checklist.md (生成后验证)references/roughjs-guide.mdreferences/layout-algorithms.mdreferences/fonts.mdscripts/generate_handdraw.py共 2 个版本