@aiyiran/myclaw 1.1.35 → 1.1.37
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/package.json
CHANGED
|
@@ -21,12 +21,17 @@
|
|
|
21
21
|
{
|
|
22
22
|
"name": "yiran-playground-template-use",
|
|
23
23
|
"strategy": "on",
|
|
24
|
+
"ignore": [
|
|
25
|
+
"templates"
|
|
26
|
+
],
|
|
24
27
|
"description": "AI Playground 课程模板库(存储、搜索、deploy 一条龙)"
|
|
25
28
|
},
|
|
26
29
|
{
|
|
27
30
|
"name": "yiran-course-template-pipeline",
|
|
28
31
|
"strategy": "delete",
|
|
29
|
-
"ignore": [
|
|
32
|
+
"ignore": [
|
|
33
|
+
"templates"
|
|
34
|
+
],
|
|
30
35
|
"description": "课程模板制作流水线(demo -> student/teacher JSON -> HTML 打包)"
|
|
31
36
|
}
|
|
32
37
|
],
|
package/server/sync_workspace.py
CHANGED
|
@@ -1151,11 +1151,10 @@ class MyclawAPIHandler(BaseHTTPRequestHandler):
|
|
|
1151
1151
|
for series, nums in cdn_templates.items():
|
|
1152
1152
|
for num, record in nums.items():
|
|
1153
1153
|
folder_name = record.get('文件夹名', '')
|
|
1154
|
-
files = record.get('files', [])
|
|
1155
1154
|
cdn_ua = record.get('updated_at', '')
|
|
1156
1155
|
local_ua = local_templates.get(series, {}).get(num, {}).get('updated_at', '')
|
|
1157
1156
|
|
|
1158
|
-
if not folder_name
|
|
1157
|
+
if not folder_name:
|
|
1159
1158
|
continue
|
|
1160
1159
|
|
|
1161
1160
|
is_new = series not in local_templates or num not in local_templates.get(series, {})
|
|
@@ -1164,18 +1163,18 @@ class MyclawAPIHandler(BaseHTTPRequestHandler):
|
|
|
1164
1163
|
if not is_new and not is_changed:
|
|
1165
1164
|
continue
|
|
1166
1165
|
|
|
1167
|
-
#
|
|
1166
|
+
# 从七牛列举该文件夹下所有文件,全量下载
|
|
1167
|
+
cdn_prefix = 'myclaw/live/yiran/skills/yiran-playground-template-use/templates/{}/'.format(folder_name)
|
|
1168
1168
|
folder_dir = os.path.join(local_templates_dir, folder_name)
|
|
1169
1169
|
os.makedirs(folder_dir, exist_ok=True)
|
|
1170
|
-
|
|
1171
|
-
|
|
1170
|
+
cdn_files = _list_files_from_qiniu(cdn_prefix)
|
|
1171
|
+
for item in cdn_files:
|
|
1172
|
+
key = item.get('key', '')
|
|
1173
|
+
filename = key[len(cdn_prefix):]
|
|
1174
|
+
if not filename:
|
|
1175
|
+
continue
|
|
1172
1176
|
dest = os.path.join(folder_dir, filename)
|
|
1173
|
-
|
|
1174
|
-
with urllib.request.urlopen(url, timeout=15) as r:
|
|
1175
|
-
with open(dest, 'wb') as out:
|
|
1176
|
-
out.write(r.read())
|
|
1177
|
-
except Exception as e:
|
|
1178
|
-
print('[sync-templates] 下载失败 {}: {}'.format(url, e))
|
|
1177
|
+
_download_from_cdn(key, dest)
|
|
1179
1178
|
|
|
1180
1179
|
if is_new:
|
|
1181
1180
|
added.append(folder_name)
|
|
@@ -64,8 +64,7 @@ def main():
|
|
|
64
64
|
|
|
65
65
|
entry = get_entry_file(folder)
|
|
66
66
|
|
|
67
|
-
#
|
|
68
|
-
files = sorted(f.name for f in folder.iterdir() if f.is_file())
|
|
67
|
+
# 文件夹最新 mtime 作为变更标记
|
|
69
68
|
folder_mtime = max((f.stat().st_mtime for f in folder.iterdir() if f.is_file()), default=0)
|
|
70
69
|
updated_at = datetime.fromtimestamp(folder_mtime, tz=timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
|
|
71
70
|
|
|
@@ -82,7 +81,6 @@ def main():
|
|
|
82
81
|
'主能力标签': 能力标签,
|
|
83
82
|
'任务类型标签': 类型标签,
|
|
84
83
|
'关键词': keywords,
|
|
85
|
-
'files': files,
|
|
86
84
|
'updated_at': updated_at,
|
|
87
85
|
}
|
|
88
86
|
|