-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
270 lines (255 loc) · 14.3 KB
/
index.html
File metadata and controls
270 lines (255 loc) · 14.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Skill 互动体验 - 小白也能懂</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f5f7fa; color: #1a1a2e; line-height: 1.6; }
.container { max-width: 900px; margin: 0 auto; padding: 20px; }
h1 { text-align: center; font-size: 1.8em; margin: 30px 0 10px; color: #16213e; }
.subtitle { text-align: center; color: #888; margin-bottom: 30px; font-size: 0.95em; }
.section { background: #fff; border-radius: 16px; padding: 28px; margin-bottom: 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.section h2 { font-size: 1.2em; color: #0f3460; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section h2 .icon { font-size: 1.4em; }
/* Demo 1: Prompt vs Skill comparison */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare-card { border: 2px solid #e0e0e0; border-radius: 12px; padding: 20px; transition: all 0.3s; cursor: pointer; }
.compare-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.compare-card.prompt { border-color: #ffb74d; }
.compare-card.prompt:hover { background: #fff8e1; }
.compare-card.skill { border-color: #66bb6a; }
.compare-card.skill:hover { background: #e8f5e9; }
.compare-card h3 { font-size: 1em; margin-bottom: 12px; }
.compare-card .tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 0.75em; color: #fff; margin-bottom: 8px; }
.compare-card.prompt .tag { background: #ff9800; }
.compare-card.skill .tag { background: #4caf50; }
.compare-card ul { padding-left: 18px; font-size: 0.9em; color: #555; }
.compare-card ul li { margin-bottom: 4px; }
/* Demo 2: Skill simulator */
.chat-box { background: #f0f2f5; border-radius: 12px; padding: 16px; min-height: 200px; margin-bottom: 12px; overflow-y: auto; max-height: 400px; }
.msg { margin-bottom: 12px; display: flex; gap: 10px; align-items: flex-start; }
.msg.user { flex-direction: row-reverse; }
.msg .avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2em; flex-shrink: 0; }
.msg.user .avatar { background: #e3f2fd; }
.msg.agent .avatar { background: #f3e5f5; }
.msg .bubble { padding: 10px 16px; border-radius: 12px; max-width: 70%; font-size: 0.9em; line-height: 1.5; }
.msg.user .bubble { background: #1976d2; color: #fff; border-bottom-right-radius: 4px; }
.msg.agent .bubble { background: #fff; color: #333; border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.msg.system .bubble { background: #e8f5e9; color: #2e7d32; border-left: 3px solid #4caf50; max-width: 100%; font-size: 0.85em; }
.prompt-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.prompt-btns button { padding: 8px 18px; border: 2px solid #1976d2; background: #fff; color: #1976d2; border-radius: 20px; cursor: pointer; font-size: 0.9em; transition: all 0.2s; }
.prompt-btns button:hover { background: #1976d2; color: #fff; }
.prompt-btns button:disabled { opacity: 0.5; cursor: not-allowed; }
/* Demo 3: Progressive Disclosure */
.drawer-demo { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.drawer { width: 140px; border: 2px solid #ccc; border-radius: 12px; overflow: hidden; transition: all 0.3s; cursor: pointer; }
.drawer:hover { border-color: #1976d2; box-shadow: 0 4px 16px rgba(25,118,210,0.2); }
.drawer.open { border-color: #4caf50; }
.drawer .handle { padding: 12px 8px; text-align: center; font-size: 0.85em; font-weight: 600; transition: background 0.3s; }
.drawer:not(.open) .handle { background: #f5f5f5; color: #666; }
.drawer.open .handle { background: #4caf50; color: #fff; }
.drawer .content { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; padding: 0 10px; font-size: 0.78em; color: #555; }
.drawer.open .content { max-height: 200px; padding: 10px; }
.token-counter { text-align: center; margin-top: 16px; font-size: 1.1em; }
.token-counter .num { font-weight: 700; color: #e91e63; font-size: 1.3em; }
.token-counter .saved { color: #4caf50; font-weight: 600; }
/* Demo 4: Lifecycle */
.lifecycle-steps { display: flex; gap: 0; align-items: center; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.lc-step { background: #fff; border: 2px solid #e0e0e0; border-radius: 12px; padding: 14px 18px; text-align: center; min-width: 120px; transition: all 0.3s; cursor: pointer; }
.lc-step.active { border-color: #1976d2; background: #e3f2fd; transform: scale(1.05); }
.lc-step .lc-icon { font-size: 1.8em; margin-bottom: 6px; }
.lc-step .lc-label { font-size: 0.85em; font-weight: 600; color: #333; }
.lc-arrow { font-size: 1.5em; color: #bbb; margin: 0 4px; }
.lc-detail { background: #f5f5f5; border-radius: 8px; padding: 14px; margin-top: 12px; font-size: 0.9em; color: #444; min-height: 60px; text-align: center; }
@media (max-width: 600px) {
.compare-grid { grid-template-columns: 1fr; }
.drawer { width: 110px; }
.lifecycle-steps { gap: 4px; }
.lc-step { min-width: 90px; padding: 10px; }
}
</style>
</head>
<body>
<div class="container">
<h1>Skill 互动体验</h1>
<p class="subtitle">不写代码也能懂的 AI 技能系统 | 点击下方各个区域试试看</p>
<!-- Section 1: Prompt vs Skill -->
<div class="section">
<h2><span class="icon">1</span> Prompt vs Skill:有什么不同?</h2>
<p style="margin-bottom: 16px; font-size: 0.9em; color: #666;">点击卡片查看对比细节:</p>
<div class="compare-grid">
<div class="compare-card prompt" onclick="this.classList.toggle('expanded')">
<span class="tag">Prompt(提示词)</span>
<h3>像一张便签纸</h3>
<ul>
<li>每次都要重新写或粘贴</li>
<li>用完就没了,下次找不到</li>
<li>只有文字,没法带工具</li>
<li>别人用不了你的提示词</li>
<li>AI 不会主动去找它</li>
</ul>
</div>
<div class="compare-card skill">
<span class="tag">Skill(技能)</span>
<h3>像一本操作手册</h3>
<ul>
<li>写一次,永久保存</li>
<li>AI 自动识别并调用</li>
<li>可以带模板、脚本、参考资料</li>
<li>团队所有人共享复用</li>
<li>有"封面"让 AI 快速筛选</li>
</ul>
</div>
</div>
</div>
<!-- Section 2: Skill Discovery Simulator -->
<div class="section">
<h2><span class="icon">2</span> 模拟:AI 如何自动找到 Skill</h2>
<p style="margin-bottom: 16px; font-size: 0.9em; color: #666;">假设 AI 装了 3 个 Skill,试试说不同的话,看 AI 会选哪个:</p>
<div class="chat-box" id="chatBox">
<div class="msg system">
<div class="bubble">AI 已加载 3 个 Skill 的"名片":<br><b>write-weekly-report</b> — 生成结构化周报<br><b>code-review</b> — 审查代码质量<br><b>translate-doc</b> — 翻译文档为多语言</div>
</div>
</div>
<div class="prompt-btns" id="promptBtns">
<button onclick="simulateChat('帮我写一份这周的周报', 'write-weekly-report')">帮我写周报</button>
<button onclick="simulateChat('帮我看看这段代码有没有 bug', 'code-review')">Review 代码</button>
<button onclick="simulateChat('把这份文档翻译成英文', 'translate-doc')">翻译文档</button>
<button onclick="simulateChat('帮我订一张机票', null)">订机票</button>
</div>
</div>
<!-- Section 3: Progressive Disclosure -->
<div class="section">
<h2><span class="icon">3</span> 渐进式披露:按需打开抽屉</h2>
<p style="margin-bottom: 16px; font-size: 0.9em; color: #666;">AI 平时只看 Skill 的"名片"(几十字),需要时才打开对应内容。点击抽屉体验:</p>
<div class="drawer-demo">
<div class="drawer" onclick="toggleDrawer(this, 80)" data-tokens="80">
<div class="handle">Frontmatter<br><small>名片</small></div>
<div class="content">name: weekly-report<br>description: 帮用户生成结构化周报<br><br><em>永远在 AI 记忆里</em></div>
</div>
<div class="drawer" onclick="toggleDrawer(this, 500)" data-tokens="500">
<div class="handle">SKILL.md<br><small>正文</small></div>
<div class="content">步骤1: 收集本周工作<br>步骤2: 按模板整理<br>步骤3: 生成图表<br>步骤4: 输出 Markdown<br><br><em>触发时才加载</em></div>
</div>
<div class="drawer" onclick="toggleDrawer(this, 300)" data-tokens="300">
<div class="handle">templates/<br><small>模板</small></div>
<div class="content">周报模板.md<br>- 本周亮点<br>- 进度更新<br>- 下周计划<br><br><em>用到时才读取</em></div>
</div>
<div class="drawer" onclick="toggleDrawer(this, 200)" data-tokens="200">
<div class="handle">scripts/<br><small>脚本</small></div>
<div class="content">chart.py<br>→ 自动生成趋势图<br>→ 确定性计算<br><br><em>需要画图时执行</em></div>
</div>
<div class="drawer" onclick="toggleDrawer(this, 400)" data-tokens="400">
<div class="handle">references/<br><small>参考</small></div>
<div class="content">公司术语表<br>部门缩写对照<br>历史周报范例<br><br><em>需要查阅时加载</em></div>
</div>
</div>
<div class="token-counter">
当前 AI 记忆占用:<span class="num" id="tokenCount">80</span> tokens
<span class="saved" id="savedMsg">(节省了 93% 的空间!)</span>
</div>
</div>
<!-- Section 4: Lifecycle -->
<div class="section">
<h2><span class="icon">4</span> Skill 的一生:从创建到更新</h2>
<p style="margin-bottom: 16px; font-size: 0.9em; color: #666;">点击每个阶段了解详情:</p>
<div class="lifecycle-steps">
<div class="lc-step active" onclick="showLifecycle(0)">
<div class="lc-icon">📝</div>
<div class="lc-label">创建</div>
</div>
<div class="lc-arrow">→</div>
<div class="lc-step" onclick="showLifecycle(1)">
<div class="lc-icon">🧪</div>
<div class="lc-label">测试</div>
</div>
<div class="lc-arrow">→</div>
<div class="lc-step" onclick="showLifecycle(2)">
<div class="lc-icon">📦</div>
<div class="lc-label">安装</div>
</div>
<div class="lc-arrow">→</div>
<div class="lc-step" onclick="showLifecycle(3)">
<div class="lc-icon">🔄</div>
<div class="lc-label">自动更新</div>
</div>
<div class="lc-arrow">→</div>
<div class="lc-step" onclick="showLifecycle(4)">
<div class="lc-icon">🤝</div>
<div class="lc-label">分享</div>
</div>
</div>
<div class="lc-detail" id="lcDetail">
用 <code>/skill-creator</code> 告诉 AI 你想要什么能力,让 AI 帮你写 Skill。你只需描述需求,AI 负责生成 SKILL.md 和相关文件。
</div>
</div>
</div>
<script>
const skillDB = {
'write-weekly-report': { name: 'write-weekly-report', desc: '生成结构化周报' },
'code-review': { name: 'code-review', desc: '审查代码质量' },
'translate-doc': { name: 'translate-doc', desc: '翻译文档为多语言' }
};
let chatStep = 0;
function simulateChat(userMsg, matchedSkill) {
const box = document.getElementById('chatBox');
const userDiv = document.createElement('div');
userDiv.className = 'msg user';
userDiv.innerHTML = `<div class="avatar">👤</div><div class="bubble">${userMsg}</div>`;
box.appendChild(userDiv);
setTimeout(() => {
const agentDiv = document.createElement('div');
agentDiv.className = 'msg agent';
if (matchedSkill) {
const s = skillDB[matchedSkill];
agentDiv.innerHTML = `<div class="avatar">🤖</div><div class="bubble">
<b>✅ 匹配到 Skill:${s.name}</b><br>
<small style="color:#888">正在加载 SKILL.md 正文...</small><br><br>
好的!我已加载「${s.desc}」技能,正在为你执行...
</div>`;
} else {
agentDiv.innerHTML = `<div class="avatar">🤖</div><div class="bubble">
<b>❌ 未匹配到任何 Skill</b><br>
<small style="color:#888">已有 Skill 中没有匹配的能力</small><br><br>
抱歉,我目前没有"订机票"这个技能。但我可以用通用能力帮你查找信息。
</div>`;
}
box.appendChild(agentDiv);
box.scrollTop = box.scrollHeight;
}, 600);
}
let totalTokens = 80;
const maxTokens = 80 + 500 + 300 + 200 + 400;
function toggleDrawer(el, tokens) {
const wasOpen = el.classList.contains('open');
el.classList.toggle('open');
totalTokens += wasOpen ? -tokens : tokens;
document.getElementById('tokenCount').textContent = totalTokens;
const pct = Math.round((1 - totalTokens / maxTokens) * 100);
const savedEl = document.getElementById('savedMsg');
if (totalTokens <= 80) {
savedEl.textContent = `(节省了 ${pct}% 的空间!)`;
savedEl.style.color = '#4caf50';
} else {
savedEl.textContent = `(已使用 ${Math.round(totalTokens/maxTokens*100)}% 空间)`;
savedEl.style.color = totalTokens > maxTokens * 0.7 ? '#e91e63' : '#ff9800';
}
}
const lcTexts = [
'用 /skill-creator 告诉 AI 你想要什么能力,让 AI 帮你写 Skill。你只需描述需求,AI 负责生成 SKILL.md 和相关文件。',
'让 AI 自动生成测试用例,跑一跑看看效果。不满意就反馈修改,就像教实习生一样——这个过程叫做"Agent RL"。',
'用 npx skills add 把 Skill 安装到本地,就像安装一个 App。可以从 GitHub 仓库一键安装别人分享的 Skill。',
'配置 SessionStart Hook,每次启动 AI 时自动检查更新。Skill 本身不需要写更新逻辑——交给"开机脚本"就好。',
'把你的 Skill 放到 GitHub 仓库,团队成员一条命令就能安装。好 Skill 就像好菜谱,值得传播!'
];
function showLifecycle(idx) {
document.querySelectorAll('.lc-step').forEach((el, i) => {
el.classList.toggle('active', i === idx);
});
document.getElementById('lcDetail').textContent = lcTexts[idx];
}
</script>
</body>
</html>