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