@zhongqian97-code/ecode 0.5.63 → 0.5.65
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/index.js
CHANGED
|
@@ -802,7 +802,7 @@ if (rawArgs[0] === "web") {
|
|
|
802
802
|
webAutoApprove = true;
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
const { buildServer, generateAccessToken } = await import("./web-
|
|
805
|
+
const { buildServer, generateAccessToken } = await import("./web-6WYKHML6.js");
|
|
806
806
|
const token = finalConfig.webToken ?? generateAccessToken();
|
|
807
807
|
const manager = new SessionManager(finalConfig);
|
|
808
808
|
const __webDirname = dirname(fileURLToPath(import.meta.url));
|
|
@@ -56,7 +56,10 @@ function generateAdminHtml(version) {
|
|
|
56
56
|
font-family: "Courier New", Courier, monospace;
|
|
57
57
|
background: #0d1117;
|
|
58
58
|
color: #c9d1d9;
|
|
59
|
-
|
|
59
|
+
/* zoom \u653E\u5927\u6574\u4F53 UI\uFF1Bcalc \u8865\u507F\u8BA9\u89C6\u53E3\u9501\u5B9A\uFF0C\u907F\u514D 100vh \u88AB\u653E\u5927\u540E\u6EA2\u51FA */
|
|
60
|
+
zoom: var(--zoom, 1);
|
|
61
|
+
width: calc(100vw / var(--zoom, 1));
|
|
62
|
+
height: calc(100vh / var(--zoom, 1));
|
|
60
63
|
display: flex;
|
|
61
64
|
flex-direction: column;
|
|
62
65
|
overflow: hidden;
|
|
@@ -510,6 +513,8 @@ function generateAdminHtml(version) {
|
|
|
510
513
|
<h1>\u26A1 ecode web admin</h1>
|
|
511
514
|
<span class="version">v${version}</span>
|
|
512
515
|
<span id="topbar-model" class="version" style="display:none"></span>
|
|
516
|
+
<button id="zoom-out-btn" class="btn" title="\u7F29\u5C0F (Ctrl/Cmd -)" aria-label="\u7F29\u5C0F\u5B57\u4F53">A\u2212</button>
|
|
517
|
+
<button id="zoom-in-btn" class="btn" title="\u653E\u5927 (Ctrl/Cmd +)" aria-label="\u653E\u5927\u5B57\u4F53">A+</button>
|
|
513
518
|
<button id="config-btn" class="btn">\u914D\u7F6E</button>
|
|
514
519
|
<button id="upgrade-btn" class="btn">\u5347\u7EA7</button>
|
|
515
520
|
<button id="toggle-tools-btn" class="btn">\u5DE5\u5177 \u25BE</button>
|
|
@@ -607,6 +612,7 @@ function generateAdminHtml(version) {
|
|
|
607
612
|
showTools: true,
|
|
608
613
|
skills: [], // cached skills from /api/skills
|
|
609
614
|
skillsLoaded: false,
|
|
615
|
+
zoom: 1, // \u5168\u5C40 UI \u7F29\u653E\u7CFB\u6570
|
|
610
616
|
};
|
|
611
617
|
|
|
612
618
|
// \u2500\u2500 Toast \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
@@ -820,10 +826,18 @@ function generateAdminHtml(version) {
|
|
|
820
826
|
const lines = text.split('\\n').filter(l => l.trim());
|
|
821
827
|
const msgsEl = document.getElementById('messages');
|
|
822
828
|
msgsEl.innerHTML = '';
|
|
829
|
+
const toolNames = {};
|
|
823
830
|
for (const line of lines) {
|
|
824
831
|
try {
|
|
825
832
|
const m = JSON.parse(line);
|
|
826
|
-
if (m.
|
|
833
|
+
if (Array.isArray(m.tool_calls)) {
|
|
834
|
+
for (const tc of m.tool_calls) {
|
|
835
|
+
if (tc && tc.id && tc.function) toolNames[tc.id] = tc.function.name;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
if (m.role === 'tool') {
|
|
839
|
+
appendToolBox(toolNames[m.tool_call_id] || 'tool', m.content || '');
|
|
840
|
+
} else if (typeof m.content === 'string' && m.content) {
|
|
827
841
|
appendMessage(m.role === 'user' ? 'user' : 'assistant', renderMarkdown(m.content));
|
|
828
842
|
}
|
|
829
843
|
} catch { /* skip malformed lines */ }
|
|
@@ -836,6 +850,24 @@ function generateAdminHtml(version) {
|
|
|
836
850
|
}
|
|
837
851
|
}
|
|
838
852
|
|
|
853
|
+
// \u5386\u53F2\u56DE\u653E: \u628A\u5DE5\u5177\u8C03\u7528\u6E32\u67D3\u4E3A\u53EF\u6298\u53E0 tool-box\uFF08\u4E0E\u5B9E\u65F6\u6D41\u5F0F\u4E00\u81F4\uFF0C\u9ED8\u8BA4\u6298\u53E0\uFF09
|
|
854
|
+
function appendToolBox(name, output) {
|
|
855
|
+
const msgsEl = document.getElementById('messages');
|
|
856
|
+
const placeholder = msgsEl.querySelector('.empty-chat');
|
|
857
|
+
if (placeholder) placeholder.remove();
|
|
858
|
+
const boxEl = document.createElement('div');
|
|
859
|
+
boxEl.className = 'tool-box collapsed';
|
|
860
|
+
boxEl.innerHTML =
|
|
861
|
+
'<div class="tool-box-header" onclick="toggleToolBox(this)">' +
|
|
862
|
+
'<span class="tb-indicator">\u25B6</span>' +
|
|
863
|
+
'<span class="tb-name">\u2713 ' + escHtml(name) + '</span>' +
|
|
864
|
+
'</div>' +
|
|
865
|
+
'<div class="tool-box-body"></div>';
|
|
866
|
+
boxEl.querySelector('.tool-box-body').textContent = output;
|
|
867
|
+
if (!state.showTools) boxEl.style.display = 'none';
|
|
868
|
+
msgsEl.appendChild(boxEl);
|
|
869
|
+
}
|
|
870
|
+
|
|
839
871
|
function appendMessage(role, htmlContent, opts) {
|
|
840
872
|
const msgsEl = document.getElementById('messages');
|
|
841
873
|
// Remove empty-chat placeholder
|
|
@@ -1391,6 +1423,32 @@ function generateAdminHtml(version) {
|
|
|
1391
1423
|
}
|
|
1392
1424
|
}
|
|
1393
1425
|
|
|
1426
|
+
// \u2500\u2500 \u5168\u5C40 UI \u7F29\u653E \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1427
|
+
function clampZoom(z) {
|
|
1428
|
+
z = Math.round(z * 10) / 10;
|
|
1429
|
+
if (!(z > 0)) z = 1;
|
|
1430
|
+
return Math.min(2, Math.max(0.6, z));
|
|
1431
|
+
}
|
|
1432
|
+
function applyZoom(z) {
|
|
1433
|
+
state.zoom = clampZoom(z);
|
|
1434
|
+
document.documentElement.style.setProperty('--zoom', state.zoom);
|
|
1435
|
+
try { localStorage.setItem('ecode-zoom', String(state.zoom)); } catch {}
|
|
1436
|
+
}
|
|
1437
|
+
function initZoom() {
|
|
1438
|
+
let z = 1;
|
|
1439
|
+
try { z = parseFloat(localStorage.getItem('ecode-zoom')) || 1; } catch {}
|
|
1440
|
+
applyZoom(z);
|
|
1441
|
+
}
|
|
1442
|
+
document.getElementById('zoom-in-btn').addEventListener('click', () => applyZoom(state.zoom + 0.1));
|
|
1443
|
+
document.getElementById('zoom-out-btn').addEventListener('click', () => applyZoom(state.zoom - 0.1));
|
|
1444
|
+
document.addEventListener('keydown', function(e) {
|
|
1445
|
+
if (!(e.ctrlKey || e.metaKey)) return;
|
|
1446
|
+
if (e.key === '=' || e.key === '+') { e.preventDefault(); applyZoom(state.zoom + 0.1); }
|
|
1447
|
+
else if (e.key === '-' || e.key === '_') { e.preventDefault(); applyZoom(state.zoom - 0.1); }
|
|
1448
|
+
else if (e.key === '0') { e.preventDefault(); applyZoom(1); }
|
|
1449
|
+
});
|
|
1450
|
+
|
|
1451
|
+
initZoom();
|
|
1394
1452
|
loadSessions();
|
|
1395
1453
|
initModel();
|
|
1396
1454
|
</script>
|