From b7c3fc9ff6bdf79f97111a464ae4c24eb515d603 Mon Sep 17 00:00:00 2001 From: YiLin <482244139@qq.com> Date: Tue, 4 Aug 2026 15:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=90=8E=E9=97=AA=E7=99=BD?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/Chat/Chat.css | 188 ++++++++++++++++++++++++++++++++++++++++++ pages/Chat/Chat.vue | 196 ++------------------------------------------ 2 files changed, 194 insertions(+), 190 deletions(-) diff --git a/pages/Chat/Chat.css b/pages/Chat/Chat.css index 9280a21..ea8f4e7 100644 --- a/pages/Chat/Chat.css +++ b/pages/Chat/Chat.css @@ -212,6 +212,194 @@ background: linear-gradient(135deg, #8b5cf6, #7c3aed); } +/* ========== 智能体选择弹窗 ========== */ + .agent-modal-mask { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.45); + backdrop-filter: blur(4px); + -webkit-backdrop-filter: blur(4px); + z-index: 1000; + display: flex; + align-items: center; + justify-content: center; + } + + .agent-modal { + width: 85%; + max-height: 70%; + background-color: #ffffff; + border-radius: 24rpx; + overflow: hidden; + display: flex; + flex-direction: column; + box-shadow: 0 16rpx 48rpx rgba(0, 0, 0, 0.12); + } + + .agent-modal-header { + display: flex; + justify-content: center; + align-items: center; + padding: 30rpx 30rpx 20rpx; + position: relative; + border-bottom: 2rpx solid #f0f0f0; + } + + .agent-modal-title { + font-size: 34rpx; + font-weight: 700; + color: #1a1a2e; + } + + .agent-modal-close { + position: absolute; + right: 24rpx; + top: 50%; + transform: translateY(-50%); + padding: 10rpx; + } + + .agent-list { + box-sizing: border-box; + flex: 1; + padding: 20rpx 24rpx; + max-height: 600rpx; + } + + .agent-loading { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 60rpx 0; + } + + .agent-loading-text { + margin-top: 16rpx; + font-size: 26rpx; + color: #999; + } + + .agent-empty { + display: flex; + align-items: center; + justify-content: center; + padding: 80rpx 0; + } + + .agent-empty-text { + font-size: 28rpx; + color: #999; + } + + .agent-card { + box-sizing: border-box; + width: 100%; + background: linear-gradient(135deg, #f8f5ff, #efe8ff); + border: 2rpx solid #c4b5fd; + border-radius: 20rpx; + padding: 28rpx 24rpx; + margin-bottom: 20rpx; + transition: all 0.2s ease; + overflow: hidden; + } + + .agent-card:active { + transform: scale(0.98); + border-color: #a78bfa; + background: linear-gradient(135deg, #f3efff, #e8dcff); + } + + .agent-card-header { + display: flex; + align-items: center; + margin-bottom: 16rpx; + } + + .agent-avatar { + width: 70rpx; + height: 70rpx; + border-radius: 20rpx; + background: linear-gradient(135deg, #8b5cf6, #7c3aed); + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + } + + .agent-card-info { + margin-left: 16rpx; + display: flex; + flex-direction: column; + flex: 1; + min-width: 0; + } + + .agent-card-title { + font-size: 30rpx; + font-weight: 600; + color: #1a1a2e; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + + .agent-card-category { + font-size: 22rpx; + color: #8b5cf6; + margin-top: 4rpx; + } + + .agent-card-desc { + font-size: 26rpx; + color: #555; + line-height: 1.5; + word-break: break-all; + display: -webkit-box; + -webkit-line-clamp: 5; + -webkit-box-orient: vertical; + overflow: hidden; + } + + .agent-card-welcome { + font-size: 24rpx; + color: #7c3aed; + margin-top: 12rpx; + padding-top: 12rpx; + border-top: 2rpx dashed #ddd6fe; + word-break: break-all; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; + } + + .agent-modal-footer { + padding: 20rpx 30rpx 30rpx; + border-top: 2rpx solid #f0f0f0; + display: flex; + justify-content: flex-end; + } + + .agent-modal-btn { + padding: 18rpx 48rpx; + border-radius: 16rpx; + font-size: 28rpx; + font-weight: 500; + } + + .agent-modal-btn-cancel { + background: #f0f0f0; + color: #666; + } + + .agent-modal-btn-cancel:active { + background: #e0e0e0; + } + /* ==========新建聊天列表相关====== */ .close-option-card { width: 100%; diff --git a/pages/Chat/Chat.vue b/pages/Chat/Chat.vue index 0a34c80..0206869 100644 --- a/pages/Chat/Chat.vue +++ b/pages/Chat/Chat.vue @@ -1362,7 +1362,7 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener. } // 全局监听 socketStore.isThinking:跨设备同步思考状态,锁/解锁输入框 - watch(() => socketStore.isThinking, (newVal, oldVal) => { + watch(() => socketStore.isThinking, async (newVal, oldVal) => { console.log("isThinking 变化:", oldVal, "→", newVal, "messageString:", socketStore.messageString); // false → true:后端开始回复,锁定输入框 if (!oldVal && newVal) { @@ -1383,12 +1383,14 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener. // true → false:AI 回复结束或中断,解锁输入框并刷新消息列表 if (oldVal && !newVal) { console.log('AI回复结束(正常/中断),解锁并刷新消息列表'); - // 移除流式消息气泡,从服务器加载完整消息 + + // 先从服务器加载完整消息列表 + await takeConversationMessages() + // 加载完成后再移除流式消息气泡,避免闪白 if (streamingMessageId.value) { allmessages.value = allmessages.value.filter(m => m._id !== streamingMessageId.value) streamingMessageId.value = null } - takeConversationMessages() isThinking.value = false isSelfSent.value = false textMessage.value = '' @@ -1808,193 +1810,7 @@ import { openFile as openFileNative, downloadAndOpen } from '@/utils/fileOpener.