2025-08-21 14:08:07 +08:00
|
|
|
import React, { useContext } from "react"
|
2025-08-19 16:20:37 +08:00
|
|
|
import { HistoryContext } from "@/components/Layouts/Layout.tsx"
|
2025-08-21 14:08:07 +08:00
|
|
|
import { PanelLeftIcon } from "lucide-react"
|
|
|
|
|
import { Button } from "antd"
|
|
|
|
|
import { PlusOutlined } from "@ant-design/icons"
|
|
|
|
|
import { useMessageOption } from "@/hooks/useMessageOption.tsx"
|
|
|
|
|
import { useTranslation } from "react-i18next"
|
2024-05-31 13:50:05 +05:30
|
|
|
|
2025-08-21 14:08:07 +08:00
|
|
|
export const Header = () => {
|
|
|
|
|
const { show, setShow } = useContext(HistoryContext)
|
2024-05-31 13:50:05 +05:30
|
|
|
|
2025-08-21 14:08:07 +08:00
|
|
|
const { t } = useTranslation(["option", "common", "settings"])
|
2024-05-31 13:50:05 +05:30
|
|
|
|
2025-08-21 14:08:07 +08:00
|
|
|
const { clearChat } = useMessageOption()
|
2024-05-31 13:50:05 +05:30
|
|
|
return (
|
2024-11-16 15:50:11 +05:30
|
|
|
<div
|
2025-08-21 14:08:07 +08:00
|
|
|
className={`w-full h-[60px] absolute inset-0 pl-5 z-10 flex items-center transition-all duration-300 ease-in-out ${show ? "left-[300px]" : ""}`}>
|
|
|
|
|
{/*控制侧边栏显示隐藏与新建对话*/}
|
|
|
|
|
{!show && (
|
|
|
|
|
<div className="flex items-center gap-3">
|
2024-05-31 13:50:05 +05:30
|
|
|
<button
|
|
|
|
|
className="text-gray-500 dark:text-gray-400"
|
2025-08-21 14:08:07 +08:00
|
|
|
onClick={() => {
|
|
|
|
|
setShow(!show)
|
|
|
|
|
}}>
|
2024-05-31 13:50:05 +05:30
|
|
|
<PanelLeftIcon className="w-6 h-6" />
|
|
|
|
|
</button>
|
2025-08-21 14:08:07 +08:00
|
|
|
<Button
|
|
|
|
|
color="cyan"
|
|
|
|
|
variant="filled"
|
|
|
|
|
shape="round"
|
|
|
|
|
style={{
|
|
|
|
|
color: "#0057ff",
|
|
|
|
|
background: "#0057ff0f",
|
|
|
|
|
border: "1px solid #0066ff26"
|
2025-01-25 15:19:28 +05:30
|
|
|
}}
|
2025-08-21 14:08:07 +08:00
|
|
|
onClick={clearChat}>
|
|
|
|
|
<div className="flex items-center justify-between w-full">
|
|
|
|
|
<div className="flex items-center">
|
|
|
|
|
<PlusOutlined
|
|
|
|
|
className="text-sm"
|
|
|
|
|
style={{ fontSize: "16px", fontWeight: 500 }}
|
|
|
|
|
/>
|
|
|
|
|
<span>{t("newChat")}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Button>
|
2024-05-31 13:50:05 +05:30
|
|
|
</div>
|
2025-08-21 14:08:07 +08:00
|
|
|
)}
|
|
|
|
|
{/* 项目标题 */}
|
|
|
|
|
<div
|
|
|
|
|
className={`
|
|
|
|
|
absolute left-1/2 transform -translate-x-1/2
|
|
|
|
|
w-[600px] h-[55px] bg-white dark:bg-black
|
|
|
|
|
flex items-center justify-center
|
|
|
|
|
shadow-[0px_0px_5px_rgba(0,0,0,0.2)]
|
|
|
|
|
rounded-b-[15px]
|
|
|
|
|
transition-[top]
|
|
|
|
|
${show ? "-top-[56px]" : "-top-[1px] delay-200"}
|
|
|
|
|
`}>
|
|
|
|
|
<h2 className="text-xl font-bold text-zinc-700 dark:text-zinc-300 mr-3">
|
|
|
|
|
<span className="text-[#d30100]">数联网</span>科创智能体
|
|
|
|
|
</h2>
|
2024-05-31 13:50:05 +05:30
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|