myagent-ai 1.18.4 → 1.18.5
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/core/vnc_manager.py +6 -1
- package/package.json +1 -1
- package/web/ui/chat/chat.css +47 -0
- package/web/ui/chat/chat_main.js +41 -8
package/core/vnc_manager.py
CHANGED
|
@@ -724,8 +724,13 @@ class VNCManager:
|
|
|
724
724
|
)
|
|
725
725
|
|
|
726
726
|
# 等待 VNC 端口就绪
|
|
727
|
-
await asyncio.sleep(1)
|
|
727
|
+
await asyncio.sleep(1.5)
|
|
728
728
|
if self._x11vnc_process.poll() is not None:
|
|
729
|
+
# [v1.18.4] x11vnc 可能 fork 到后台运行,父进程退出但子进程仍在监听端口
|
|
730
|
+
if self._is_port_listening(self.x11vnc_port):
|
|
731
|
+
logger.warning(f"x11vnc 父进程已退出但端口 {self.x11vnc_port} 仍在监听(fork 到后台),视为启动成功")
|
|
732
|
+
return True
|
|
733
|
+
# 端口未监听 = 真正的启动失败
|
|
729
734
|
stderr = ""
|
|
730
735
|
try:
|
|
731
736
|
stderr = self._x11vnc_process.stderr.read().decode("utf-8", errors="replace")[:2000]
|
package/package.json
CHANGED
package/web/ui/chat/chat.css
CHANGED
|
@@ -676,6 +676,53 @@ input,textarea,select{font:inherit}
|
|
|
676
676
|
.msg-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500}
|
|
677
677
|
.msg-file-size{font-size:11px;color:var(--text3);flex-shrink:0}
|
|
678
678
|
|
|
679
|
+
/* [v1.17] 移动端文件附件适配 */
|
|
680
|
+
@media (max-width: 768px) {
|
|
681
|
+
.msg-file-item {
|
|
682
|
+
max-width: 100%;
|
|
683
|
+
padding: 10px 14px;
|
|
684
|
+
font-size: 14px;
|
|
685
|
+
gap: 10px;
|
|
686
|
+
min-height: 44px;
|
|
687
|
+
}
|
|
688
|
+
.msg-file-icon { font-size: 22px; }
|
|
689
|
+
.msg-file-name { font-size: 14px; }
|
|
690
|
+
.msg-attachments { gap: 10px; }
|
|
691
|
+
.msg-image-wrapper { max-width: 100%; }
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/* [v1.17] 折叠文件内容样式 */
|
|
695
|
+
.file-content-collapse {
|
|
696
|
+
border: 1px solid var(--bg4);
|
|
697
|
+
border-radius: var(--radius-sm);
|
|
698
|
+
overflow: hidden;
|
|
699
|
+
}
|
|
700
|
+
.file-content-collapse summary {
|
|
701
|
+
padding: 8px 14px;
|
|
702
|
+
cursor: pointer;
|
|
703
|
+
font-size: 13px;
|
|
704
|
+
color: var(--text3);
|
|
705
|
+
background: var(--bg2);
|
|
706
|
+
user-select: none;
|
|
707
|
+
display: flex;
|
|
708
|
+
align-items: center;
|
|
709
|
+
gap: 6px;
|
|
710
|
+
}
|
|
711
|
+
.file-content-collapse summary:hover {
|
|
712
|
+
color: var(--text2);
|
|
713
|
+
background: var(--bg3);
|
|
714
|
+
}
|
|
715
|
+
.file-content-collapse[open] summary {
|
|
716
|
+
border-bottom: 1px solid var(--bg4);
|
|
717
|
+
}
|
|
718
|
+
.file-content-collapse .collapse-body {
|
|
719
|
+
padding: 10px 14px;
|
|
720
|
+
max-height: 400px;
|
|
721
|
+
overflow-y: auto;
|
|
722
|
+
font-size: 13px;
|
|
723
|
+
line-height: 1.5;
|
|
724
|
+
}
|
|
725
|
+
|
|
679
726
|
.send-btn{
|
|
680
727
|
width:36px;height:36px;border-radius:var(--radius-sm);
|
|
681
728
|
background:var(--accent);color:#fff;
|
package/web/ui/chat/chat_main.js
CHANGED
|
@@ -2779,9 +2779,15 @@ function _renderMessagesInner() {
|
|
|
2779
2779
|
}
|
|
2780
2780
|
}
|
|
2781
2781
|
|
|
2782
|
+
// [v1.17] 对历史消息中的长文件内容进行折叠
|
|
2783
|
+
const needCollapse = !msg.streaming && !isUser && !hasParts && !hasStreamingText && shouldCollapseContent(msg.content);
|
|
2784
|
+
const collapsedContent = needCollapse
|
|
2785
|
+
? '<details class="file-content-collapse"><summary>📄 文件内容处理结果(点击展开)</summary><div class="collapse-body">' + content + '</div></details>'
|
|
2786
|
+
: content;
|
|
2787
|
+
|
|
2782
2788
|
// Backward compat: single bubble for messages without parts (full width)
|
|
2783
2789
|
const singleBubbleHtml = (!hasParts && !hasStreamingText)
|
|
2784
|
-
? (
|
|
2790
|
+
? (collapsedContent ? `<div class="message-bubble msg-bubble-wrapper">${collapsedContent}${ttsIndicator}</div>` : '')
|
|
2785
2791
|
: '';
|
|
2786
2792
|
|
|
2787
2793
|
// ── Task Plan (historical view only — hidden during streaming, shown after completion) ──
|
|
@@ -2924,6 +2930,25 @@ function renderMarkdown(text) {
|
|
|
2924
2930
|
}
|
|
2925
2931
|
}
|
|
2926
2932
|
|
|
2933
|
+
// [v1.17] 检测消息内容是否应折叠(用于历史消息中的长文件内容)
|
|
2934
|
+
function shouldCollapseContent(content) {
|
|
2935
|
+
if (!content || typeof content !== 'string') return false;
|
|
2936
|
+
// 只折叠较长的内容(> 1500 字符)
|
|
2937
|
+
if (content.length < 1500) return false;
|
|
2938
|
+
// 检测文件读取/处理模式
|
|
2939
|
+
var filePatterns = [
|
|
2940
|
+
'已读取', '已读取文件', '文件内容', '📄',
|
|
2941
|
+
'tool_call', 'tool_result', 'Extracted text',
|
|
2942
|
+
'读取完成', '文件读取', 'PDF 内容', 'Excel 内容',
|
|
2943
|
+
'Document content', 'Sheet data'
|
|
2944
|
+
];
|
|
2945
|
+
// 检测文件扩展名
|
|
2946
|
+
var fileExts = /\.(pdf|xlsx|docx|pptx|csv|doc|xls|ppt|txt|md|json|xml|html)/i;
|
|
2947
|
+
var hasFilePattern = filePatterns.some(function(p) { return content.indexOf(p) >= 0; });
|
|
2948
|
+
var hasFileExt = fileExts.test(content);
|
|
2949
|
+
return hasFilePattern || hasFileExt;
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2927
2952
|
// 高效的 HTML 转义(不创建 DOM 元素,避免大文本时性能问题)
|
|
2928
2953
|
// ── [v1.16.12] 文件上传辅助函数 ──
|
|
2929
2954
|
function formatFileSize(bytes) {
|
|
@@ -2949,6 +2974,7 @@ function _getFileIcon(name) {
|
|
|
2949
2974
|
|
|
2950
2975
|
// [v1.16.17→19] 文件查看器 — 新窗口打开文件 + 下载按钮
|
|
2951
2976
|
// [v1.16.19] 支持更多文件类型内联预览,非预览类型直接触发下载
|
|
2977
|
+
// [v1.17] 移动端优化:全屏、更大按钮/字体、触摸友好
|
|
2952
2978
|
function openFileViewer(fileId, src, fileName) {
|
|
2953
2979
|
if (!src && !fileId) return;
|
|
2954
2980
|
if (!src && fileId) src = '/api/file/' + fileId;
|
|
@@ -2962,18 +2988,20 @@ function openFileViewer(fileId, src, fileName) {
|
|
|
2962
2988
|
var isText = /\.(txt|md|csv|json|xml|html?|css|js|ts|py|java|c|cpp|go|rs|rb|php|sh|yaml|yml|toml|ini|cfg|conf|log|sql|lua|vim)$/i.test(fileName || src);
|
|
2963
2989
|
var canInline = isImage || isPdf || isVideo || isAudio;
|
|
2964
2990
|
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
'
|
|
2969
|
-
'.toolbar
|
|
2991
|
+
// [v1.17] 检测是否移动端,移动端使用全屏模式
|
|
2992
|
+
var _isMobile = isMobile();
|
|
2993
|
+
var html = '<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no"><title>' + escapeHtml(fileName || '文件查看') + '</title>' +
|
|
2994
|
+
'<style>*{margin:0;padding:0;box-sizing:border-box}html,body{width:100%;height:100%}body{background:#1a1a2e;color:#e0e0e0;font-family:-apple-system,BlinkMacSystemFont,sans-serif;display:flex;flex-direction:column;height:100vh;height:100dvh;overflow:hidden}' +
|
|
2995
|
+
'.toolbar{display:flex;align-items:center;padding:' + (_isMobile ? '12px 14px' : '10px 16px') + ';background:#16213e;gap:' + (_isMobile ? '10px' : '12px') + ';border-bottom:1px solid #2a2a4a;flex-shrink:0}' +
|
|
2996
|
+
'.toolbar .fname{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:' + (_isMobile ? '15px' : '14px') + '}' +
|
|
2997
|
+
'.toolbar button{padding:' + (_isMobile ? '8px 20px' : '6px 16px') + ';border:none;border-radius:6px;cursor:pointer;font-size:' + (_isMobile ? '15px' : '13px') + ';background:#4a4a8a;color:#fff;transition:background .2s;min-height:44px;display:inline-flex;align-items:center;justify-content:center}' +
|
|
2970
2998
|
'.toolbar button:hover{background:#6a6aaa}' +
|
|
2971
2999
|
'.toolbar .close-btn{background:#c0392b}.toolbar .close-btn:hover{background:#e74c3c}' +
|
|
2972
3000
|
'.viewer{flex:1;display:flex;align-items:center;justify-content:center;overflow:auto;padding:16px;background:#0f0f23}' +
|
|
2973
3001
|
'.viewer img{max-width:100%;max-height:100%;object-fit:contain;border-radius:4px}' +
|
|
2974
3002
|
'.viewer iframe{width:100%;height:100%;border:none;background:#fff}' +
|
|
2975
3003
|
'.viewer video,.viewer audio{max-width:100%;max-height:100%}' +
|
|
2976
|
-
'.viewer .no-preview{display:flex;flex-direction:column;align-items:center;gap:16px;color:#999}' +
|
|
3004
|
+
'.viewer .no-preview{display:flex;flex-direction:column;align-items:center;gap:16px;color:#999;padding:20px}' +
|
|
2977
3005
|
'.viewer .no-preview .icon{font-size:64px;opacity:0.5}' +
|
|
2978
3006
|
'.viewer .no-preview .hint{font-size:14px;text-align:center;line-height:1.6}' +
|
|
2979
3007
|
'.viewer pre{background:#1e1e3a;border-radius:8px;padding:16px;width:100%;height:100%;overflow:auto;font-size:13px;line-height:1.5;color:#d4d4d4;white-space:pre-wrap;word-break:break-all;border:1px solid #2a2a4a}' +
|
|
@@ -3005,10 +3033,15 @@ function openFileViewer(fileId, src, fileName) {
|
|
|
3005
3033
|
}
|
|
3006
3034
|
html += '</div></body></html>';
|
|
3007
3035
|
|
|
3008
|
-
|
|
3036
|
+
// [v1.17] 移动端使用全屏,桌面端使用固定尺寸
|
|
3037
|
+
var w = window.open('', '_blank', _isMobile ? 'width=100%,height=100%' : 'width=900,height=700');
|
|
3009
3038
|
if (w) {
|
|
3010
3039
|
w.document.write(html);
|
|
3011
3040
|
w.document.close();
|
|
3041
|
+
// [v1.17] 移动端尝试全屏
|
|
3042
|
+
if (_isMobile) {
|
|
3043
|
+
try { w.moveTo(0, 0); w.resizeTo(screen.width, screen.height); } catch(e) {}
|
|
3044
|
+
}
|
|
3012
3045
|
}
|
|
3013
3046
|
}
|
|
3014
3047
|
|