myagent-ai 1.12.3 → 1.12.4
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/package.json
CHANGED
package/web/ui/chat/chat.css
CHANGED
|
@@ -2152,6 +2152,15 @@ input,textarea,select{font:inherit}
|
|
|
2152
2152
|
white-space: pre-wrap;
|
|
2153
2153
|
}
|
|
2154
2154
|
|
|
2155
|
+
/* ══════════════════════════════════════════════════════
|
|
2156
|
+
── Popout Mode (独立窗口) ──
|
|
2157
|
+
══════════════════════════════════════════════════════ */
|
|
2158
|
+
body.popout-mode .main{margin-left:0 !important;border-left:none !important}
|
|
2159
|
+
body.popout-mode .agent-panel{display:none !important}
|
|
2160
|
+
body.popout-mode .main-header{padding-left:12px}
|
|
2161
|
+
body.popout-mode #popoutBtn{display:none !important}
|
|
2162
|
+
body.popout-mode #debugToggleBtn{display:none !important}
|
|
2163
|
+
|
|
2155
2164
|
/* ══════════════════════════════════════════════════════
|
|
2156
2165
|
── Mobile Responsive (≤768px) ──
|
|
2157
2166
|
══════════════════════════════════════════════════════ */
|
package/web/ui/chat/chat_main.js
CHANGED
|
@@ -96,6 +96,9 @@ document.addEventListener('click', function(e) {
|
|
|
96
96
|
function checkChatMobile() {
|
|
97
97
|
const btn = document.getElementById('mobileAgentsBtn');
|
|
98
98
|
if (btn) btn.style.display = isMobile() ? 'grid' : 'none';
|
|
99
|
+
// Hide popout button on mobile
|
|
100
|
+
const popoutBtn = document.getElementById('popoutBtn');
|
|
101
|
+
if (popoutBtn) popoutBtn.style.display = isMobile() ? 'none' : 'grid';
|
|
99
102
|
}
|
|
100
103
|
window.addEventListener('resize', checkChatMobile);
|
|
101
104
|
// Run after DOM ready
|
|
@@ -105,6 +108,25 @@ if (document.readyState === 'loading') {
|
|
|
105
108
|
checkChatMobile();
|
|
106
109
|
}
|
|
107
110
|
|
|
111
|
+
// ── Popout Chat Window (Desktop only) ──
|
|
112
|
+
function popoutChat() {
|
|
113
|
+
if (isMobile()) return;
|
|
114
|
+
// Build URL with current agent + session + mode, plus popout flag
|
|
115
|
+
const baseUrl = new URL('.', window.location.href).href + 'chat/chat_container.html';
|
|
116
|
+
const params = new URLSearchParams();
|
|
117
|
+
if (state.activeAgent) params.set('agent', state.activeAgent);
|
|
118
|
+
if (state.activeSessionId && state.activeSessionId !== '__new__') params.set('session', state.activeSessionId);
|
|
119
|
+
if (state.chatMode) params.set('mode', state.chatMode);
|
|
120
|
+
params.set('popout', '1');
|
|
121
|
+
const popoutUrl = baseUrl + '?' + params.toString();
|
|
122
|
+
// Open as a standalone window
|
|
123
|
+
const w = Math.min(900, screen.width - 100);
|
|
124
|
+
const h = Math.min(720, screen.height - 100);
|
|
125
|
+
const left = Math.round((screen.width - w) / 2);
|
|
126
|
+
const top = Math.round((screen.height - h) / 2);
|
|
127
|
+
window.open(popoutUrl, 'myagent_popout_' + (state.activeAgent || 'default'), 'width=' + w + ',height=' + h + ',left=' + left + ',top=' + top + ',menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes');
|
|
128
|
+
}
|
|
129
|
+
|
|
108
130
|
// Override toggleAgentPanel for mobile (deferred since function is defined later)
|
|
109
131
|
var _origToggleAgentPanel = null;
|
|
110
132
|
(function() {
|
|
@@ -273,11 +295,12 @@ function initChat() {
|
|
|
273
295
|
// Restore persisted UI state
|
|
274
296
|
StatePersistence.restoreUIState();
|
|
275
297
|
|
|
276
|
-
// URL 参数处理: ?agent=xxx&mode=exec&session=xxx
|
|
298
|
+
// URL 参数处理: ?agent=xxx&mode=exec&session=xxx&popout=1
|
|
277
299
|
const urlParams = new URLSearchParams(window.location.search);
|
|
278
300
|
const urlAgent = urlParams.get('agent');
|
|
279
301
|
const urlMode = urlParams.get('mode');
|
|
280
302
|
const urlSession = urlParams.get('session');
|
|
303
|
+
const isPopout = urlParams.get('popout') === '1';
|
|
281
304
|
if (urlMode === 'chat' || urlMode === 'exec') {
|
|
282
305
|
state.chatMode = urlMode;
|
|
283
306
|
}
|
|
@@ -285,6 +308,22 @@ function initChat() {
|
|
|
285
308
|
state.activeAgent = urlAgent;
|
|
286
309
|
}
|
|
287
310
|
|
|
311
|
+
// Popout mode: hide sidebar, collapse agent panel, update title
|
|
312
|
+
if (isPopout) {
|
|
313
|
+
document.body.classList.add('popout-mode');
|
|
314
|
+
const sidebar = document.getElementById('sidebar');
|
|
315
|
+
const sidebarToggle = document.getElementById('sidebarToggle');
|
|
316
|
+
if (sidebar) sidebar.style.display = 'none';
|
|
317
|
+
if (sidebarToggle) sidebarToggle.style.display = 'none';
|
|
318
|
+
const agentPanel = document.getElementById('agentPanel');
|
|
319
|
+
if (agentPanel) agentPanel.classList.add('collapsed');
|
|
320
|
+
const agentToggle = document.getElementById('agentToggle');
|
|
321
|
+
if (agentToggle) agentToggle.style.display = 'none';
|
|
322
|
+
// Update page title with agent name
|
|
323
|
+
const agentObj = findAgentByPath(urlAgent);
|
|
324
|
+
document.title = (agentObj ? agentObj.name : urlAgent || 'MyAgent') + ' - MyAgent';
|
|
325
|
+
}
|
|
326
|
+
|
|
288
327
|
// Apply restored state to DOM
|
|
289
328
|
const panel = document.getElementById('agentPanel');
|
|
290
329
|
if (panel) panel.classList.toggle('collapsed', !state.agentPanelOpen);
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
<button class="header-btn" id="themeToggle" title="切换主题">
|
|
32
32
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="5"/><line x1="12" y1="1" x2="12" y2="3"/><line x1="12" y1="21" x2="12" y2="23"/><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"/><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"/><line x1="1" y1="12" x2="3" y2="12"/><line x1="21" y1="12" x2="23" y2="12"/><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"/><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/></svg>
|
|
33
33
|
</button>
|
|
34
|
+
<button class="header-btn" id="popoutBtn" onclick="popoutChat()" title="弹出独立窗口">
|
|
35
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/><path d="M21 14v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5"/></svg>
|
|
36
|
+
</button>
|
|
34
37
|
</div>
|
|
35
38
|
</div>
|
|
36
39
|
|