This commit is contained in:
parent
2d02a2840b
commit
06d18e8901
|
|
@ -7,6 +7,9 @@ import { useRouter } from "next/navigation"
|
|||
import { FC, useContext, useRef, useState } from "react"
|
||||
import { SidebarUpdateItem } from "./sidebar-update-item"
|
||||
|
||||
import { usePathname } from "next/navigation"
|
||||
|
||||
|
||||
interface SidebarItemProps {
|
||||
item: DataItemType
|
||||
isTyping: boolean
|
||||
|
|
@ -27,6 +30,11 @@ export const SidebarItem: FC<SidebarItemProps> = ({
|
|||
const { selectedWorkspace, setChats, setSelectedAssistant } =
|
||||
useContext(ChatbotUIContext)
|
||||
|
||||
const pathname = usePathname() // 获取当前路径
|
||||
|
||||
// 提取当前路径中的 locale 部分
|
||||
const locale = pathname.split("/")[1] || "en"
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const itemRef = useRef<HTMLDivElement>(null)
|
||||
|
|
@ -60,7 +68,7 @@ export const SidebarItem: FC<SidebarItemProps> = ({
|
|||
setChats(prevState => [createdChat, ...prevState])
|
||||
setSelectedAssistant(assistant)
|
||||
|
||||
return router.push(`/${selectedWorkspace.id}/chat/${createdChat.id}`)
|
||||
return router.push(`/${locale}/${selectedWorkspace.id}/chat/${createdChat.id}`)
|
||||
},
|
||||
tools: async (item: any) => {},
|
||||
models: async (item: any) => {}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ export const SidebarSwitchItem: FC<SidebarSwitchItemProps> = ({
|
|||
return (
|
||||
<WithTooltip
|
||||
display={
|
||||
<div>{contentType[0].toUpperCase() + contentType.substring(1)}</div>
|
||||
// <div>{contentType[0].toUpperCase() + contentType.substring(1)}</div>
|
||||
{<div>{t(`contentType.${contentType}`)}</div>}
|
||||
}
|
||||
trigger={
|
||||
<TabsTrigger
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import { FC, useState } from "react"
|
|||
import { useSelectFileHandler } from "../chat/chat-hooks/use-select-file-handler"
|
||||
import { CommandK } from "../utility/command-k"
|
||||
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
export const SIDEBAR_WIDTH = 350
|
||||
|
||||
interface DashboardProps {
|
||||
|
|
@ -20,6 +22,9 @@ interface DashboardProps {
|
|||
}
|
||||
|
||||
export const Dashboard: FC<DashboardProps> = ({ children }) => {
|
||||
|
||||
const { t } = useTranslation()
|
||||
|
||||
useHotkey("s", () => setShowSidebar(prevState => !prevState))
|
||||
|
||||
const pathname = usePathname()
|
||||
|
|
@ -107,7 +112,7 @@ export const Dashboard: FC<DashboardProps> = ({ children }) => {
|
|||
>
|
||||
{isDragging ? (
|
||||
<div className="flex h-full items-center justify-center bg-black/50 text-2xl text-white">
|
||||
drop file here
|
||||
{t("side.dropFileHere")}
|
||||
</div>
|
||||
) : (
|
||||
children
|
||||
|
|
|
|||
|
|
@ -202,7 +202,8 @@
|
|||
"toolNamePlaceholder": "Tool name...",
|
||||
"toolDescriptionPlaceholder": "Tool description...",
|
||||
"customHeadersLabel": "Custom Headers",
|
||||
"schemaLabel": "Schema"
|
||||
"schemaLabel": "Schema",
|
||||
"dropFileHere": "Drop file here"
|
||||
},
|
||||
|
||||
"contentType": {
|
||||
|
|
|
|||
|
|
@ -201,7 +201,8 @@
|
|||
"toolNamePlaceholder": "ツール名...",
|
||||
"toolDescriptionPlaceholder": "ツールの説明...",
|
||||
"customHeadersLabel": "カスタムヘッダー",
|
||||
"schemaLabel": "スキーマ"
|
||||
"schemaLabel": "スキーマ",
|
||||
"dropFileHere": "ここにファイルをドロップ"
|
||||
},
|
||||
|
||||
"contentType": {
|
||||
|
|
|
|||
|
|
@ -201,7 +201,8 @@
|
|||
"toolNamePlaceholder": "工具名称...",
|
||||
"toolDescriptionPlaceholder": "工具描述...",
|
||||
"customHeadersLabel": "自定义请求头",
|
||||
"schemaLabel": "Schema"
|
||||
"schemaLabel": "Schema",
|
||||
"dropFileHere": "将文件拖放到此处"
|
||||
},
|
||||
|
||||
"contentType": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue