From 8261415b4096ef3897e521e87e2abc6bb2133a30 Mon Sep 17 00:00:00 2001 From: MT-Mint <798521692@qq.com> Date: Tue, 31 Mar 2026 17:35:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(input):=20=E5=B0=86=20ChatInput=20?= =?UTF-8?q?=E5=AE=B9=E5=99=A8=E6=94=B9=E4=B8=BA=20grid=20=E5=B8=83?= =?UTF-8?q?=E5=B1=80=EF=BC=8C=E4=BF=AE=E5=A4=8D=20textarea=20=E6=BA=A2?= =?UTF-8?q?=E5=87=BA=E6=BB=9A=E5=8A=A8=E6=8A=96=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/input/ChatInput.vue | 58 ++----- src/components/message/MessageBubble.vue | 155 +++++++----------- .../message/components/ThinkingNode.vue | 70 ++++---- src/components/ui/StackedCards.vue | 116 +++++++------ 4 files changed, 176 insertions(+), 223 deletions(-) diff --git a/src/components/input/ChatInput.vue b/src/components/input/ChatInput.vue index 04b7c24..2bc9446 100644 --- a/src/components/input/ChatInput.vue +++ b/src/components/input/ChatInput.vue @@ -4,14 +4,7 @@
- - @@ -68,8 +61,8 @@ - @@ -94,7 +87,6 @@ import { chatApi } from "@/services/api"; import { useAuthStore } from "@/stores/auth"; import { useSettingsStore } from "@/stores/settings"; import StackedCards from "@/components/ui/StackedCards.vue"; -import PlusIcon from "../icons/custom/PlusIcon.vue"; import SendIcon from "../icons/custom/SendIcon.vue"; interface AttachmentWithProgress extends Attachment { @@ -202,7 +194,7 @@ function autoResize() { if (!textarea) return; textarea.style.height = "auto"; - const maxHeight = isExpanded.value ? 400 : 160; + const maxHeight = isExpanded.value ? 400 : 116; // 增加1px是为了避免滚动条出现 textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight) + 1}px`; } @@ -498,17 +490,11 @@ onMounted(() => { // border: 2px solid #e2e8f0; height: 200px; border-radius: 20px; - display: flex; - flex-direction: column; padding: 20px; - justify-content: space-between; - overflow: hidden; - transition: all 0.2s ease; - - .dark & { - background: #1e1e2e; - border-color: #374151; - } + display: grid; + grid-template-rows: minmax(0, 1fr) auto; + gap: 12px; + border-color: #374151; // &.is-focused { // border-color: #3b82f6; @@ -527,6 +513,7 @@ onMounted(() => { display: flex; align-items: flex-start; justify-content: flex-start; + min-height: 0; gap: 8px; } @@ -624,11 +611,14 @@ onMounted(() => { .textarea-wrapper { flex: 1; min-width: 0; + min-height: 0; textarea { width: 100%; min-height: 25px; - max-height: 160px; + max-height: 100%; + overflow-y: auto; + scrollbar-gutter: stable; padding: 8px 0; border: none; outline: none; @@ -653,7 +643,6 @@ onMounted(() => { display: flex; align-items: center; justify-content: space-between; - border-top: 1px solid #f3f4f6; // background: #fafbfc; .dark & { @@ -714,27 +703,6 @@ onMounted(() => { } } -.upload-action-div { - display: grid; - place-items: center; - border-radius: 0; - width: 50px; - height: 70px; - background-color: rgb(255, 255, 255); -} - -.upload-action-div.disabled { - cursor: not-allowed; - opacity: 0.42; - background: #f3f4f6; - border: 1px dashed #cbd5e1; - filter: grayscale(1); -} - -.upload-action-div.disabled :deep(svg) { - opacity: 0.5; -} - @keyframes pulse { 0%, diff --git a/src/components/message/MessageBubble.vue b/src/components/message/MessageBubble.vue index 2738f1a..473c171 100644 --- a/src/components/message/MessageBubble.vue +++ b/src/components/message/MessageBubble.vue @@ -1,21 +1,15 @@ @@ -310,7 +258,7 @@ setCustomComponents("playground-demo", { .message-bubble { display: flex; gap: 16px; - padding: 20px 10%; + padding: 20px 22%; animation: fadeIn 0.3s ease; // 消息选择模式 @@ -347,9 +295,9 @@ setCustomComponents("playground-demo", { } .message-body { - background: #f8fafc; - color: #1f2937; - border-radius: 20px 20px 4px 20px; + border-radius: 10px 2px 10px 10px; + background: #EEEFF0; + } .text-content { @@ -366,8 +314,10 @@ setCustomComponents("playground-demo", { &.role-assistant { .message-body { - background: #f8fafc; - border-radius: 20px 20px 20px 4px; + padding: 15px 20px; + gap: 15px; + border-radius: 2px 10px 10px 10px; + background: var(---F8F9FA, #F8F9FA); .dark & { background: #2d2d3d; @@ -454,7 +404,6 @@ setCustomComponents("playground-demo", { display: flex; flex-direction: column; gap: 8px; - max-width: 75%; min-width: 0; } @@ -491,7 +440,7 @@ setCustomComponents("playground-demo", { // markstream-vue 样式覆盖 .text-content { - :deep(p) { + :deep(p) { margin: 0 0 12px; &:last-child { @@ -550,6 +499,7 @@ setCustomComponents("playground-demo", { } .dark & { + th, td { border-color: #374151; @@ -589,12 +539,15 @@ setCustomComponents("playground-demo", { :deep(h1) { font-size: 1.5em; } + :deep(h2) { font-size: 1.3em; } + :deep(h3) { font-size: 1.15em; } + :deep(h4) { font-size: 1em; } @@ -851,6 +804,7 @@ setCustomComponents("playground-demo", { &:nth-child(1) { animation-delay: -0.32s; } + &:nth-child(2) { animation-delay: -0.16s; } @@ -862,6 +816,7 @@ setCustomComponents("playground-demo", { opacity: 0; transform: translateY(10px); } + to { opacity: 1; transform: translateY(0); @@ -869,11 +824,13 @@ setCustomComponents("playground-demo", { } @keyframes pulse { + 0%, 100% { opacity: 1; transform: scale(1); } + 50% { opacity: 0.5; transform: scale(0.8); @@ -881,12 +838,14 @@ setCustomComponents("playground-demo", { } @keyframes pulseDot { + 0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; } + 40% { transform: scale(1); opacity: 1; diff --git a/src/components/message/components/ThinkingNode.vue b/src/components/message/components/ThinkingNode.vue index 33ad9cf..2cddaa1 100644 --- a/src/components/message/components/ThinkingNode.vue +++ b/src/components/message/components/ThinkingNode.vue @@ -37,13 +37,11 @@ async function textCopy(data: any) {