diff --git a/components/chat/chat-hooks/use-chat-handler.tsx b/components/chat/chat-hooks/use-chat-handler.tsx index f5ab04a..a48eb9f 100644 --- a/components/chat/chat-hooks/use-chat-handler.tsx +++ b/components/chat/chat-hooks/use-chat-handler.tsx @@ -22,9 +22,15 @@ import { validateChatSettings } from "../chat-helpers" +import { usePathname } from "next/navigation" + export const useChatHandler = () => { + const pathname = usePathname() // 获取当前路径 const router = useRouter() + // 提取当前路径中的 locale 部分 + const locale = pathname.split("/")[1] || "en" + const { userInput, chatFiles, @@ -175,7 +181,7 @@ export const useChatHandler = () => { // }) } - return router.push(`/${selectedWorkspace.id}/chat`) + return router.push(`/${locale}/${selectedWorkspace.id}/chat`) } const handleFocusChatInput = () => {