From 0e75d6a4e0934a342fcfc49b7501cf8c24e8fc55 Mon Sep 17 00:00:00 2001 From: Codebuddy Date: Thu, 18 Jun 2026 16:07:46 +0800 Subject: [PATCH] =?utf8?q?=E6=96=B9=E6=A1=88B:=20xterm=E8=BE=93=E5=87=BA?= =?utf8?q?=E5=8C=BA=20+=20=E7=8B=AC=E7=AB=8B=E8=BE=93=E5=85=A5=E6=A1=86?= =?utf8?q?=EF=BC=88=E8=B1=86=E5=8C=85=E5=BC=8F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 重构终端页为上下两区: - 上: xterm 区保留 codebuddy TUI 输出(流式/工具调用/交互确认) - 下: 独立多行 textarea 输入区 + 发送/📎/✕ 按钮 输入区能力: - 文字粘贴: 浏览器原生 textarea paste,可靠不失效 - 图片粘贴: Ctrl+V 截图自动上传到 /api/upload-image,显示绿色 chip - 图片拖拽: 拖文件到输入框上传 - 📎 按钮: 选择图片文件 - 发送: Ctrl+Enter 或点发送按钮,文字+图片标签一起进 PTY 移除: - 旧的 xterm paste 监听(与 xterm 内部冲突导致粘贴失效) - 旧的 📋 粘贴 modal(被独立输入区取代) 保留: backend /api/upload-image 端点不变 --- frontend/index.html | 372 +++++++++++++++++++++++++------------------- 1 file changed, 209 insertions(+), 163 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index f5a4e92..4a3eac0 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -59,7 +59,51 @@ html { font-size: 15px; } html, body { height: 100%; background: #1a1a2e; color: } .top-bar .action-btn:hover { background: rgba(255,255,255,0.12); color: #fff; } -#terminal-container { flex: 1; overflow: hidden; padding: 4px; } +/* 终端页布局:xterm 输出区 + 独立输入区 */ +#terminal-page { display: none; height: 100vh; flex-direction: column; } +#terminal-container { flex: 1; overflow: hidden; padding: 4px; min-height: 0; } + +/* 输入区(豆包式) */ +#input-bar { + flex-shrink: 0; border-top: 1px solid rgba(255,255,255,0.12); + background: rgba(0,0,0,0.35); padding: 10px 14px; +} +#input-bar .input-row { + display: flex; gap: 8px; align-items: flex-end; + background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15); + border-radius: 12px; padding: 8px 10px; +} +#input-bar .input-row:focus-within { border-color: #4ecca3; } +#msg-input { + flex: 1; background: transparent; border: none; outline: none; color: #e0e0e0; + font-family: 'Cascadia Code', 'Fira Code', Menlo, Monaco, 'Courier New', monospace; + font-size: 14px; line-height: 1.5; resize: none; max-height: 160px; min-height: 24px; + padding: 4px 4px; +} +#msg-input::placeholder { color: #666; } +#input-bar .input-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; } +.icon-btn { + width: 32px; height: 32px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.15); + background: rgba(255,255,255,0.05); color: #ccc; font-size: 16px; cursor: pointer; + display: flex; align-items: center; justify-content: center; transition: all 0.15s; +} +.icon-btn:hover { background: rgba(255,255,255,0.12); color: #fff; } +.send-btn { + padding: 0 16px; height: 32px; border-radius: 8px; border: none; + background: linear-gradient(135deg, #4ecca3, #38b2ac); color: #1a1a2e; + font-size: 14px; font-weight: 600; cursor: pointer; +} +.send-btn:hover { opacity: 0.9; } +.send-btn:disabled { opacity: 0.4; cursor: not-allowed; } +#input-bar .input-hint { font-size: 11px; color: #666; margin-top: 4px; text-align: right; } +#input-bar .img-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; } +#input-bar .img-chip { + display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; + background: rgba(78,204,163,0.12); border: 1px solid rgba(78,204,163,0.3); + border-radius: 6px; font-size: 12px; color: #4ecca3; +} +#input-bar .img-chip .remove { cursor: pointer; opacity: 0.6; } +#input-bar .img-chip .remove:hover { opacity: 1; } /* 任务列表页 */ #picker-page { display: none; flex-direction: column; height: 100vh; } @@ -140,20 +184,22 @@ html { font-size: 15px; } html, body { height: 100%; background: #1a1a2e; color:
-
-