diff --git a/components/SmartChatBox/InputBar.tsx b/components/SmartChatBox/InputBar.tsx index 5ff55b4..ecea67d 100644 --- a/components/SmartChatBox/InputBar.tsx +++ b/components/SmartChatBox/InputBar.tsx @@ -4,6 +4,8 @@ import { MessageBlock } from "./types"; import { useUploadFile } from "@/app/service/domain/service"; import { motion, AnimatePresence } from "framer-motion"; import { QuickActionTags, QuickAction } from "./QuickActionTags"; +import { useDeviceType } from '@/hooks/useDeviceType'; + // 防抖函数 function debounce void>(func: T, wait: number) { @@ -35,6 +37,7 @@ export function InputBar({ onSend, setVideoPreview, initialVideoUrl, initialVide const [videoUrl, setVideoUrl] = useState(initialVideoUrl || null); const [videoId, setVideoId] = useState(initialVideoId || null); const [isMultiline, setIsMultiline] = useState(false); +const { isMobile, isTablet, isDesktop } = useDeviceType(); const textareaRef = useRef(null); const { uploadFile } = useUploadFile(); @@ -174,7 +177,7 @@ export function InputBar({ onSend, setVideoPreview, initialVideoUrl, initialVide }; return ( -
+
{/* 媒体预览 */}
{/* 图片预览 */} diff --git a/components/SmartChatBox/MessageRenderer.tsx b/components/SmartChatBox/MessageRenderer.tsx index cd99578..84a1715 100644 --- a/components/SmartChatBox/MessageRenderer.tsx +++ b/components/SmartChatBox/MessageRenderer.tsx @@ -5,6 +5,7 @@ import { bubbleVariants, hhmm } from "./utils"; import { ProgressBar } from "./ProgressBar"; import { Loader2, AlertCircle, CheckCircle2 } from "lucide-react"; import { Image } from 'antd'; +import { useDeviceType } from '@/hooks/useDeviceType'; interface MessageRendererProps { msg: ChatMessage; @@ -15,6 +16,7 @@ export function MessageRenderer({ msg, sendMessage }: MessageRendererProps) { // Decide bubble style const isUser = msg.role === "user"; const isSystem = msg.role === "system"; + const { isMobile, isTablet, isDesktop } = useDeviceType(); const bubbleClass = useMemo(() => { if (isSystem) return "bg-[#281c1459] text-white"; @@ -78,7 +80,7 @@ export function MessageRenderer({ msg, sendMessage }: MessageRendererProps) { data-alt="message-bubble" key={msg.id} > -
+
{/* Header */} {/*
{badge} diff --git a/components/SmartChatBox/SmartChatBox.tsx b/components/SmartChatBox/SmartChatBox.tsx index a8ec19e..7ba47fe 100644 --- a/components/SmartChatBox/SmartChatBox.tsx +++ b/components/SmartChatBox/SmartChatBox.tsx @@ -7,6 +7,7 @@ import { useMessages } from "./useMessages"; import { DateDivider } from "./DateDivider"; import { LoadMoreButton } from "./LoadMoreButton"; import { ChatMessage } from "./types"; +import { useDeviceType } from '@/hooks/useDeviceType'; interface SmartChatBoxProps { isSmartChatBoxOpen: boolean; @@ -51,7 +52,7 @@ export default function SmartChatBox({ // 消息列表引用 const listRef = useRef(null); const [isAtBottom, setIsAtBottom] = useState(true); - + const { isMobile, isTablet, isDesktop } = useDeviceType(); // 检查是否滚动到底部 const checkIfAtBottom = useCallback(() => { if (listRef.current) { @@ -148,18 +149,18 @@ export default function SmartChatBox({ }, [messages]); return ( -
+
{/* Header */} -
+
Chat {/* System push toggle */}
diff --git a/components/pages/work-flow.tsx b/components/pages/work-flow.tsx index 6c2ecb9..8f66dc7 100644 --- a/components/pages/work-flow.tsx +++ b/components/pages/work-flow.tsx @@ -235,6 +235,11 @@ const WorkFlow = React.memo(function WorkFlow() { toggleVideoPlay, } = usePlaybackControls(taskObject.videos.data, taskObject.currentStage); + useEffect(() => { + if (isMobile) { + setIsSmartChatBoxOpen(false); + } + }, [isMobile]); useEffect(() => { console.log('changedIndex_work-flow', currentSketchIndex, taskObject); }, [currentSketchIndex, taskObject]); @@ -613,6 +618,14 @@ Please process this video editing request.`;
+ {isMobile ? ( + setIsSmartChatBoxOpen(true)} + className="backdrop-blur-lg" + /> + ) : ( + )}
{/* 智能对话弹窗 */} setIsSmartChatBoxOpen(false)} >