@wendongfly/myhi 1.0.106 → 1.0.108
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 +17 -33
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/chat.html
CHANGED
|
@@ -283,8 +283,8 @@
|
|
|
283
283
|
</div>
|
|
284
284
|
<div id="sk-claude-agent" style="display:none">
|
|
285
285
|
<button class="sk sk-claude" onclick="openModelSheet()">模型</button>
|
|
286
|
-
<button class="sk sk-claude" onclick="
|
|
287
|
-
<button class="sk sk-claude" onclick="
|
|
286
|
+
<button class="sk sk-claude" onclick="doSlashCmd('/plan')">计划</button>
|
|
287
|
+
<button class="sk sk-claude" onclick="doSlashCmd('/compact')">压缩</button>
|
|
288
288
|
<button class="sk sk-claude" onclick="openResumeSheet()">恢复</button>
|
|
289
289
|
<button class="sk sk-claude" onclick="doClear()">清除</button>
|
|
290
290
|
<button class="sk sk-claude" onclick="doRename()">命名</button>
|
|
@@ -1236,17 +1236,6 @@
|
|
|
1236
1236
|
const text = cmdInput.value.trim();
|
|
1237
1237
|
if (!text && !_pendingImage) return;
|
|
1238
1238
|
|
|
1239
|
-
// 命名模式:发送的是新会话名称
|
|
1240
|
-
if (window._renameMode) {
|
|
1241
|
-
const { prev } = window._renameMode;
|
|
1242
|
-
window._renameMode = null;
|
|
1243
|
-
cmdInput.value = '';
|
|
1244
|
-
cmdInput.style.height = 'auto';
|
|
1245
|
-
cmdInput.placeholder = currentSession?.mode === 'agent' ? '输入消息...' : '输入命令...';
|
|
1246
|
-
socket.emit('rename', { sessionId: SESSION_ID, title: text });
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
1239
|
if (!isController) {
|
|
1251
1240
|
if (canTakeControl()) { socket.emit('take-control', { sessionId: SESSION_ID }); }
|
|
1252
1241
|
else { addStatusMessage('其他用户控制中,无法发送'); return; }
|
|
@@ -1280,19 +1269,9 @@
|
|
|
1280
1269
|
cmdInput.focus();
|
|
1281
1270
|
}
|
|
1282
1271
|
|
|
1283
|
-
function cancelRenameMode() {
|
|
1284
|
-
if (!window._renameMode) return;
|
|
1285
|
-
const { prev } = window._renameMode;
|
|
1286
|
-
window._renameMode = null;
|
|
1287
|
-
cmdInput.value = prev || '';
|
|
1288
|
-
cmdInput.style.height = 'auto';
|
|
1289
|
-
cmdInput.placeholder = currentSession?.mode === 'agent' ? '输入消息...' : '输入命令...';
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
1272
|
cmdInput.addEventListener('keydown', (e) => {
|
|
1293
1273
|
if (e.key === 'Escape') {
|
|
1294
1274
|
e.preventDefault();
|
|
1295
|
-
if (window._renameMode) { cancelRenameMode(); return; }
|
|
1296
1275
|
if (currentSession?.mode === 'agent' && workState !== 'idle') {
|
|
1297
1276
|
socket.emit('agent:interrupt', { sessionId: SESSION_ID });
|
|
1298
1277
|
return;
|
|
@@ -1303,8 +1282,6 @@
|
|
|
1303
1282
|
else if (e.key === 'ArrowUp' && !cmdInput.value) { if (historyIdx < cmdHistory.length - 1) { historyIdx++; cmdInput.value = cmdHistory[historyIdx]; } e.preventDefault(); }
|
|
1304
1283
|
else if (e.key === 'ArrowDown' && !cmdInput.value) { if (historyIdx > 0) { historyIdx--; cmdInput.value = cmdHistory[historyIdx]; } else if (historyIdx === 0) { historyIdx = -1; cmdInput.value = ''; } e.preventDefault(); }
|
|
1305
1284
|
});
|
|
1306
|
-
// blur 时不立即取消命名模式,等 500ms(给发送按钮点击时间)
|
|
1307
|
-
cmdInput.addEventListener('blur', () => { setTimeout(() => cancelRenameMode(), 500); });
|
|
1308
1285
|
|
|
1309
1286
|
// ── 快捷键 ──────────────────────────────────
|
|
1310
1287
|
const SEQ = { 'ctrl-c': '\x03', 'ctrl-d': '\x04', 'tab': '\t', 'up': '\x1b[A', 'down': '\x1b[B', 'right': '\x1b[C', 'left': '\x1b[D', 'esc': '\x1b', 'ctrl-a': '\x01', 'ctrl-e': '\x05', 'ctrl-k': '\x0b', 'ctrl-u': '\x15', 'ctrl-r': '\x12', 'alt-.': '\x1b.' };
|
|
@@ -1493,16 +1470,23 @@
|
|
|
1493
1470
|
};
|
|
1494
1471
|
|
|
1495
1472
|
// ── 会话命名 ──────────────────────────────────
|
|
1473
|
+
window.doSlashCmd = function(cmd) {
|
|
1474
|
+
const hints = { '/plan': '输入计划描述(可选)', '/compact': '输入压缩提示(可选)' };
|
|
1475
|
+
const input = prompt(hints[cmd] || cmd);
|
|
1476
|
+
if (input === null) return; // 取消
|
|
1477
|
+
const prompt_text = input.trim() ? `${cmd} ${input.trim()}` : cmd;
|
|
1478
|
+
if (!isController && canTakeControl()) socket.emit('take-control', { sessionId: SESSION_ID });
|
|
1479
|
+
socket.emit('agent:query', { prompt: prompt_text });
|
|
1480
|
+
addInputMessage(prompt_text);
|
|
1481
|
+
showThinking();
|
|
1482
|
+
};
|
|
1483
|
+
|
|
1496
1484
|
window.doRename = function() {
|
|
1497
1485
|
const current = document.getElementById('session-title').textContent;
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
cmdInput.focus();
|
|
1503
|
-
cmdInput.select();
|
|
1504
|
-
// 临时劫持发送行为
|
|
1505
|
-
window._renameMode = { prev };
|
|
1486
|
+
const newName = prompt('输入新名称', current);
|
|
1487
|
+
if (newName && newName.trim() && newName.trim() !== current) {
|
|
1488
|
+
socket.emit('rename', { sessionId: SESSION_ID, title: newName.trim() });
|
|
1489
|
+
}
|
|
1506
1490
|
};
|
|
1507
1491
|
socket.on('session-renamed', ({ sessionId, title }) => {
|
|
1508
1492
|
if (sessionId !== SESSION_ID) return;
|
package/dist/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"1.0.
|
|
1
|
+
{"type":"module","version":"1.0.108"}
|
package/package.json
CHANGED