From c29e9e9cc73c1162e06d6322bc6abfa40c5547ce Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Thu, 25 Dec 2025 16:28:35 +0800 Subject: [PATCH] =?UTF-8?q?refactor(glass):=20=E6=89=B9=E6=AC=A13=20-=20?= =?UTF-8?q?=E8=BF=81=E7=A7=BB=20AgentChat=20=E9=A1=B5=E9=9D=A2=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=BB=9F=E4=B8=80=E6=AF=9B=E7=8E=BB=E7=92=83=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 迁移以下 10 个 AgentChat 模块文件: - index.js: GLASS_BLUR.lg 替换 blur(20px) - LeftSidebar/index.js: GLASS_BLUR.lg/sm 替换 blur(20px)/blur(10px) - LeftSidebar/SessionCard.js: GLASS_BLUR.md 替换 blur(12px) - RightSidebar/index.js: GLASS_BLUR.lg/sm/md 替换多处硬编码 - RightSidebar/ToolSelector.tsx: GLASS_BLUR.md 替换 blur(12px) - ChatArea/index.js: GLASS_BLUR.lg/sm 替换多处硬编码 - ChatArea/MessageRenderer.js: GLASS_BLUR.md 替换 blur(16px) - ChatArea/WelcomeScreen.js: GLASS_BLUR.md 替换 blur(12px) - ChatArea/ExecutionStepsDisplay.js: GLASS_BLUR.sm 替换 blur(10px) - MeetingRoom/index.js: GLASS_BLUR.lg 替换 blur(20px) 保留 saturate(180%) 组合效果 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../ChatArea/ExecutionStepsDisplay.js | 5 +++-- .../components/ChatArea/MessageRenderer.js | 11 ++++++----- .../components/ChatArea/WelcomeScreen.js | 3 ++- .../AgentChat/components/ChatArea/index.js | 19 ++++++++++--------- .../components/LeftSidebar/SessionCard.js | 3 ++- .../AgentChat/components/LeftSidebar/index.js | 9 +++++---- .../AgentChat/components/MeetingRoom/index.js | 5 +++-- .../components/RightSidebar/ToolSelector.tsx | 3 ++- .../components/RightSidebar/index.js | 15 ++++++++------- src/views/AgentChat/index.js | 3 ++- 10 files changed, 43 insertions(+), 33 deletions(-) diff --git a/src/views/AgentChat/components/ChatArea/ExecutionStepsDisplay.js b/src/views/AgentChat/components/ChatArea/ExecutionStepsDisplay.js index 09380c0c..5254f96f 100644 --- a/src/views/AgentChat/components/ChatArea/ExecutionStepsDisplay.js +++ b/src/views/AgentChat/components/ChatArea/ExecutionStepsDisplay.js @@ -24,6 +24,7 @@ import { } from '@chakra-ui/react'; import { Activity, ChevronDown, ChevronRight, Copy, Check, Database, FileJson } from 'lucide-react'; import { MarkdownWithCharts } from '@components/ChatBot/MarkdownWithCharts'; +import { GLASS_BLUR } from '@/constants/glassConfig'; /** * 格式化结果数据用于显示 @@ -248,7 +249,7 @@ ${JSON.stringify(echartsConfig)} > { borderColor="rgba(255, 255, 255, 0.1)" borderRadius="lg" bg="rgba(255, 255, 255, 0.03)" - backdropFilter="blur(10px)" + backdropFilter={GLASS_BLUR.sm} _hover={{ bg: 'rgba(255, 255, 255, 0.05)', borderColor: 'rgba(255, 255, 255, 0.2)', diff --git a/src/views/AgentChat/components/ChatArea/MessageRenderer.js b/src/views/AgentChat/components/ChatArea/MessageRenderer.js index 4f90b8fe..ab408685 100644 --- a/src/views/AgentChat/components/ChatArea/MessageRenderer.js +++ b/src/views/AgentChat/components/ChatArea/MessageRenderer.js @@ -22,6 +22,7 @@ import { Cpu, User, Copy, ThumbsUp, ThumbsDown, File, ListChecks, Play, CheckCir import { MessageTypes } from '../../constants/messageTypes'; import ExecutionStepsDisplay from './ExecutionStepsDisplay'; import { MarkdownWithCharts } from '@components/ChatBot/MarkdownWithCharts'; +import { GLASS_BLUR } from '@/constants/glassConfig'; /** * MessageRenderer - 消息渲染器组件 @@ -95,7 +96,7 @@ const MessageRenderer = ({ message, userAvatar }) => { { > { > { > { { w="full" p={4} bg="rgba(255, 255, 255, 0.03)" - backdropFilter="blur(12px)" + backdropFilter={GLASS_BLUR.md} border="1px solid" borderColor="rgba(255, 255, 255, 0.08)" borderRadius="xl" diff --git a/src/views/AgentChat/components/ChatArea/index.js b/src/views/AgentChat/components/ChatArea/index.js index d6196b32..13a0a38c 100644 --- a/src/views/AgentChat/components/ChatArea/index.js +++ b/src/views/AgentChat/components/ChatArea/index.js @@ -31,6 +31,7 @@ import { } from 'lucide-react'; import { AVAILABLE_MODELS } from '../../constants/models'; import { animations } from '../../constants/animations'; +import { GLASS_BLUR } from '@/constants/glassConfig'; import MessageRenderer from './MessageRenderer'; import WelcomeScreen from './WelcomeScreen'; @@ -89,7 +90,7 @@ const ChatArea = ({ {/* 顶部标题栏 - 深色毛玻璃 */} @@ -316,7 +317,7 @@ const ChatArea = ({ onClick={() => fileInputRef.current?.click()} bg="rgba(255, 255, 255, 0.05)" color="gray.300" - backdropFilter="blur(10px)" + backdropFilter={GLASS_BLUR.sm} border="1px solid" borderColor="rgba(255, 255, 255, 0.1)" _hover={{ @@ -341,7 +342,7 @@ const ChatArea = ({ }} bg="rgba(255, 255, 255, 0.05)" color="gray.300" - backdropFilter="blur(10px)" + backdropFilter={GLASS_BLUR.sm} border="1px solid" borderColor="rgba(255, 255, 255, 0.1)" _hover={{ @@ -365,7 +366,7 @@ const ChatArea = ({ variant="outline" borderWidth={2} bg="rgba(255, 255, 255, 0.05)" - backdropFilter="blur(10px)" + backdropFilter={GLASS_BLUR.sm} border="1px solid" borderColor="rgba(255, 255, 255, 0.1)" color="white" diff --git a/src/views/AgentChat/components/LeftSidebar/SessionCard.js b/src/views/AgentChat/components/LeftSidebar/SessionCard.js index 4e3f4d6c..d17b12b0 100644 --- a/src/views/AgentChat/components/LeftSidebar/SessionCard.js +++ b/src/views/AgentChat/components/LeftSidebar/SessionCard.js @@ -4,6 +4,7 @@ import React from 'react'; import { motion } from 'framer-motion'; import { Card, CardBody, Flex, Box, Text, Badge } from '@chakra-ui/react'; +import { GLASS_BLUR } from '@/constants/glassConfig'; /** * SessionCard - 会话卡片组件 @@ -25,7 +26,7 @@ const SessionCard = ({ session, isActive, onPress }) => { cursor="pointer" onClick={onPress} bg={isActive ? 'rgba(139, 92, 246, 0.15)' : 'rgba(255, 255, 255, 0.05)'} - backdropFilter="blur(12px)" + backdropFilter={GLASS_BLUR.md} borderWidth={1} borderColor={isActive ? 'purple.400' : 'rgba(255, 255, 255, 0.1)'} _hover={{ diff --git a/src/views/AgentChat/components/LeftSidebar/index.js b/src/views/AgentChat/components/LeftSidebar/index.js index 2f359323..6d11fc06 100644 --- a/src/views/AgentChat/components/LeftSidebar/index.js +++ b/src/views/AgentChat/components/LeftSidebar/index.js @@ -21,6 +21,7 @@ import { MessageSquare, Plus, Search, ChevronLeft, ChevronDown, MoreHorizontal } import { animations } from '../../constants/animations'; import { groupSessionsByDate } from '../../utils/sessionUtils'; import DateGroup from './DateGroup'; +import { GLASS_BLUR } from '@/constants/glassConfig'; /** * LeftSidebar - 左侧栏组件 @@ -94,7 +95,7 @@ const LeftSidebar = ({ display="flex" flexDirection="column" bg="rgba(17, 24, 39, 0.8)" - backdropFilter="blur(20px) saturate(180%)" + backdropFilter={`${GLASS_BLUR.lg} saturate(180%)`} borderRight="1px solid" borderColor="rgba(255, 255, 255, 0.1)" boxShadow="4px 0 24px rgba(0, 0, 0, 0.3)" @@ -123,7 +124,7 @@ const LeftSidebar = ({ onClick={onNewSession} bg="rgba(255, 255, 255, 0.05)" color="gray.300" - backdropFilter="blur(10px)" + backdropFilter={GLASS_BLUR.sm} border="1px solid" borderColor="rgba(255, 255, 255, 0.1)" _hover={{ @@ -144,7 +145,7 @@ const LeftSidebar = ({ onClick={onClose} bg="rgba(255, 255, 255, 0.05)" color="gray.300" - backdropFilter="blur(10px)" + backdropFilter={GLASS_BLUR.sm} border="1px solid" borderColor="rgba(255, 255, 255, 0.1)" _hover={{ @@ -171,7 +172,7 @@ const LeftSidebar = ({ variant="outline" pl={10} bg="rgba(255, 255, 255, 0.05)" - backdropFilter="blur(10px)" + backdropFilter={GLASS_BLUR.sm} border="1px solid" borderColor="rgba(255, 255, 255, 0.1)" color="white" diff --git a/src/views/AgentChat/components/MeetingRoom/index.js b/src/views/AgentChat/components/MeetingRoom/index.js index 31755a90..4736e8be 100644 --- a/src/views/AgentChat/components/MeetingRoom/index.js +++ b/src/views/AgentChat/components/MeetingRoom/index.js @@ -35,6 +35,7 @@ import { useInvestmentMeeting } from '../../hooks/useInvestmentMeeting'; import MeetingMessageBubble from './MeetingMessageBubble'; import MeetingRolePanel from './MeetingRolePanel'; import MeetingWelcome from './MeetingWelcome'; +import { GLASS_BLUR } from '@/constants/glassConfig'; /** * MeetingRoom - 投研会议室主组件 @@ -151,7 +152,7 @@ const MeetingRoom = ({ user, onToast }) => { {/* 顶部标题栏 */} { {/* 输入栏 */} = ({ selectedTools, onToolsChang borderRadius="lg" mb={2} bg="rgba(255, 255, 255, 0.05)" - backdropFilter="blur(12px)" + backdropFilter={GLASS_BLUR.md} _hover={{ bg: 'rgba(255, 255, 255, 0.08)', borderColor: 'rgba(255, 255, 255, 0.2)', diff --git a/src/views/AgentChat/components/RightSidebar/index.js b/src/views/AgentChat/components/RightSidebar/index.js index 0760af0a..1bab0e70 100644 --- a/src/views/AgentChat/components/RightSidebar/index.js +++ b/src/views/AgentChat/components/RightSidebar/index.js @@ -41,6 +41,7 @@ import { import { animations } from '../../constants/animations'; import { AVAILABLE_MODELS } from '../../constants/models'; import { MCP_TOOLS, TOOL_CATEGORIES } from '../../constants/tools'; +import { GLASS_BLUR } from '@/constants/glassConfig'; /** * RightSidebar - 右侧栏组件(配置中心) @@ -82,7 +83,7 @@ const RightSidebar = ({ display="flex" flexDirection="column" bg="rgba(17, 24, 39, 0.8)" - backdropFilter="blur(20px) saturate(180%)" + backdropFilter={`${GLASS_BLUR.lg} saturate(180%)`} borderLeft="1px solid" borderColor="rgba(255, 255, 255, 0.1)" boxShadow="-4px 0 24px rgba(0, 0, 0, 0.3)" @@ -110,7 +111,7 @@ const RightSidebar = ({ onClick={onClose} bg="rgba(255, 255, 255, 0.05)" color="gray.300" - backdropFilter="blur(10px)" + backdropFilter={GLASS_BLUR.sm} border="1px solid" borderColor="rgba(255, 255, 255, 0.1)" _hover={{ @@ -203,7 +204,7 @@ const RightSidebar = ({ ? 'rgba(139, 92, 246, 0.15)' : 'rgba(255, 255, 255, 0.05)' } - backdropFilter="blur(12px)" + backdropFilter={GLASS_BLUR.md} borderWidth={2} borderColor={ selectedModel === model.id ? 'purple.400' : 'rgba(255, 255, 255, 0.1)' @@ -277,7 +278,7 @@ const RightSidebar = ({ borderRadius="lg" mb={2} bg="rgba(255, 255, 255, 0.05)" - backdropFilter="blur(12px)" + backdropFilter={GLASS_BLUR.md} _hover={{ bg: 'rgba(255, 255, 255, 0.08)', borderColor: 'rgba(255, 255, 255, 0.2)', @@ -389,7 +390,7 @@ const RightSidebar = ({ > { spacing={6} p={10} bg="rgba(17, 24, 39, 0.8)" - backdropFilter="blur(20px)" + backdropFilter={GLASS_BLUR.lg} borderRadius="2xl" border="1px solid" borderColor="rgba(255, 255, 255, 0.1)"