@wendongfly/myhi 1.3.106 → 1.3.107
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 +28 -5
- package/dist/index.js +1 -1
- package/dist/index.min.js +88 -88
- package/package.json +1 -1
package/dist/chat.html
CHANGED
|
@@ -3534,22 +3534,40 @@
|
|
|
3534
3534
|
});
|
|
3535
3535
|
|
|
3536
3536
|
// ── Claude 记忆查看 ──────────────────────────────
|
|
3537
|
-
|
|
3537
|
+
let _memScope = 'project'; // 默认只看本项目
|
|
3538
|
+
window.showMemory = async function(scope) {
|
|
3539
|
+
if (scope) _memScope = scope;
|
|
3538
3540
|
const container = document.getElementById('memory-content');
|
|
3539
3541
|
container.innerHTML = '<div style="text-align:center;color:var(--muted);padding:2rem 0">加载中...</div>';
|
|
3540
3542
|
document.getElementById('memory-sheet').classList.add('open');
|
|
3541
3543
|
|
|
3544
|
+
const segBtn = (val, label) =>
|
|
3545
|
+
`<button onclick="showMemory('${val}')" style="flex:1;padding:0.4rem;border-radius:7px;cursor:pointer;font-size:0.76rem;` +
|
|
3546
|
+
`border:1px solid ${_memScope===val?'var(--purple)':'var(--border)'};` +
|
|
3547
|
+
`background:${_memScope===val?'var(--purple)':'var(--bg)'};color:${_memScope===val?'#fff':'var(--muted)'}">${label}</button>`;
|
|
3548
|
+
const makeBar = () => {
|
|
3549
|
+
const bar = document.createElement('div');
|
|
3550
|
+
bar.style.cssText = 'display:flex;gap:0.4rem;margin-bottom:0.55rem';
|
|
3551
|
+
bar.innerHTML = segBtn('project', '本项目') + segBtn('all', '全部(含全局/其它项目)');
|
|
3552
|
+
return bar;
|
|
3553
|
+
};
|
|
3554
|
+
|
|
3542
3555
|
try {
|
|
3543
|
-
const resp = await fetch(`/api/memory?sessionId=${SESSION_ID}`);
|
|
3556
|
+
const resp = await fetch(`/api/memory?sessionId=${SESSION_ID}&scope=${_memScope}`);
|
|
3544
3557
|
const data = await resp.json();
|
|
3545
3558
|
const files = data.files || [];
|
|
3546
3559
|
|
|
3560
|
+
container.innerHTML = '';
|
|
3561
|
+
container.appendChild(makeBar());
|
|
3562
|
+
|
|
3547
3563
|
if (files.length === 0) {
|
|
3548
|
-
|
|
3564
|
+
const e = document.createElement('div');
|
|
3565
|
+
e.style.cssText = 'text-align:center;color:var(--muted);padding:1.5rem 0';
|
|
3566
|
+
e.textContent = _memScope === 'project' ? '本项目暂无记忆文件' : '暂无记忆文件';
|
|
3567
|
+
container.appendChild(e);
|
|
3549
3568
|
return;
|
|
3550
3569
|
}
|
|
3551
3570
|
|
|
3552
|
-
container.innerHTML = '';
|
|
3553
3571
|
for (const f of files) {
|
|
3554
3572
|
const card = document.createElement('div');
|
|
3555
3573
|
card.className = 'mem-file';
|
|
@@ -3565,7 +3583,12 @@
|
|
|
3565
3583
|
container.appendChild(card);
|
|
3566
3584
|
}
|
|
3567
3585
|
} catch (e) {
|
|
3568
|
-
container.innerHTML =
|
|
3586
|
+
container.innerHTML = '';
|
|
3587
|
+
container.appendChild(makeBar());
|
|
3588
|
+
const err = document.createElement('div');
|
|
3589
|
+
err.style.cssText = 'text-align:center;color:var(--red);padding:1.5rem 0';
|
|
3590
|
+
err.textContent = '加载失败: ' + e.message;
|
|
3591
|
+
container.appendChild(err);
|
|
3569
3592
|
}
|
|
3570
3593
|
};
|
|
3571
3594
|
|