This commit is contained in:
parent
1a577ec799
commit
50b2aeedcc
|
|
@ -26,10 +26,12 @@ export const ChatItem: FC<ChatItemProps> = ({ chat }) => {
|
||||||
availableOpenRouterModels
|
availableOpenRouterModels
|
||||||
} = useContext(ChatbotUIContext)
|
} = useContext(ChatbotUIContext)
|
||||||
|
|
||||||
const pathname = usePathname() // 获取当前路径
|
const pathSegments = pathname.split("/").filter(Boolean)
|
||||||
|
const locales = i18nConfig.locales
|
||||||
// 提取当前路径中的 locale 部分
|
const defaultLocale = i18nConfig.defaultLocale
|
||||||
const locale = pathname.split("/")[1] || "en"
|
|
||||||
|
const pathLocale = locales.includes(pathSegments[0]) ? pathSegments[0] : null
|
||||||
|
const localePrefix = pathLocale && pathLocale !== defaultLocale ? `/${pathLocale}` : ""
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const params = useParams()
|
const params = useParams()
|
||||||
|
|
@ -39,7 +41,7 @@ export const ChatItem: FC<ChatItemProps> = ({ chat }) => {
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
if (!selectedWorkspace) return
|
if (!selectedWorkspace) return
|
||||||
return router.push(`/{locale}/${selectedWorkspace.id}/chat/${chat.id}`)
|
return router.push(`/${localePrefix}/${selectedWorkspace.id}/chat/${chat.id}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue