From 67e2e56bd24f036578bebafb806d382461bf2173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AC=E6=98=8E?= <83812544+Ed1s0nZ@users.noreply.github.com> Date: Wed, 14 Jan 2026 01:21:20 +0800 Subject: [PATCH] Add files via upload --- web/static/css/style.css | 10 ++++++---- web/static/js/chat.js | 15 ++++++++------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/web/static/css/style.css b/web/static/css/style.css index ec01f365..ac5f0292 100644 --- a/web/static/css/style.css +++ b/web/static/css/style.css @@ -1523,7 +1523,7 @@ header { display: flex; flex-direction: row; gap: 8px; - align-items: center; + align-items: flex-end; padding: 12px 16px; background: var(--bg-primary); border-top: 1px solid rgba(0, 0, 0, 0.06); @@ -1560,12 +1560,14 @@ header { background: #ffffff; color: var(--text-primary); resize: none; + height: 40px; min-height: 40px; max-height: 120px; font-family: inherit; - line-height: 1.5; + line-height: 1.4; overflow-y: auto; box-sizing: border-box; + vertical-align: middle; /* 隐藏滚动条但保留滚动功能 */ scrollbar-width: thin; /* Firefox */ scrollbar-color: transparent transparent; /* Firefox - 隐藏滚动条 */ @@ -7766,7 +7768,7 @@ header { display: flex; align-items: center; gap: 6px; - padding: 8px 12px; + padding: 10px 12px; height: 40px; background: #ffffff; border: 1px solid rgba(0, 0, 0, 0.1); @@ -7775,7 +7777,7 @@ header { cursor: pointer; transition: all 0.2s; flex-shrink: 0; - font-size: 0.875rem; + font-size: 0.9375rem; font-weight: 500; white-space: nowrap; box-sizing: border-box; diff --git a/web/static/js/chat.js b/web/static/js/chat.js index c3b219ae..2734a25d 100644 --- a/web/static/js/chat.js +++ b/web/static/js/chat.js @@ -93,14 +93,14 @@ function adjustTextareaHeight(textarea) { // 强制浏览器重新计算布局 void textarea.offsetHeight; - // 计算新高度(最小44px,最大不超过300px) + // 计算新高度(最小40px,最大不超过300px) const scrollHeight = textarea.scrollHeight; - const newHeight = Math.min(Math.max(scrollHeight, 44), 300); + const newHeight = Math.min(Math.max(scrollHeight, 40), 300); textarea.style.height = newHeight + 'px'; // 如果内容为空或只有很少内容,立即重置到最小高度 if (!textarea.value || textarea.value.trim().length === 0) { - textarea.style.height = '44px'; + textarea.style.height = '40px'; } } @@ -133,8 +133,8 @@ async function sendMessage() { // 立即清空输入框并清除草稿(在发送请求之前) input.value = ''; - // 强制重置输入框高度为初始高度(44px) - input.style.height = '44px'; + // 强制重置输入框高度为初始高度(40px) + input.style.height = '40px'; // 创建进度消息容器(使用详细的进度展示) const progressId = addProgressMessage(); @@ -751,7 +751,8 @@ function applyMentionSelection() { function initializeChatUI() { const chatInputEl = document.getElementById('chat-input'); if (chatInputEl) { - chatInputEl.style.height = '44px'; + // 初始化时设置正确的高度 + adjustTextareaHeight(chatInputEl); // 恢复保存的草稿(仅在输入框为空时恢复,避免覆盖用户输入) if (!chatInputEl.value || chatInputEl.value.trim() === '') { // 检查对话中是否有最近的消息(30秒内),如果有,说明可能是刚刚发送的消息,不恢复草稿 @@ -1479,7 +1480,7 @@ async function startNewConversation() { const chatInput = document.getElementById('chat-input'); if (chatInput) { chatInput.value = ''; - chatInput.style.height = '44px'; + adjustTextareaHeight(chatInput); } }