mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-07 18:14:22 +01:00
🌡️ feat: Periodic Health Check to prevent UI Inactivity Connection Errors (#3589)
* 🌡️ feat: Periodic Health Check to prevent UI Inactivity Connection Errors
* feat: Add refetchOnWindowFocus option for health check
* feat: programmatically scroll to end when a chat request is initiated (and messages have rendered)
This commit is contained in:
parent
cf393b1308
commit
6ea2628b56
12 changed files with 81 additions and 14 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { useEffect, useRef } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { EModelEndpoint } from 'librechat-data-provider';
|
||||
import { Constants, EModelEndpoint } from 'librechat-data-provider';
|
||||
import {
|
||||
useGetModelsQuery,
|
||||
useGetStartupConfig,
|
||||
|
|
@ -8,14 +8,15 @@ import {
|
|||
} from 'librechat-data-provider/react-query';
|
||||
import type { TPreset } from 'librechat-data-provider';
|
||||
import { useNewConvo, useAppStartup, useAssistantListMap } from '~/hooks';
|
||||
import { useGetConvoIdQuery, useHealthCheck } from '~/data-provider';
|
||||
import { getDefaultModelSpec, getModelSpecIconURL } from '~/utils';
|
||||
import { useGetConvoIdQuery } from '~/data-provider';
|
||||
import ChatView from '~/components/Chat/ChatView';
|
||||
import useAuthRedirect from './useAuthRedirect';
|
||||
import { Spinner } from '~/components/svg';
|
||||
import store from '~/store';
|
||||
|
||||
export default function ChatRoute() {
|
||||
useHealthCheck();
|
||||
const { data: startupConfig } = useGetStartupConfig();
|
||||
const { isAuthenticated, user } = useAuthRedirect();
|
||||
useAppStartup({ startupConfig, user });
|
||||
|
|
@ -32,7 +33,7 @@ export default function ChatRoute() {
|
|||
refetchOnMount: 'always',
|
||||
});
|
||||
const initialConvoQuery = useGetConvoIdQuery(conversationId ?? '', {
|
||||
enabled: isAuthenticated && conversationId !== 'new',
|
||||
enabled: isAuthenticated && conversationId !== Constants.NEW_CONVO,
|
||||
});
|
||||
const endpointsQuery = useGetEndpointsQuery({ enabled: isAuthenticated });
|
||||
const assistantListMap = useAssistantListMap();
|
||||
|
|
@ -45,7 +46,7 @@ export default function ChatRoute() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (conversationId === 'new' && endpointsQuery.data && modelsQuery.data) {
|
||||
if (conversationId === Constants.NEW_CONVO && endpointsQuery.data && modelsQuery.data) {
|
||||
const spec = getDefaultModelSpec(startupConfig.modelSpecs?.list);
|
||||
|
||||
newConversation({
|
||||
|
|
@ -73,7 +74,7 @@ export default function ChatRoute() {
|
|||
});
|
||||
hasSetConversation.current = true;
|
||||
} else if (
|
||||
conversationId === 'new' &&
|
||||
conversationId === Constants.NEW_CONVO &&
|
||||
assistantListMap[EModelEndpoint.assistants] &&
|
||||
assistantListMap[EModelEndpoint.azureAssistants]
|
||||
) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue