This commit is contained in:
parent
5f099b3a60
commit
a76497c110
|
|
@ -11,6 +11,9 @@ import { ChatMessage, ChatPayload, LLMID, ModelProvider } from "@/types"
|
||||||
import { useRouter } from "next/navigation"
|
import { useRouter } from "next/navigation"
|
||||||
import { useContext, useEffect, useRef } from "react"
|
import { useContext, useEffect, useRef } from "react"
|
||||||
import { LLM_LIST } from "../../../lib/models/llm/llm-list"
|
import { LLM_LIST } from "../../../lib/models/llm/llm-list"
|
||||||
|
|
||||||
|
import i18nConfig from "@/i18nConfig"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createTempMessages,
|
createTempMessages,
|
||||||
handleCreateChat,
|
handleCreateChat,
|
||||||
|
|
@ -181,7 +184,23 @@ export const useChatHandler = () => {
|
||||||
// })
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
return router.push(`/${locale}/${selectedWorkspace.id}/chat`)
|
|
||||||
|
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}`
|
||||||
|
|
||||||
|
return router.push(`/${homePath}/${selectedWorkspace.id}/chat`)
|
||||||
|
|
||||||
|
// return router.push(`/${locale}/${selectedWorkspace.id}/chat`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFocusChatInput = () => {
|
const handleFocusChatInput = () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue