diff --git a/frontend/src/components/workspace/chats/chat-box.tsx b/frontend/src/components/workspace/chats/chat-box.tsx index d41f756..a57aa52 100644 --- a/frontend/src/components/workspace/chats/chat-box.tsx +++ b/frontend/src/components/workspace/chats/chat-box.tsx @@ -1,4 +1,5 @@ import { FilesIcon, XIcon } from "lucide-react"; +import { usePathname } from "next/navigation"; import { useEffect, useMemo, useRef, useState } from "react"; import type { GroupImperativeHandle } from "react-resizable-panels"; @@ -27,6 +28,7 @@ const ChatBox: React.FC<{ children: React.ReactNode; threadId: string }> = ({ threadId, }) => { const { thread } = useThread(); + const pathname = usePathname(); const threadIdRef = useRef(threadId); const layoutRef = useRef(null); @@ -84,6 +86,10 @@ const ChatBox: React.FC<{ children: React.ReactNode; threadId: string }> = ({ return artifactsOpen; }, [artifactsOpen, artifacts]); + const resizableIdBase = useMemo(() => { + return pathname.replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, ""); + }, [pathname]); + useEffect(() => { if (layoutRef.current) { if (artifactPanelOpen) { @@ -96,6 +102,7 @@ const ChatBox: React.FC<{ children: React.ReactNode; threadId: string }> = ({ return ( = ({ {children}