@wendongfly/myhi 1.3.16 → 1.3.18
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/dist/chat.html +56 -12
- package/dist/index.js +1 -1
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
package/dist/chat.html
CHANGED
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
<span class="sb-item" id="work-status"><span class="sb-dot idle"></span> 空闲</span>
|
|
273
273
|
<span id="control-badge" class="readonly" style="display:none">只读</span>
|
|
274
274
|
<span id="viewer-count" class="sb-item"></span>
|
|
275
|
-
<span id="update-badge" style="display:none;color:#d29922;cursor:pointer" onclick="
|
|
275
|
+
<span id="update-badge" style="display:none;color:#d29922;cursor:pointer" onclick="doUpdate()">⬆ 有更新</span>
|
|
276
276
|
</div>
|
|
277
277
|
|
|
278
278
|
<div id="chat-area"></div>
|
|
@@ -482,14 +482,17 @@
|
|
|
482
482
|
<!-- Git 安装视图 -->
|
|
483
483
|
<div id="skill-import-view" style="display:none;flex:1;overflow-y:auto;scrollbar-width:thin;padding:0.3rem 0.2rem">
|
|
484
484
|
<div style="display:flex;flex-direction:column;gap:0.4rem">
|
|
485
|
-
<
|
|
485
|
+
<div style="display:flex;gap:0.4rem">
|
|
486
|
+
<input id="skill-git-url" class="slash-inp" placeholder="Git 仓库地址 (https:// 或 git@...)" autocomplete="off" style="flex:1">
|
|
487
|
+
<button onclick="scanGitSkills()" style="background:#7c3aed;color:#fff;border:none;border-radius:8px;padding:0.5rem 0.8rem;font-size:0.82rem;cursor:pointer;white-space:nowrap">扫描</button>
|
|
488
|
+
</div>
|
|
486
489
|
<select id="skill-import-scope" class="slash-inp" style="background:#0d1117;color:#c9d1d9;border:1px solid #30363d;border-radius:8px;padding:0.5rem;font-size:0.82rem">
|
|
487
490
|
<option value="user">安装到用户级 (~/.claude/commands/)</option>
|
|
488
491
|
<option value="project">安装到项目级 (.claude/commands/)</option>
|
|
489
492
|
</select>
|
|
490
493
|
</div>
|
|
491
494
|
<div id="skill-import-preview" style="display:none;margin-top:0.5rem;padding:0.5rem;background:#0d1117;border:1px solid #30363d;border-radius:8px;font-size:0.78rem;max-height:30vh;overflow-y:auto;scrollbar-width:thin"></div>
|
|
492
|
-
<
|
|
495
|
+
<div id="skill-import-scan-btn"></div>
|
|
493
496
|
<button id="skill-import-install-btn" class="action-sheet-cancel" style="display:none;background:#3fb950;color:#000;font-weight:600;margin-bottom:0.4rem" onclick="installGitSkills()">安装选中的技能</button>
|
|
494
497
|
<button class="action-sheet-cancel" onclick="backToSkillList()">返回列表</button>
|
|
495
498
|
</div>
|
|
@@ -2115,17 +2118,23 @@
|
|
|
2115
2118
|
document.getElementById('skill-sheet-title').textContent = '从 Git 安装技能';
|
|
2116
2119
|
document.getElementById('skill-import-preview').style.display = 'none';
|
|
2117
2120
|
document.getElementById('skill-import-install-btn').style.display = 'none';
|
|
2118
|
-
document.getElementById('skill-import-scan-btn').
|
|
2121
|
+
document.getElementById('skill-import-scan-btn').innerHTML = '';
|
|
2119
2122
|
document.getElementById('skill-git-url').value = '';
|
|
2120
2123
|
_gitSkills = [];
|
|
2124
|
+
setTimeout(() => document.getElementById('skill-git-url').focus(), 100);
|
|
2121
2125
|
};
|
|
2122
2126
|
|
|
2127
|
+
document.getElementById('skill-git-url')?.addEventListener('keydown', (e) => {
|
|
2128
|
+
if (e.key === 'Enter') { e.preventDefault(); scanGitSkills(); }
|
|
2129
|
+
});
|
|
2130
|
+
|
|
2123
2131
|
window.scanGitSkills = async function() {
|
|
2124
2132
|
const url = document.getElementById('skill-git-url').value.trim();
|
|
2125
2133
|
if (!url) { addStatusMessage('请输入 Git 仓库地址'); return; }
|
|
2126
|
-
const
|
|
2127
|
-
|
|
2128
|
-
|
|
2134
|
+
const statusEl = document.getElementById('skill-import-scan-btn');
|
|
2135
|
+
statusEl.innerHTML = '<div style="text-align:center;color:#8b949e;padding:0.5rem 0">正在克隆并扫描...</div>';
|
|
2136
|
+
document.getElementById('skill-import-preview').style.display = 'none';
|
|
2137
|
+
document.getElementById('skill-import-install-btn').style.display = 'none';
|
|
2129
2138
|
try {
|
|
2130
2139
|
const resp = await fetch('/api/skills/scan-git', {
|
|
2131
2140
|
method: 'POST',
|
|
@@ -2133,6 +2142,7 @@
|
|
|
2133
2142
|
body: JSON.stringify({ url }),
|
|
2134
2143
|
});
|
|
2135
2144
|
const data = await resp.json();
|
|
2145
|
+
statusEl.innerHTML = '';
|
|
2136
2146
|
if (data.error) { addStatusMessage(data.error); return; }
|
|
2137
2147
|
_gitSkills = data.skills || [];
|
|
2138
2148
|
if (!_gitSkills.length) {
|
|
@@ -2153,9 +2163,7 @@
|
|
|
2153
2163
|
document.getElementById('skill-import-install-btn').style.display = '';
|
|
2154
2164
|
} catch (e) {
|
|
2155
2165
|
addStatusMessage('扫描失败: ' + e.message);
|
|
2156
|
-
|
|
2157
|
-
btn.textContent = '扫描技能';
|
|
2158
|
-
btn.disabled = false;
|
|
2166
|
+
statusEl.innerHTML = '';
|
|
2159
2167
|
}
|
|
2160
2168
|
};
|
|
2161
2169
|
|
|
@@ -2517,15 +2525,51 @@
|
|
|
2517
2525
|
cmdInput.focus();
|
|
2518
2526
|
|
|
2519
2527
|
// ── 版本更新检查 ──────────────────────────────
|
|
2528
|
+
let _versionInfo = null;
|
|
2520
2529
|
(async function checkUpdate() {
|
|
2521
2530
|
try {
|
|
2522
2531
|
const resp = await fetch('/api/version');
|
|
2523
2532
|
if (!resp.ok) return;
|
|
2524
|
-
|
|
2525
|
-
|
|
2533
|
+
_versionInfo = await resp.json();
|
|
2534
|
+
const badge = document.getElementById('update-badge');
|
|
2535
|
+
if (_versionInfo.updateAvailable) {
|
|
2536
|
+
badge.textContent = `⬆ ${_versionInfo.latest}`;
|
|
2537
|
+
badge.style.display = '';
|
|
2538
|
+
} else {
|
|
2539
|
+
badge.style.display = 'none';
|
|
2540
|
+
}
|
|
2526
2541
|
} catch {}
|
|
2527
2542
|
setTimeout(checkUpdate, 10 * 60 * 1000);
|
|
2528
2543
|
})();
|
|
2544
|
+
|
|
2545
|
+
window.doUpdate = async function() {
|
|
2546
|
+
if (!_versionInfo?.updateAvailable) return;
|
|
2547
|
+
if (!confirm(`更新 myhi?\n当前: ${_versionInfo.current}\n最新: ${_versionInfo.latest}\n\n更新后服务将自动重启`)) return;
|
|
2548
|
+
const badge = document.getElementById('update-badge');
|
|
2549
|
+
badge.textContent = '⬆ 更新中...';
|
|
2550
|
+
badge.style.color = '#8b949e';
|
|
2551
|
+
try {
|
|
2552
|
+
const resp = await fetch('/api/update', { method: 'POST' });
|
|
2553
|
+
const data = await resp.json();
|
|
2554
|
+
addStatusMessage(data.message || '升级中...');
|
|
2555
|
+
badge.textContent = '⬆ 重启中...';
|
|
2556
|
+
// 等待服务重启后自动刷新
|
|
2557
|
+
setTimeout(() => {
|
|
2558
|
+
let retries = 0;
|
|
2559
|
+
const poll = setInterval(async () => {
|
|
2560
|
+
try {
|
|
2561
|
+
const r = await fetch('/api/version');
|
|
2562
|
+
if (r.ok) { clearInterval(poll); location.reload(); }
|
|
2563
|
+
} catch {}
|
|
2564
|
+
if (++retries > 30) { clearInterval(poll); badge.textContent = '⬆ 请手动刷新'; badge.style.color = '#f85149'; }
|
|
2565
|
+
}, 3000);
|
|
2566
|
+
}, 5000);
|
|
2567
|
+
} catch (e) {
|
|
2568
|
+
addStatusMessage('更新失败: ' + e.message);
|
|
2569
|
+
badge.textContent = `⬆ ${_versionInfo.latest}`;
|
|
2570
|
+
badge.style.color = '#d29922';
|
|
2571
|
+
}
|
|
2572
|
+
};
|
|
2529
2573
|
</script>
|
|
2530
2574
|
</body>
|
|
2531
2575
|
</html>
|