mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
📕 fix: Update document Title based on appTitle and on "New Chat" (#1553)
This commit is contained in:
parent
0f49642758
commit
dfe45f80c6
2 changed files with 14 additions and 0 deletions
|
|
@ -92,6 +92,10 @@ const useNewConvo = (index = 0) => {
|
|||
}
|
||||
|
||||
if (conversation.conversationId === 'new' && !modelsData) {
|
||||
const appTitle = localStorage.getItem('appTitle');
|
||||
if (appTitle) {
|
||||
document.title = appTitle;
|
||||
}
|
||||
navigate('new');
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { useParams } from 'react-router-dom';
|
|||
import {
|
||||
useGetConvoIdQuery,
|
||||
useGetModelsQuery,
|
||||
useGetStartupConfig,
|
||||
useGetEndpointsQuery,
|
||||
} from 'librechat-data-provider/react-query';
|
||||
import type { TPreset } from 'librechat-data-provider';
|
||||
|
|
@ -18,6 +19,8 @@ export default function ChatRoute() {
|
|||
|
||||
useConfigOverride();
|
||||
const { conversationId } = useParams();
|
||||
const { data: startupConfig } = useGetStartupConfig();
|
||||
|
||||
const { conversation } = store.useCreateConversationAtom(index);
|
||||
const modelsQueryEnabled = useRecoilValue(store.modelsQueryEnabled);
|
||||
const { isAuthenticated } = useAuthRedirect();
|
||||
|
|
@ -30,6 +33,13 @@ export default function ChatRoute() {
|
|||
});
|
||||
const endpointsQuery = useGetEndpointsQuery({ enabled: isAuthenticated && modelsQueryEnabled });
|
||||
|
||||
useEffect(() => {
|
||||
if (startupConfig?.appTitle) {
|
||||
document.title = startupConfig.appTitle;
|
||||
localStorage.setItem('appTitle', startupConfig.appTitle);
|
||||
}
|
||||
}, [startupConfig]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
conversationId === 'new' &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue