@aiyiran/myclaw 1.1.173 → 1.1.175
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-artifacts.js +18 -0
- package/create_agent.js +1 -6
- package/package.json +1 -1
|
@@ -757,6 +757,24 @@
|
|
|
757
757
|
var OFFICE_EXTS = ['ppt', 'pptx', 'doc', 'docx', 'xls', 'xlsx'];
|
|
758
758
|
var isOffice = OFFICE_EXTS.indexOf(assetExt) !== -1;
|
|
759
759
|
|
|
760
|
+
// 压缩包 / 二进制:无法预览,直接下载真实文件(带正确文件名,避免下成无扩展名的 "file")。
|
|
761
|
+
// 本地走同源 /api/file,靠 a[download] 强制文件名;远程走 CDN,URL 末段已是真实文件名。
|
|
762
|
+
var DOWNLOAD_EXTS = ['zip', 'rar', '7z', 'tar', 'gz', 'tgz', 'bz2', 'xz', 'apk', 'exe', 'dmg', 'bin', 'iso'];
|
|
763
|
+
if (DOWNLOAD_EXTS.indexOf(assetExt) !== -1) {
|
|
764
|
+
var fileName = asset.name || (asset.path || '').split('/').pop() || 'download';
|
|
765
|
+
var dlUrl = isRemote()
|
|
766
|
+
? previewUrl
|
|
767
|
+
: MYCLAW_API_BASE + '/api/file?path=' + encodeURIComponent(getWorkspaceId() + '/' + asset.path) + '&t=' + Date.now();
|
|
768
|
+
var dlLink = document.createElement('a');
|
|
769
|
+
dlLink.href = dlUrl;
|
|
770
|
+
dlLink.download = fileName;
|
|
771
|
+
dlLink.style.display = 'none';
|
|
772
|
+
document.body.appendChild(dlLink);
|
|
773
|
+
dlLink.click();
|
|
774
|
+
setTimeout(function () { document.body.removeChild(dlLink); }, 0);
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
|
|
760
778
|
if (isImageAsset(asset)) {
|
|
761
779
|
// ── 图片模式:先显示固定大小的容器,img 异步加载渐显 ──
|
|
762
780
|
var imgBox = document.createElement('div');
|
package/create_agent.js
CHANGED
|
@@ -97,13 +97,8 @@ const FALLBACK_WORDS = [
|
|
|
97
97
|
function pad2(n) { return String(n).padStart(2, '0'); }
|
|
98
98
|
|
|
99
99
|
function generateFallbackKey() {
|
|
100
|
-
// 北京时间(UTC+8),与 buildBirthMessage 保持一致
|
|
101
|
-
const bj = new Date(Date.now() + 8 * 60 * 60 * 1000);
|
|
102
|
-
const MMDD = pad2(bj.getUTCMonth() + 1) + pad2(bj.getUTCDate());
|
|
103
|
-
const MMSS = pad2(bj.getUTCMinutes()) + pad2(bj.getUTCSeconds());
|
|
104
100
|
const pick = () => FALLBACK_WORDS[Math.floor(Math.random() * FALLBACK_WORDS.length)];
|
|
105
|
-
|
|
106
|
-
return MMDD + '_' + words + '_' + MMSS;
|
|
101
|
+
return pick() + '-' + pick() + '-' + pick();
|
|
107
102
|
}
|
|
108
103
|
|
|
109
104
|
// ── 命名决策:判断输入是否「天生满足」key 格式 ───────────────────
|