@aiyiran/myclaw 1.1.201 → 1.1.203

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/assets/myclaw-artifacts.js +316 -9
  2. package/assets/myclaw-inject.js +110 -9
  3. package/create_agent.js +15 -11
  4. package/index.js +8 -0
  5. package/package.json +1 -1
  6. package/publish.sh +6 -1
  7. package/server/sync_workspace.py +12 -5
  8. package/skills/yiran-playground-template-use/SKILL.md +5 -4
  9. package/skills/yiran-playground-template-use/prompts/single-html-handoff.txt +23 -0
  10. package/skills/yiran-playground-template-use/scripts/deploy_to_workspace.py +62 -10
  11. package/skills/yiran-playground-template-use/scripts/start_tui_handoff.py +22 -4
  12. package/skills/yiran-course-template-pipeline/README.md +0 -132
  13. package/skills/yiran-course-template-pipeline/SKILL.md +0 -74
  14. package/skills/yiran-course-template-pipeline/assets/a100-teacher.example.html +0 -66
  15. package/skills/yiran-course-template-pipeline/assets/student-template.html +0 -77
  16. package/skills/yiran-course-template-pipeline/assets/teacher-portrait-demo.html +0 -105
  17. package/skills/yiran-course-template-pipeline/assets/teacher-task-view.html +0 -110
  18. package/skills/yiran-course-template-pipeline/prompts//350/257/204/344/273/267/347/202/271/345/255/220.md +0 -107
  19. package/skills/yiran-course-template-pipeline/prompts//351/230/266/346/256/2651-demo/347/224/237/346/210/220.md +0 -121
  20. package/skills/yiran-course-template-pipeline/prompts//351/230/266/346/256/2652-student/347/224/237/346/210/220.md +0 -115
  21. package/skills/yiran-course-template-pipeline/prompts//351/230/266/346/256/2653-teacher/347/224/237/346/210/220.md +0 -144
  22. package/skills/yiran-course-template-pipeline/prompts//351/230/266/346/256/2654-/346/211/223/345/214/205/350/220/275/347/233/230.md +0 -130
  23. package/skills/yiran-course-template-pipeline/references/student-example.json +0 -38
  24. package/skills/yiran-course-template-pipeline/references/student-fields.md +0 -195
  25. package/skills/yiran-course-template-pipeline/references/student-scaffold.json +0 -34
  26. package/skills/yiran-course-template-pipeline/references/teacher-fields.md +0 -271
  27. package/skills/yiran-course-template-pipeline/references/teacher-scaffold.json +0 -25
  28. package/skills/yiran-course-template-pipeline/scripts/build_template_index.py +0 -150
  29. package/skills/yiran-course-template-pipeline/scripts/build_template_views.py +0 -132
  30. package/skills/yiran-course-template-pipeline/scripts/identify_template.py +0 -174
  31. package/skills/yiran-course-template-pipeline/scripts/migrate_templates.py +0 -104
  32. package/skills/yiran-course-template-pipeline/scripts/move_template_task.py +0 -107
  33. package/skills/yiran-course-template-pipeline/scripts/publish_template.py +0 -131
  34. package/skills/yiran-course-template-pipeline/scripts/release_template.py +0 -84
  35. package/skills/yiran-course-template-pipeline/scripts/render_student_page.py +0 -66
  36. package/skills/yiran-course-template-pipeline/scripts/render_teacher_view.py +0 -108
  37. package/skills/yiran-course-template-pipeline/template-index.json +0 -671
  38. package/skills/yiran-course-template-pipeline/template-index.md +0 -246
  39. package/skills/yiran-course-template-pipeline//344/270/232/345/212/241/350/203/214/346/231/257.md +0 -81
  40. package/skills/yiran-course-template-pipeline//345/272/237/345/274/203/rewrite_html_refs.py +0 -102
@@ -1425,7 +1425,8 @@ class MyclawAPIHandler(BaseHTTPRequestHandler):
1425
1425
  def _handle_template_deploy(self):
1426
1426
  """POST /api/template/deploy Body: {"folder": "a100_...", "agent": "playgrounds"}
1427
1427
  agent 默认 "playgrounds";不传则自动生成唯一名 tpl-MMDDHHMM。
1428
- 流程:mc new {agent}(已存在忽略)→ deploy_to_workspace.py --with-tui
1428
+ 流程:mc new {agent} --no-first-message(已存在忽略)
1429
+ → 复制模板 → 同步发送模板提示词
1429
1430
  """
1430
1431
  try:
1431
1432
  length = int(self.headers.get('Content-Length', 0))
@@ -1448,9 +1449,15 @@ class MyclawAPIHandler(BaseHTTPRequestHandler):
1448
1449
  version_str = os.path.basename(template_path) # template_path 末段就是 v1/v2...
1449
1450
  agent_name = '{}-{}-{}'.format(series_num, version_str, datetime.now().strftime('%H%M'))
1450
1451
 
1451
- # mc new(已存在则忽略错误)
1452
+ # 模板流程不发送生日初始化消息;文件复制完成后再发模板提示词。
1453
+ # 普通的 `mc new <name>` 行为不受影响。
1452
1454
  try:
1453
- ret = subprocess.run(['mc', 'new', agent_name], capture_output=True, text=True, timeout=30)
1455
+ ret = subprocess.run(
1456
+ ['mc', 'new', agent_name, '--no-first-message'],
1457
+ capture_output=True,
1458
+ text=True,
1459
+ timeout=30,
1460
+ )
1454
1461
  output = (ret.stdout or '') + (ret.stderr or '')
1455
1462
  if ret.returncode != 0 and '已存在' not in output and 'exists' not in output.lower():
1456
1463
  self._send_json({'ok': False, 'error': 'mc new 失败: ' + output.strip()}, 500)
@@ -1464,7 +1471,7 @@ class MyclawAPIHandler(BaseHTTPRequestHandler):
1464
1471
 
1465
1472
  data, err = self._run_skill_script(
1466
1473
  [sys.executable, script, template_path, workspace_path, '--with-tui'],
1467
- timeout=60
1474
+ timeout=90
1468
1475
  )
1469
1476
  if err:
1470
1477
  self._send_json({'ok': False, 'error': err}, 500)
@@ -1731,4 +1738,4 @@ if __name__ == "__main__":
1731
1738
  try:
1732
1739
  reconcile_loop()
1733
1740
  except KeyboardInterrupt:
1734
- print("\n[exit] 收到中断,退出")
1741
+ print("\n[exit] 收到中断,退出")
@@ -46,9 +46,9 @@ python3 scripts/run_playgrounds_flow.py <template_path>
46
46
  - 只收 1 个参数:模板路径
47
47
  - 内部自动执行 A + B + C
48
48
  - 固定使用 `playgrounds`
49
- - 自动执行 `mc new playgrounds`
49
+ - 自动准备 `playgrounds` Agent
50
50
  - 自动复制到 `workspace-playgrounds/remix/实例名`
51
- - 自动发起 `mc tui playgrounds`
51
+ - 自动通过 `openclaw agent --session-key ... --json` 发送提示词,并校验发送结果
52
52
 
53
53
  ### 入口 2,指定 workspace 投放
54
54
  ```bash
@@ -58,14 +58,14 @@ python3 scripts/deploy_to_workspace.py <template_path> <workspace_path> --with-t
58
58
 
59
59
  特点:
60
60
  - 只 deploy 时,不进入 tui
61
- - 加 `--with-tui` 时,deploy 后继续发起 tui
61
+ - 加 `--with-tui` 时,deploy 后继续发送模板提示词(参数名为了兼容保留)
62
62
  - 不暴露 `--agent`
63
63
  - 不暴露 `--session`
64
64
  - agent 从 `workspace-xxx` 自动推导
65
65
 
66
66
  ## 统一规则
67
67
 
68
- - `实例名 = 目标文件夹名 = session 名`
68
+ - `实例名 = 目标文件夹名`;session 名在 ASCII 场景下按 OpenClaw 规则转为小写
69
69
  - 实例名在 deploy 阶段生成
70
70
  - 命名规则默认是:`月日_原模板名_时分`
71
71
  - 如果同一分钟同名冲突,会自动加 `_2`、`_3`
@@ -89,6 +89,7 @@ python3 scripts/deploy_to_workspace.py <template_path> <workspace_path> --with-t
89
89
  - `scripts/deploy_to_workspace.py`:对外 workspace 投放脚本
90
90
  - `scripts/run_playgrounds_flow.py`:对外 playgrounds 一条龙脚本
91
91
  - `prompts/remix-handoff.txt`:交接提示词模板
92
+ - `prompts/single-html-handoff.txt`:单 HTML 模板的自动阅读与业务理解提示词
92
93
 
93
94
  ## 索引维护
94
95
 
@@ -0,0 +1,23 @@
1
+ 这是一个刚刚创建的网页模板项目。请先完整阅读当前项目文件,理解页面的业务背景和已有功能,再开始和我对话。
2
+
3
+ 项目文件夹路径:
4
+ {{FOLDER_REL_PATH}}
5
+
6
+ 网页入口文件:
7
+ {{ENTRY_REL_PATH}}
8
+
9
+ ---
10
+
11
+ ## 你的第一步
12
+
13
+ 1. 阅读入口 HTML 的结构、页面文案、样式和 JavaScript 交互。
14
+ 2. 结合页面内容,判断这个网页是做什么的、服务什么场景、用户如何使用。
15
+ 3. 检查 HTML 是否引用了同目录的其他资源;如果资源缺失,请明确指出,但先不要自行补造。
16
+ 4. 暂时不要修改任何文件,也不要直接重写代码,等待我提出具体需求。
17
+
18
+ 阅读完成后,请先简洁告诉我:
19
+
20
+ 1. 你对这个网页业务背景的理解。
21
+ 2. 当前页面已经具备哪些主要功能和交互。
22
+ 3. 当前项目是否存在缺失资源或明显运行风险。
23
+ 4. 你已经准备好,可以根据我的下一条要求继续修改。
@@ -102,6 +102,7 @@ def register_instance_files(workspace: Path, target_dir: Path):
102
102
  _register_file(artifacts_path, workspace_id, rel)
103
103
 
104
104
  PROMPT_TEMPLATE_PATH = Path(__file__).resolve().parent.parent / 'prompts' / 'remix-handoff.txt'
105
+ SIMPLE_HTML_PROMPT_TEMPLATE_PATH = Path(__file__).resolve().parent.parent / 'prompts' / 'single-html-handoff.txt'
105
106
 
106
107
 
107
108
  def fail(payload, code=1):
@@ -129,8 +130,8 @@ def parse_args(argv):
129
130
  return source_dir, workspace, agent, do_tui
130
131
 
131
132
 
132
- def run(cmd):
133
- return subprocess.run(cmd, capture_output=True, text=True)
133
+ def run(cmd, timeout=None):
134
+ return subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
134
135
 
135
136
 
136
137
  def choose_entry_file(target_dir: Path):
@@ -156,10 +157,15 @@ def build_instance_name(source_dir: Path, remix_dir: Path):
156
157
  return candidate
157
158
 
158
159
 
159
- def build_message(folder_rel_path: str, entry_rel_path: str):
160
- if not PROMPT_TEMPLATE_PATH.exists():
161
- fail({'ok': False, 'error': 'prompt_template_not_found', 'path': str(PROMPT_TEMPLATE_PATH)})
162
- prompt_template = PROMPT_TEMPLATE_PATH.read_text(encoding='utf-8')
160
+ def build_message(folder_rel_path: str, entry_rel_path: str, target_dir: Path):
161
+ is_course_package = (
162
+ (target_dir / '__student__.json').is_file()
163
+ and (target_dir / '__teacher__.json').is_file()
164
+ )
165
+ prompt_path = PROMPT_TEMPLATE_PATH if is_course_package else SIMPLE_HTML_PROMPT_TEMPLATE_PATH
166
+ if not prompt_path.exists():
167
+ fail({'ok': False, 'error': 'prompt_template_not_found', 'path': str(prompt_path)})
168
+ prompt_template = prompt_path.read_text(encoding='utf-8')
163
169
  return prompt_template.replace('{{FOLDER_REL_PATH}}', folder_rel_path).replace('{{ENTRY_REL_PATH}}', entry_rel_path)
164
170
 
165
171
 
@@ -190,10 +196,55 @@ def main():
190
196
  if do_tui:
191
197
  if not agent:
192
198
  fail({'ok': False, 'error': 'workspace_agent_not_inferable', 'message': 'workspace 路径必须形如 workspace-xxx,才能启用 --with-tui'})
193
- message = build_message(folder_rel_path, entry_rel_path)
194
- result = run(['mc', 'tui', agent, '--session', instance_name, '--message', message])
199
+ message = build_message(folder_rel_path, entry_rel_path, target_dir)
200
+ # OpenClaw 会将 ASCII session key 标准化为小写;返回同样的值,
201
+ # 避免前端跳转到一个大小写不一致的空会话。
202
+ session_name = instance_name.lower()
203
+ session_key = f'agent:{agent}:{session_name}'
204
+ try:
205
+ result = run([
206
+ 'openclaw', 'agent',
207
+ '--agent', agent,
208
+ '--session-key', session_key,
209
+ '--message', message,
210
+ '--thinking', 'off',
211
+ '--timeout', '60',
212
+ '--json',
213
+ ], timeout=75)
214
+ except subprocess.TimeoutExpired as exc:
215
+ fail({
216
+ 'ok': False,
217
+ 'error': 'template_prompt_timeout',
218
+ 'agent': agent,
219
+ 'session': session_name,
220
+ 'details': str(exc),
221
+ })
195
222
  if result.returncode != 0:
196
- fail({'ok': False, 'error': 'mc_tui_failed', 'agent': agent, 'session': instance_name, 'details': result.stderr or result.stdout})
223
+ fail({
224
+ 'ok': False,
225
+ 'error': 'template_prompt_failed',
226
+ 'agent': agent,
227
+ 'session': session_name,
228
+ 'details': result.stderr or result.stdout,
229
+ })
230
+ try:
231
+ response = json.loads(result.stdout)
232
+ except Exception:
233
+ fail({
234
+ 'ok': False,
235
+ 'error': 'template_prompt_invalid_response',
236
+ 'agent': agent,
237
+ 'session': session_name,
238
+ 'details': result.stdout or result.stderr,
239
+ })
240
+ if not isinstance(response, dict):
241
+ fail({
242
+ 'ok': False,
243
+ 'error': 'template_prompt_invalid_response',
244
+ 'agent': agent,
245
+ 'session': session_name,
246
+ 'details': result.stdout,
247
+ })
197
248
  tui_started = True
198
249
 
199
250
  print(json.dumps({
@@ -206,7 +257,8 @@ def main():
206
257
  'folder_rel_path': folder_rel_path,
207
258
  'entry_rel_path': entry_rel_path,
208
259
  'tui_started': tui_started,
209
- 'session': instance_name,
260
+ 'prompt_sent': tui_started,
261
+ 'session': session_name if do_tui else instance_name,
210
262
  'message': message,
211
263
  }, ensure_ascii=False))
212
264
 
@@ -46,8 +46,8 @@ def parse_args(argv):
46
46
  return agent, folder_rel_path, entry_rel_path, session_name
47
47
 
48
48
 
49
- def run(cmd):
50
- return subprocess.run(cmd, capture_output=True, text=True)
49
+ def run(cmd, timeout=None):
50
+ return subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
51
51
 
52
52
 
53
53
  def main():
@@ -59,9 +59,27 @@ def main():
59
59
  prompt_template = PROMPT_TEMPLATE_PATH.read_text(encoding='utf-8')
60
60
  message = prompt_template.replace('{{FOLDER_REL_PATH}}', folder_rel_path).replace('{{ENTRY_REL_PATH}}', entry_rel_path)
61
61
 
62
- result = run(['mc', 'tui', agent, '--session', session_name, '--message', message])
62
+ session_name = session_name.lower()
63
+ try:
64
+ result = run([
65
+ 'openclaw', 'agent',
66
+ '--agent', agent,
67
+ '--session-key', f'agent:{agent}:{session_name}',
68
+ '--message', message,
69
+ '--thinking', 'off',
70
+ '--timeout', '60',
71
+ '--json',
72
+ ], timeout=75)
73
+ except subprocess.TimeoutExpired as exc:
74
+ fail({'started': False, 'error': 'template_prompt_timeout', 'agent': agent, 'session': session_name, 'details': str(exc)})
63
75
  if result.returncode != 0:
64
- fail({'started': False, 'error': 'mc_tui_failed', 'agent': agent, 'session': session_name, 'details': result.stderr or result.stdout})
76
+ fail({'started': False, 'error': 'template_prompt_failed', 'agent': agent, 'session': session_name, 'details': result.stderr or result.stdout})
77
+ try:
78
+ response = json.loads(result.stdout)
79
+ except Exception:
80
+ fail({'started': False, 'error': 'template_prompt_invalid_response', 'agent': agent, 'session': session_name, 'details': result.stdout or result.stderr})
81
+ if not isinstance(response, dict):
82
+ fail({'started': False, 'error': 'template_prompt_invalid_response', 'agent': agent, 'session': session_name, 'details': result.stdout})
65
83
 
66
84
  print(json.dumps({
67
85
  'started': True,
@@ -1,132 +0,0 @@
1
- # 课程模板流水线 Skill
2
-
3
- 这个 skill 面向中文课堂的小专题课程设计流程。
4
-
5
- 它的目标不是只生成某一个页面,而是把一个“题目灵感 / 设计角度”逐步变成一整套可用的课程任务文件。
6
-
7
- ---
8
-
9
- 业务背景请统一参考:
10
- `业务背景.md`
11
-
12
- ---
13
-
14
- # 当前工作流
15
-
16
- ## 阶段一:灵感 -> demo 页面
17
- 最开始输入的是:
18
- - 题目灵感
19
- - 设计角度
20
- - 课堂上的切入想法
21
-
22
- 这一阶段最重要的事情是:
23
- **先做出 __demo__.html(效果演示页)**
24
-
25
- 阶段一到阶段三的产物,统一放在:
26
- **当前工作目录下新建的 `任务名称/` 文件夹里。**
27
-
28
- 也就是说:
29
- - 不先放到 templates
30
- - 不先放到 skill 目录根部
31
- - 而是在当前工作目录里,先建立一个任务临时文件夹,再往里写 `__demo__.html`、`__student__.json`、`__teacher__.json`
32
-
33
- ---
34
-
35
- ## 阶段二:生成 __student__.json
36
- 这一阶段不要求一定已经有 __teacher__.json。
37
- 这一阶段甚至不要求一定已经有完整作品。
38
-
39
- 这一阶段的核心目标是:
40
- **先把学生任务的步骤和评价结构 JSON 确立下来。**
41
-
42
- 对应输出:
43
- `__student__.json`
44
-
45
- ---
46
-
47
- ## 阶段三:生成 __teacher__.json
48
- 在 __student__.json 已经明确后,再整理教师侧信息。
49
-
50
- 这一阶段的核心目标是:
51
- **明确题目设计目的、训练重点、适合学生类型,以及老师上课时如何判断和引导。**
52
-
53
- 对应输出:
54
- `__teacher__.json`
55
-
56
- ---
57
-
58
- ## 阶段四:JSON -> HTML,并按目录打包
59
- 第4阶段现在拆成两个脚本:
60
-
61
- ### 1)build_template_views.py
62
- 校验通过后,在原文件夹中直接生成:
63
- - `__student-view__.html`
64
- - `__teacher-view__.html`
65
- - `index.html`
66
-
67
- 其中 `index.html` 采用固定脚本规则:
68
- - 只展示两块内容
69
- - 左边是“评价目标”
70
- - 右边是“步骤”
71
- - 不显示任务标题
72
- - 不显示一句话说明
73
- - 不再依赖临时提示词拼装
74
- - 统一由脚本直接根据 `__student__.json` 渲染
75
-
76
- ### 2)move_template_task.py
77
- 在页面已经生成好的前提下,把整个文件夹移动到:
78
- `yiran-playground-template-use` skill 的 `templates/`
79
-
80
- 同时按规则改名,例如:
81
- `a100_给依然老师设计一个AI画像`
82
-
83
- 并且:
84
- **move 成功后会自动触发 `yiran-playground-template-use` 的索引重建。**
85
-
86
- ---
87
-
88
- # 当前目录结构
89
-
90
- - `SKILL.md`:技能总说明
91
- - `prompts/阶段1-demo生成.md`:如何把灵感先做成 demo 页面
92
- - `prompts/阶段2-student生成.md`:如何生成 __student__.json
93
- - `prompts/阶段3-teacher生成.md`:如何生成 __teacher__.json
94
- - `prompts/阶段4-打包落盘.md`:如何组织文件并调用第4阶段脚本
95
- - `scripts/render_teacher_view.py`:把 __teacher__.json 渲染成教师查看页
96
- - `scripts/render_student_page.py`:把 __student__.json 渲染成学生页
97
- - `scripts/build_template_views.py`:在原目录生成 __student-view__.html 和 __teacher-view__.html
98
- - `scripts/move_template_task.py`:移动整个任务文件夹到 templates 并改名,同时自动重建索引
99
- - `references/teacher-fields.md`:教师侧字段设计与标签规则说明
100
- - `references/student-fields.md`:学生侧字段说明
101
- - `references/student-example.json`:学生侧 JSON 示例
102
- - `references/student-scaffold.json`:学生侧 JSON 脚手架
103
- - `references/teacher-scaffold.json`:教师侧 JSON 脚手架
104
- - `assets/student-template.html`:独立学生页模板
105
- - 模板库和搜索索引统一维护在 `yiran-playground-template-use` skill 中
106
-
107
- ---
108
-
109
- # 模板索引
110
-
111
- 模板库和索引统一维护在 `yiran-playground-template-use` skill 中。
112
-
113
- `move_template_task.py` 成功执行后会自动触发索引重建。如需手动重建,在 `yiran-playground-template-use` skill 中运行:
114
-
115
- ```bash
116
- python3 scripts/build_template_index.py
117
- ```
118
-
119
- ---
120
-
121
- # 核心原则
122
-
123
- 1. 先有灵感,再做 demo,再定 __student__.json,再定 __teacher__.json
124
- 2. 阶段一到三的产物,统一放在当前工作目录下新建的任务文件夹里
125
- 3. __student__.json 先解决学生任务结构
126
- 4. __teacher__.json 再解决题目设计目的与教师判断
127
- 5. 第4阶段拆成 build 和 move 两个独立脚本
128
- 6. templates 作为 skill 的资产目录统一维护
129
- 7. 模板有变化后,要重新构建索引
130
- 8. demo 中的媒体资源优先使用 CDN 链接,不使用本地相对路径;当前固定前缀为 `https://cdn.yiranlaoshi.com/yiran/workspace-ai-demo`,后面拼接资源相对路径
131
- 9. 模板负责布局,提示词负责填内容,脚本负责稳定输出
132
- 10. 所有内容优先服务中文课堂和小学生阅读场景
@@ -1,74 +0,0 @@
1
- ---
2
- name: yiran-course-template-pipeline
3
- description: 面向中文课堂的小专题课程模板流水线。适用于把一个题目灵感或设计角度,先生成 demo 页面,再先后整理成 __student__.json 和 __teacher__.json,最后通过脚本生成页面、整理目录、沉淀模板资产并构建模板索引。
4
- ---
5
-
6
- # 课程模板流水线
7
-
8
- 这个 skill 支持的是一条完整工作流,而不是单点产出。
9
-
10
-
11
- ## 四阶段流程
12
-
13
- ### 1)灵感 -> demo 页面
14
- 当用户先给出题目灵感、设计角度或课堂切入点时,优先生成 demo 页面。
15
-
16
- 这一阶段优先使用:
17
- - `prompts/阶段1-demo生成.md`
18
-
19
- ### 2)生成 __student__.json
20
- 这个阶段最重要的目标是:
21
- 先把学生任务的步骤和评价结构 JSON 确立下来。
22
-
23
- 这一阶段优先使用:
24
- - `prompts/阶段2-student生成.md`
25
- - `references/student-fields.md`
26
- - `references/student-example.json`
27
- - `references/student-scaffold.json`
28
-
29
- ### 3)生成 __teacher__.json
30
- 在 __student__.json 已经明确后,再整理教师侧信息。
31
-
32
- 这一阶段优先使用:
33
- - `prompts/阶段3-teacher生成.md`
34
- - `references/teacher-fields.md`
35
- - `references/teacher-scaffold.json`
36
-
37
- ### 阶段一到三的工作目录规则
38
- 阶段一到阶段三产出的文件,统一放在:
39
- **当前工作目录下新建的 `任务名称/` 文件夹里。**
40
-
41
- 也就是说,这几个中间产物先写在当前工作目录的任务文件夹内:
42
- - `__demo__.html`
43
- - `__student__.json`
44
- - `__teacher__.json`
45
-
46
- ### 4)JSON -> HTML,并按目录打包
47
- 第4阶段拆成三个独立脚本:
48
- - `scripts/build_template_views.py`
49
- - `scripts/move_template_task.py`
50
- - `scripts/publish_template.py`
51
-
52
- 其中:
53
- - build 负责在原目录生成 `__student-view__.html`、`__teacher-view__.html` 和 `index.html`
54
- - `index.html` 采用固定脚本规则:左边展示”评价目标”,右边展示”步骤”,不显示任务标题和一句话说明
55
- - move 负责把任务文件夹移动到 `yiran-playground-template-use` skill 的 `templates/`,并自动触发索引重建
56
- - publish 负责把模板文件夹内所有资源上传到七牛 CDN,并重写 HTML 中的资源引用为 CDN 绝对地址(见 `cdn-convention.md`)
57
-
58
- **推荐发布入口(内容确认后):**
59
- ```bash
60
- python3 scripts/release_template.py <模板目录>
61
- ```
62
- `release_template.py` 自动依次执行 build → move → publish,对新目录和已入库的 vN/ 目录均适用。
63
-
64
- ## 原则
65
-
66
- - 先做 demo
67
- - 再定 __student__.json
68
- - 再定 __teacher__.json
69
- - 阶段一到三先在当前工作目录的任务文件夹里完成
70
- - publish 脚本把模板文件夹内所有文件上传到 CDN,CDN 路径规则见 `prompts/阶段4-打包落盘.md`
71
- - 第4阶段拆成 build、move、publish 三个独立脚本
72
- - templates 作为 skill 的资产目录统一维护
73
- - 模板有变化后,要重新构建索引
74
- - 全部内容优先中文
@@ -1,66 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="zh-CN">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>A100 · 给依然老师设计一个AI画像</title>
7
- <style>
8
- * { box-sizing: border-box; }
9
- body { margin: 0; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; background: #f4f7fb; color: #24324a; }
10
- .page { max-width: 1200px; margin: 0 auto; padding: 20px; }
11
- .hero { background: linear-gradient(135deg,#5f82ff 0%,#8c74ff 100%); color: #fff; border-radius: 24px; padding: 22px 24px; box-shadow: 0 16px 36px rgba(92,108,192,.22); }
12
- .hero h1 { margin: 0; font-size: 28px; }
13
- .hero p { margin: 8px 0 0; opacity: .92; font-size: 14px; }
14
- .view { margin-top: 18px; display: grid; gap: 16px; }
15
- .top { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
16
- .card { background: #fff; border: 1px solid #e7eefc; border-radius: 20px; padding: 18px; box-shadow: 0 10px 24px rgba(100,122,166,.08); }
17
- .card h2 { margin: 0 0 12px; font-size: 18px; color: #314a96; }
18
- .meta-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
19
- .meta-item { background: #f8faff; border: 1px solid #e7eefc; border-radius: 14px; padding: 12px; }
20
- .meta-item .label { font-size: 12px; color: #7a89ad; margin-bottom: 6px; }
21
- .meta-item .value { font-size: 14px; color: #24324a; font-weight: 700; }
22
- .tags { display: flex; flex-wrap: wrap; gap: 8px; }
23
- .tag { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px; background: #edf2ff; color: #4c65c3; font-size: 13px; font-weight: 700; }
24
- .section-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
25
- .list { display: grid; gap: 10px; }
26
- .list-item { background: #f8faff; border: 1px solid #e7eefc; border-radius: 14px; padding: 12px; line-height: 1.7; font-size: 14px; color: #60708b; }
27
- .issue { border-left: 4px solid #8c74ff; background: #faf8ff; }
28
- .issue strong { color: #314a96; display: block; margin: 6px 0; }
29
- @media (max-width: 900px) { .top, .section-grid, .meta-grid { grid-template-columns: 1fr; } }
30
- </style>
31
- </head>
32
- <body>
33
- <div class="page">
34
- <section class="hero">
35
- <h1>A100 · 给依然老师设计一个AI画像</h1>
36
- <p>这是根据教师 JSON 自动生成的可视化查看页,方便老师快速扫读与判断。</p>
37
- </section>
38
-
39
- <section class="view">
40
- <div class="top">
41
- <div class="card">
42
- <h2>基础信息</h2>
43
- <div class="meta-grid">
44
- <div class="meta-item"><div class="label">主能力标签</div><div class="value">表达构建</div></div>
45
- <div class="meta-item"><div class="label">任务类型标签</div><div class="value">视听表达</div></div>
46
- </div>
47
- </div>
48
- <div class="card">
49
- <h2>适合学生类型</h2>
50
- <div class="tags"><span class="tag">初次接触</span><span class="tag">需要明确目标</span><span class="tag">持续迭代</span></div>
51
- </div>
52
- </div>
53
-
54
- <div class="section-grid">
55
- <div class="card"><h2>训练重点</h2><div class="list"><div class="list-item">围绕明确对象生成形象</div><div class="list-item">把人物图片放进网页中完成展示</div><div class="list-item">通过小幅修改让作品逐步变好</div></div></div>
56
- <div class="card"><h2>可拓展方向</h2><div class="list"><div class="list-item">给画像加背景音乐</div><div class="list-item">加入点击切换不同版本画像</div><div class="list-item">给人物加一句语音介绍</div></div></div>
57
- </div>
58
-
59
- <div class="section-grid">
60
- <div class="card"><h2>卡点和解决方案</h2><div class="list"><div class="list-item issue"><strong>卡点</strong>学生不知道要画谁,描述很泛<strong>解决方案</strong>先让学生说清楚对象是谁,再从发型、衣服、表情这些具体点开始描述</div><div class="list-item issue"><strong>卡点</strong>学生一次改太多,看不出变化<strong>解决方案</strong>提醒学生每次只改一个地方,比如先改头发,再改表情</div></div></div>
61
- <div class="card"><h2>课后作业</h2><div class="list"><div class="list-item">回家把老师画像再优化一版,至少改一个地方,并说明你改了什么</div><div class="list-item">给网页再加入一张新版本图片,展示前后变化</div></div></div>
62
- </div>
63
- </section>
64
- </div>
65
- </body>
66
- </html>
@@ -1,77 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="zh-CN">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>{{任务标题}}</title>
7
- <style>
8
- * { box-sizing: border-box; }
9
- body { margin: 0; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; background: #f4f7fb; color: #24324a; }
10
- .page { max-width: 1440px; margin: 0 auto; padding: 20px 20px 48px; }
11
- .header-bar { background: linear-gradient(135deg,#5f82ff 0%,#8c74ff 100%); border-radius: 24px; padding: 20px 24px; box-shadow: 0 16px 36px rgba(92,108,192,.24); }
12
- .header-left h1 { margin: 0; font-size: 26px; line-height: 1.3; color: #fff; font-weight: 800; }
13
- .header-left .subtitle { margin: 8px 0 0; font-size: 13px; line-height: 1.8; color: rgba(255,255,255,.88); }
14
- .main-section { margin-top: 18px; }
15
- .block { background: #fff; border-radius: 24px; padding: 22px; box-shadow: 0 10px 28px rgba(100,122,166,.12); }
16
- .content-layout { display: grid; grid-template-columns: 220px minmax(0,1fr) 220px; gap: 14px; align-items: stretch; }
17
- .task-panel, .goal-panel { background: #f8faff; border: 1px solid #e7eefc; border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
18
- .panel-group h3 { margin: 0 0 10px; color: #334d98; font-size: 17px; }
19
- .task-item { margin-bottom: 10px; }
20
- .task-item:last-child { margin-bottom: 0; }
21
- .item-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: #7a89ad; }
22
- .item-body { background: #fff; border: 1px solid #e7eefc; border-radius: 12px; padding: 10px 12px; font-size: 13px; color: #60708b; line-height: 1.7; }
23
- .task-item .num { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: #edf2ff; color: #7a89ad; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
24
- .star-item .num { background: #fff7dc; color: #b89a4f; }
25
- .sample-frame-wrap { background: #f8faff; border: 1px solid #e7eefc; border-radius: 20px; padding: 14px; min-width: 0; }
26
- .sample-frame-head { display: flex; justify-content: flex-start; align-items: center; gap: 10px; margin-bottom: 12px; }
27
- .sample-frame-head h3 { margin: 0; color: #334d98; font-size: 17px; }
28
- .tips-block { margin-top: 16px; background: #fff; border-radius: 24px; padding: 22px; box-shadow: 0 10px 28px rgba(100,122,166,.12); }
29
- .tips-block h3 { margin: 0 0 14px; color: #334d98; font-size: 18px; }
30
- .tips-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
31
- .tip-item { background: #f8faff; border: 1px solid #e7eefc; border-radius: 16px; padding: 14px; }
32
- .tip-title { font-size: 14px; font-weight: 700; color: #334d98; margin-bottom: 8px; }
33
- .tip-desc { font-size: 13px; color: #60708b; line-height: 1.7; margin-bottom: 8px; }
34
- .tip-prompt { font-size: 12px; color: #4f5f7c; line-height: 1.8; background: #fff; border: 1px dashed #d6e2ff; border-radius: 12px; padding: 10px 12px; }
35
- iframe { width: 100%; height: 560px; border: 1px solid #dfe7fb; border-radius: 16px; background: #fff; display: block; }
36
- @media (max-width: 960px) { .page { padding: 14px 12px 32px; } .header-bar { padding: 16px 18px; } .header-left h1 { font-size: 22px; } .header-left .subtitle { font-size: 12px; } .content-layout { grid-template-columns: 1fr; } .task-panel, .goal-panel, .sample-frame-wrap, .tips-block { padding: 14px; } .tips-list { grid-template-columns: 1fr; } iframe { height: 360px; } }
37
- </style>
38
- </head>
39
- <body>
40
- <div class="page">
41
- <header class="header-bar">
42
- <div class="header-left">
43
- <h1>{{任务标题}}</h1>
44
- <p class="subtitle">{{一句话说明}}</p>
45
- </div>
46
- </header>
47
- <div class="main-section">
48
- <section class="block">
49
- <div class="content-layout">
50
- <div class="task-panel">
51
- <div class="panel-group">
52
- <h3>步骤</h3>
53
- {{步骤区域}}
54
- </div>
55
- </div>
56
- <div class="sample-frame-wrap">
57
- <div class="sample-frame-head"><h3>{{示例区标题}}</h3></div>
58
- <iframe src="{{示例页面文件}}" title="{{示例区标题}}"></iframe>
59
- </div>
60
- <div class="goal-panel">
61
- <div class="panel-group">
62
- <h3>评价目标</h3>
63
- {{评价目标区域}}
64
- </div>
65
- </div>
66
- </div>
67
- </section>
68
- <section class="tips-block">
69
- <h3>小提示</h3>
70
- <div class="tips-list">
71
- {{小提示区域}}
72
- </div>
73
- </section>
74
- </div>
75
- </div>
76
- </body>
77
- </html>