22
33import { useState , useRef , useEffect } from "react" ;
44import { useTranslation } from "react-i18next" ;
5- import { Dropdown , Badge , Modal , Button } from "antd" ;
6- import { DownOutlined } from "@ant-design/icons" ;
5+ import { Modal , Button } from "antd" ;
76import { WarningFilled } from "@ant-design/icons" ;
8- import { BrainCircuit , Globe } from "lucide-react" ;
97
10- import { Button as ButtonUI } from "@/components/ui/button" ;
118import { Input } from "@/components/ui/input" ;
12- import { languageOptions } from "@/const/constants" ;
13- import { useLanguageSwitch } from "@/lib/language" ;
14- import { useMemoryIndicator } from "@/hooks/useMemory" ;
159import { loadMemoryConfig , setMemorySwitch } from "@/services/memoryService" ;
1610import { configStore } from "@/lib/config" ;
1711import log from "@/lib/logger" ;
@@ -21,18 +15,6 @@ import { USER_ROLES } from "@/const/modelConfig";
2115
2216import MemoryManageModal from "../internal/memory/memoryManageModal" ;
2317
24- // Gradient definition for BrainCircuit icon
25- const GradientDefs = ( ) => (
26- < svg width = "0" height = "0" className = "absolute" >
27- < defs >
28- < linearGradient id = "brainCogGradient" x1 = "0" y1 = "0" x2 = "1" y2 = "1" >
29- < stop offset = "0%" stopColor = "#3b82f6" />
30- < stop offset = "100%" stopColor = "#9333ea" />
31- </ linearGradient >
32- </ defs >
33- </ svg >
34- ) ;
35-
3618interface ChatHeaderProps {
3719 title : string ;
3820 onRename ?: ( newTitle : string ) => void ;
@@ -46,15 +28,13 @@ export function ChatHeader({ title, onRename }: ChatHeaderProps) {
4628 const [ embeddingConfigured , setEmbeddingConfigured ] = useState < boolean > ( true ) ;
4729 const [ showConfigPrompt , setShowConfigPrompt ] = useState ( false ) ;
4830 const [ showAutoOffPrompt , setShowAutoOffPrompt ] = useState ( false ) ;
49- const hasNewMemory = useMemoryIndicator ( memoryModalVisible ) ;
5031 const inputRef = useRef < HTMLInputElement > ( null ) ;
51- const { t } = useTranslation ( "common" ) ;
52- const { currentLanguage, handleLanguageChange } = useLanguageSwitch ( ) ;
32+ const { t, i18n } = useTranslation ( "common" ) ;
5333 const { user, isSpeedMode } = useAuth ( ) ;
5434 const isAdmin = isSpeedMode || user ?. role === USER_ROLES . ADMIN ;
5535
5636 const goToModelSetup = ( ) => {
57- router . push ( `/${ currentLanguage } /setup/models` ) ;
37+ router . push ( `/${ i18n . language } /setup/models` ) ;
5838 } ;
5939
6040 // Update editTitle when the title attribute changes
@@ -131,7 +111,6 @@ export function ChatHeader({ title, onRename }: ChatHeaderProps) {
131111
132112 return (
133113 < >
134- < GradientDefs />
135114 < header className = "border-b border-transparent bg-background z-10" >
136115 < div className = "p-3 pb-1" >
137116 < div className = "relative flex flex-1" >
@@ -164,47 +143,7 @@ export function ChatHeader({ title, onRename }: ChatHeaderProps) {
164143 </ div >
165144
166145 < div className = "absolute right-0 top-1/2 transform -translate-y-1/2 flex items-center space-x-1 gap-1" >
167- { /* Language Switch */ }
168- < Dropdown
169- menu = { {
170- items : languageOptions . map ( ( opt ) => ( {
171- key : opt . value ,
172- label : opt . label ,
173- } ) ) ,
174- onClick : ( { key } ) => handleLanguageChange ( key as string ) ,
175- } }
176- >
177- < a className = "ant-dropdown-link text-sm font-medium text-slate-600 hover:text-slate-900 dark:text-slate-300 dark:hover:text-white transition-colors flex items-center gap-2 cursor-pointer w-[100px] border-0 shadow-none bg-transparent text-left" >
178- < Globe className = "h-4 w-4" />
179- { languageOptions . find ( ( o ) => o . value === currentLanguage )
180- ?. label || currentLanguage }
181- < DownOutlined className = "text-[10px]" />
182- </ a >
183- </ Dropdown >
184- { /* Memory Setting */ }
185- < Badge dot = { embeddingConfigured && hasNewMemory } offset = { [ - 4 , 4 ] } >
186- < ButtonUI
187- variant = "ghost"
188- className = { `mr-4 rounded-full px-2 py-1 h-7 flex items-center gap-2 hover:bg-slate-100 dark:hover:bg-slate-800 ${
189- ! embeddingConfigured ? "opacity-50" : ""
190- } `}
191- onClick = { ( ) => {
192- if ( ! embeddingConfigured ) {
193- setShowConfigPrompt ( true ) ;
194- return ;
195- }
196- setMemoryModalVisible ( true ) ;
197- } }
198- >
199- < BrainCircuit
200- className = "size-5"
201- stroke = "url(#brainCogGradient)"
202- />
203- < span className = "text-sm font-medium text-slate-600 dark:text-slate-300" >
204- { t ( "memoryManageModal.title" ) }
205- </ span >
206- </ ButtonUI >
207- </ Badge >
146+ { /* Right side controls - now handled by navigation bar */ }
208147 </ div >
209148 </ div >
210149 </ div >
0 commit comments