@aiyiran/myclaw 1.1.75 → 1.1.76
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.
package/assets/myclaw-inject.js
CHANGED
|
@@ -1380,8 +1380,24 @@ btn.addEventListener("click", function () {
|
|
|
1380
1380
|
var form = document.createElement("div");
|
|
1381
1381
|
form.style.cssText = "padding: 16px 20px;display:flex;flex-direction:column;gap:10px;color:#cdd6f4;font-family:monospace;font-size:13px;";
|
|
1382
1382
|
|
|
1383
|
+
// 从 URL 解析当前页面的伙伴名
|
|
1384
|
+
function getCurrentAgentName() {
|
|
1385
|
+
var params = new URLSearchParams(window.location.search);
|
|
1386
|
+
var session = params.get('session');
|
|
1387
|
+
if (session) {
|
|
1388
|
+
var decoded = decodeURIComponent(session);
|
|
1389
|
+
if (decoded.indexOf('agent:') === 0) {
|
|
1390
|
+
var parts = decoded.split(':');
|
|
1391
|
+
if (parts.length >= 2) return parts[1];
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
var agent = params.get('agent');
|
|
1395
|
+
if (agent) return agent;
|
|
1396
|
+
return '';
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1383
1399
|
// 弹出 input 小弹框
|
|
1384
|
-
function promptAndRun(title, placeholder, hint, cmdTemplate, btnColor) {
|
|
1400
|
+
function promptAndRun(title, placeholder, hint, cmdTemplate, btnColor, defaultValue) {
|
|
1385
1401
|
var mask = document.createElement("div");
|
|
1386
1402
|
mask.style.cssText = [
|
|
1387
1403
|
"position:fixed",
|
|
@@ -1427,6 +1443,7 @@ btn.addEventListener("click", function () {
|
|
|
1427
1443
|
var input = document.createElement("input");
|
|
1428
1444
|
input.type = "text";
|
|
1429
1445
|
input.placeholder = placeholder;
|
|
1446
|
+
input.value = defaultValue || '';
|
|
1430
1447
|
input.style.cssText = "padding:8px 10px;background:#252536;border:1px solid #3d3d5c;border-radius:4px;color:#cdd6f4;font-size:13px;font-family:monospace;outline:none;";
|
|
1431
1448
|
input.onfocus = function () { input.style.borderColor = btnColor; };
|
|
1432
1449
|
input.onblur = function () { input.style.borderColor = "#3d3d5c"; };
|
|
@@ -1472,7 +1489,7 @@ btn.addEventListener("click", function () {
|
|
|
1472
1489
|
// ── 按钮列表 ──
|
|
1473
1490
|
var btns = [
|
|
1474
1491
|
{ label: "\uD83E\uDD1D \u65B0\u4F19\u4F34", desc: "\u521B\u5EFA\u4E00\u4E2A\u65B0\u7684 AI \u4F19\u4F34", hasInput: true, inputTitle: "\u65B0\u5EFA\u4F19\u4F34", placeholder: "\u8F93\u5165\u65B0\u4F19\u4F34\u540D\u79F0\uFF0C\u5982 my-cat", hint: "\u7ED9\u4F60\u7684\u65B0 AI \u4F19\u4F34\u8D77\u4E2A\u540D\u5B57\uFF08\u82F1\u6587\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u8FDE\u5B57\u7B26\uFF09\uFF0C\u70B9\u51FB\u540E\u4F1A\u81EA\u52A8\u521B\u5EFA", cmd: "mc new {name}", color: "#3b82f6" },
|
|
1475
|
-
{ label: "\uD83D\uDCAC \u6DFB\u52A0\u5BF9\u8BDD", desc: "\u6253\u5F00\u5DF2\u6709\u4F19\u4F34\u7684\u5BF9\u8BDD\u7A97\u53E3", hasInput: true, inputTitle: "\u6DFB\u52A0\u5BF9\u8BDD", placeholder: "\u8F93\u5165\u4F19\u4F34\u540D\u79F0\uFF0C\u5982 kakaxi", hint: "\u8F93\u5165\u4F60\u7684\u4F19\u4F34\u7684\u540D\u79F0\uFF08\u82F1\u6587\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u8FDE\u5B57\u7B26\uFF09\uFF0C\u70B9\u51FB\u540E\u4F1A\u6253\u5F00\u5BF9\u8BDD\u7A97\u53E3", cmd: "mc tui {name}", color: "#10b981" },
|
|
1492
|
+
{ label: "\uD83D\uDCAC \u6DFB\u52A0\u5BF9\u8BDD", desc: "\u6253\u5F00\u5DF2\u6709\u4F19\u4F34\u7684\u5BF9\u8BDD\u7A97\u53E3", hasInput: true, inputTitle: "\u6DFB\u52A0\u5BF9\u8BDD", placeholder: "\u8F93\u5165\u4F19\u4F34\u540D\u79F0\uFF0C\u5982 kakaxi", hint: "\u8F93\u5165\u4F60\u7684\u4F19\u4F34\u7684\u540D\u79F0\uFF08\u82F1\u6587\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u8FDE\u5B57\u7B26\uFF09\uFF0C\u70B9\u51FB\u540E\u4F1A\u6253\u5F00\u5BF9\u8BDD\u7A97\u53E3", cmd: "mc tui {name}", color: "#10b981", getDefault: getCurrentAgentName },
|
|
1476
1493
|
{ label: "\uD83D\uDD04 \u91CD\u542F\u670D\u52A1", desc: "\u91CD\u542F\u6587\u4EF6\u670D\u52A1", hasInput: false, cmd: "mc server", color: "#ef4444" },
|
|
1477
1494
|
{ label: "\uD83E\uDD9E \u91CD\u542F\u9F99\u867E", desc: "\u91CD\u542F OpenClaw \u6838\u5FC3\u670D\u52A1", hasInput: false, cmd: "mc all", color: "#f59e0b" },
|
|
1478
1495
|
];
|
|
@@ -1520,7 +1537,7 @@ btn.addEventListener("click", function () {
|
|
|
1520
1537
|
|
|
1521
1538
|
row.onclick = function () {
|
|
1522
1539
|
if (item.hasInput) {
|
|
1523
|
-
promptAndRun(item.inputTitle, item.placeholder, item.hint, item.cmd, item.color);
|
|
1540
|
+
promptAndRun(item.inputTitle, item.placeholder, item.hint, item.cmd, item.color, item.getDefault ? item.getDefault() : '');
|
|
1524
1541
|
} else {
|
|
1525
1542
|
runCommand(item.cmd);
|
|
1526
1543
|
}
|
package/package.json
CHANGED
|
@@ -49,6 +49,13 @@ INDEX_TEMPLATE = """\
|
|
|
49
49
|
</style>
|
|
50
50
|
</head>
|
|
51
51
|
<body>
|
|
52
|
+
<!--
|
|
53
|
+
[AI 编辑说明]
|
|
54
|
+
这是学生作品的主文件。当你开始编辑时:
|
|
55
|
+
1. 先删除 <body> 内所有现有内容(包括本注释)
|
|
56
|
+
2. 根据参考材料(__demo__.html 等 __XXX__ 文件)重新制作学生作品
|
|
57
|
+
__XXX__ 文件只读,不要修改。
|
|
58
|
+
-->
|
|
52
59
|
<div class="grid">
|
|
53
60
|
<section>
|
|
54
61
|
<h2>评价目标</h2>
|
|
@@ -69,7 +69,7 @@ python3 scripts/deploy_to_workspace.py <template_path> <workspace_path> --with-t
|
|
|
69
69
|
- 实例名在 deploy 阶段生成
|
|
70
70
|
- 命名规则默认是:`月日_原模板名_时分`
|
|
71
71
|
- 如果同一分钟同名冲突,会自动加 `_2`、`_3`
|
|
72
|
-
-
|
|
72
|
+
- 学生作品主文件是 `index.html`,`__XXX__` 文件(`__demo__.html` 等)为只读参考,不修改
|
|
73
73
|
|
|
74
74
|
## 内部脚本分层
|
|
75
75
|
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
下面是这次要开始制作的作品材料,请先按路径查看相关文件,然后直接开始修改 index.html。
|
|
2
2
|
|
|
3
3
|
老师给到的作品文件夹路径:
|
|
4
4
|
{{FOLDER_REL_PATH}}
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
学生作品主文件路径:
|
|
7
7
|
{{ENTRY_REL_PATH}}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
## 文件职责说明
|
|
10
|
+
|
|
11
|
+
文件夹里的 __XXX__ 文件(如 __demo__.html、__student-view__.html、__teacher-view__.html 等)是只读参考材料,不要修改它们。
|
|
12
|
+
- __demo__.html:老师做的示范作品,供参考
|
|
13
|
+
- __student-view__.html:学生任务说明页,供参考
|
|
14
|
+
|
|
15
|
+
index.html 是学生发布作品的主文件,所有修改只在这里进行。
|
|
16
|
+
|
|
17
|
+
## 立即行动
|
|
18
|
+
|
|
19
|
+
1. 先阅读 __XXX__ 文件,了解任务背景和示范内容
|
|
20
|
+
2. 打开 index.html,按照里面的说明开始制作学生作品
|