This commit is contained in:
hailin 2025-04-22 20:05:44 +08:00
parent a63d9afd66
commit 38e095d61b
1 changed files with 9 additions and 6 deletions

View File

@ -188,18 +188,21 @@ export const useChatHandler = () => {
const pathSegments = pathname.split("/").filter(Boolean)
const locales = i18nConfig.locales
const defaultLocale = i18nConfig.defaultLocale
let locale: (typeof locales)[number] = defaultLocale
const segment = pathSegments[0] as (typeof locales)[number]
if (locales.includes(segment)) {
locale = segment
}
const homePath = locale === defaultLocale ? "/" : `${locale}`
// ✅ 正确构造 localePrefix不包含前导 /
const localePrefix = locale === defaultLocale ? "" : `/${locale}`
console.log("[use-chat-handler.tsx]...........localePrefix", localePrefix)
console.log("[use-chat-handler.tsx]...........homePath",homePath)
return router.push(`/${homePath}/${selectedWorkspace.id}/chat`)
console.log("[use-chat-handler.tsx]...........homePath",localePrefix)
return router.push(`${localePrefix}/${selectedWorkspace.id}/chat`)
// return router.push(`/${locale}/${selectedWorkspace.id}/chat`)
}