From 379313dde91450c0c90a0fdc1042b41c9dcdc21b Mon Sep 17 00:00:00 2001 From: hailin Date: Sat, 19 Apr 2025 15:13:20 +0800 Subject: [PATCH] . --- components/chat/chat-hooks/use-chat-handler.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 = () => {