@wendongfly/myhi 1.3.148 → 1.3.150
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 +63 -6
- package/package.json +1 -1
package/dist/chat.html
CHANGED
|
@@ -192,6 +192,11 @@
|
|
|
192
192
|
.msg-history .code-block { background: var(--bg); border: 1px solid var(--surface2); border-radius: 8px; padding: 0.6rem 0.75rem; font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.75rem; line-height: 1.3; white-space: pre-wrap; word-break: break-all; color: var(--muted); max-height: 300px; overflow-y: auto; }
|
|
193
193
|
.msg-history .meta { font-size: 0.65rem; color: var(--dimmer); margin-bottom: 4px; }
|
|
194
194
|
.msg-status { text-align: center; font-size: 0.75rem; color: var(--muted); padding: 0.5rem 0; }
|
|
195
|
+
/* claude CLI 注入的合成 user 消息(上下文压缩续接摘要)—— 系统面板,不长成用户发言 */
|
|
196
|
+
.msg-synthetic { margin: 0.4rem 0; }
|
|
197
|
+
.msg-synthetic .syn-head { text-align: center; font-size: 0.75rem; color: var(--muted); cursor: pointer; user-select: none; padding: 0.35rem 0; }
|
|
198
|
+
.msg-synthetic .syn-head:hover { color: var(--text); }
|
|
199
|
+
.msg-synthetic .syn-body { white-space: pre-wrap; font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace; font-size: 0.75rem; line-height: 1.5; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem; max-height: 320px; overflow-y: auto; word-break: break-word; }
|
|
195
200
|
|
|
196
201
|
/* ── 输入栏 ─────────────────────────────── */
|
|
197
202
|
#input-area { background: var(--surface); border-top: 1px solid var(--border); flex-shrink: 0; padding: 0.5rem 0.75rem 0.35rem; }
|
|
@@ -495,7 +500,6 @@
|
|
|
495
500
|
<button class="sk sk-claude" onclick="openFollowUpSheet()" style="color:var(--blue2)">🔄 跟进</button>
|
|
496
501
|
<button class="sk sk-claude" onclick="openGitSheet()" style="color:var(--green)">提交</button>
|
|
497
502
|
<button class="sk sk-claude" onclick="showMemory()">记忆</button>
|
|
498
|
-
<button class="sk sk-claude" onclick="openVaSheet()" style="color:var(--blue2)">语音</button>
|
|
499
503
|
<button class="sk sk-claude" onclick="openSkillSheet()" style="color:var(--purple2)">技能</button>
|
|
500
504
|
<span id="sk-builtin-skills"></span>
|
|
501
505
|
<span id="sk-custom-skills"></span>
|
|
@@ -1503,6 +1507,49 @@
|
|
|
1503
1507
|
scrollToBottom();
|
|
1504
1508
|
}
|
|
1505
1509
|
|
|
1510
|
+
// claude CLI 自己注入的「合成 user 消息」——不是真人打的字:
|
|
1511
|
+
// ① 上下文满时 claude 自动压缩续接,往 transcript 写一大段 "This session is being
|
|
1512
|
+
// continued..." 英文摘要(isCompactSummary);重启/重进回放时若照用户气泡渲染,
|
|
1513
|
+
// 看起来就像有人在你会话里打字(实际反馈过)。
|
|
1514
|
+
// ② [Request interrupted by user]:点停止按钮产生的中断标记,同理不是发言。
|
|
1515
|
+
// 分别渲染成折叠摘要面板 / 状态行。
|
|
1516
|
+
function syntheticUserKind(text) {
|
|
1517
|
+
if (typeof text !== 'string') return null;
|
|
1518
|
+
const t = text.trimStart();
|
|
1519
|
+
if (t.startsWith('This session is being continued from a previous conversation')) return 'compact';
|
|
1520
|
+
if (t.startsWith('[Request interrupted by user')) return 'interrupt'; // 含 "...for tool use" 变体
|
|
1521
|
+
return null;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
function buildSyntheticUserEl(content) {
|
|
1525
|
+
const el = document.createElement('div');
|
|
1526
|
+
if (syntheticUserKind(content) === 'interrupt') {
|
|
1527
|
+
el.className = 'msg msg-status';
|
|
1528
|
+
el.textContent = '— ⏹ 请求已中断 —';
|
|
1529
|
+
return el;
|
|
1530
|
+
}
|
|
1531
|
+
el.className = 'msg msg-synthetic';
|
|
1532
|
+
const head = document.createElement('div');
|
|
1533
|
+
head.className = 'syn-head';
|
|
1534
|
+
const body = document.createElement('div');
|
|
1535
|
+
body.className = 'syn-body';
|
|
1536
|
+
body.style.display = 'none';
|
|
1537
|
+
body.textContent = content; // 摘要可能带任意字符,textContent 防注入
|
|
1538
|
+
const sync = () => {
|
|
1539
|
+
head.textContent = body.style.display !== 'none'
|
|
1540
|
+
? '🔄 上下文已满,claude 已自动压缩续接(点此收起摘要)'
|
|
1541
|
+
: '🔄 上下文已满,claude 已自动压缩续接(点此展开摘要)';
|
|
1542
|
+
};
|
|
1543
|
+
head.onclick = () => {
|
|
1544
|
+
body.style.display = body.style.display !== 'none' ? 'none' : 'block';
|
|
1545
|
+
sync();
|
|
1546
|
+
};
|
|
1547
|
+
sync();
|
|
1548
|
+
el.appendChild(head);
|
|
1549
|
+
el.appendChild(body);
|
|
1550
|
+
return el;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1506
1553
|
// 连续重复的同一条状态不再一行行堆,折叠成「— xxx — ×N」。
|
|
1507
1554
|
// 任何会反复触发的状态(自动重启、上传失败、控制权变更…)都不会再刷屏。
|
|
1508
1555
|
function addStatusMessage(text) {
|
|
@@ -2329,7 +2376,13 @@
|
|
|
2329
2376
|
endStream(); // 每条历史消息都是独立的,不要流式合并
|
|
2330
2377
|
if (subaRoute(msg)) continue; // 子代理内部历史消息归入对应面板
|
|
2331
2378
|
if (msg.type === 'user' && msg.content) {
|
|
2332
|
-
|
|
2379
|
+
// claude 注入的合成消息(压缩续接摘要/中断标记)渲染成系统面板,不长成用户发言
|
|
2380
|
+
if (syntheticUserKind(msg.content)) {
|
|
2381
|
+
chatArea.appendChild(buildSyntheticUserEl(msg.content));
|
|
2382
|
+
trimMessages(); scrollToBottom();
|
|
2383
|
+
} else {
|
|
2384
|
+
addInputMessage(msg.content);
|
|
2385
|
+
}
|
|
2333
2386
|
} else if (msg.type === 'assistant' && msg.message?.content) {
|
|
2334
2387
|
// 将同一条 assistant 消息的所有 text block 合并为一条
|
|
2335
2388
|
const texts = [];
|
|
@@ -2411,10 +2464,14 @@
|
|
|
2411
2464
|
const frag = document.createDocumentFragment();
|
|
2412
2465
|
for (const msg of d.messages) {
|
|
2413
2466
|
if (msg.type === 'user' && msg.content) {
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2467
|
+
if (syntheticUserKind(msg.content)) {
|
|
2468
|
+
frag.appendChild(buildSyntheticUserEl(msg.content));
|
|
2469
|
+
} else {
|
|
2470
|
+
const el = document.createElement('div');
|
|
2471
|
+
el.className = 'msg msg-input';
|
|
2472
|
+
el.innerHTML = `<div><div class="bubble">${escHtml(msg.content)}</div><div class="meta">${msg.timestamp ? new Date(msg.timestamp).toLocaleString('zh-CN') : ''}</div></div>`;
|
|
2473
|
+
frag.appendChild(el);
|
|
2474
|
+
}
|
|
2418
2475
|
} else if (msg.type === 'assistant' && msg.message?.content) {
|
|
2419
2476
|
const texts = [], tools = [];
|
|
2420
2477
|
for (const block of msg.message.content) {
|
package/package.json
CHANGED