2
2
3
3
import { redirect , useRouter , useSearchParams } from "next/navigation" ;
4
4
import { ChatSession , ChatSessionSharedStatus , Message } from "../interfaces" ;
5
-
6
5
import { HealthCheckBanner } from "@/components/health/healthcheck" ;
7
6
import { personaIncludesRetrieval , useScrollonStream } from "../services/lib" ;
8
7
import { useCallback , useEffect , useMemo , useRef , useState } from "react" ;
@@ -31,11 +30,9 @@ import TextView from "@/components/chat/TextView";
31
30
import { Modal } from "@/components/Modal" ;
32
31
import { useSendMessageToParent } from "@/lib/extension/utils" ;
33
32
import { SUBMIT_MESSAGE_TYPES } from "@/lib/extension/constants" ;
34
-
35
33
import { getSourceMetadata } from "@/lib/sources" ;
36
34
import { UserSettingsModal } from "./modal/UserSettingsModal" ;
37
35
import { FilePickerModal } from "../my-documents/components/FilePicker" ;
38
-
39
36
import { SourceMetadata } from "@/lib/search/interfaces" ;
40
37
import { FederatedConnectorDetail , ValidSources } from "@/lib/types" ;
41
38
import { useDocumentsContext } from "../my-documents/DocumentsContext" ;
@@ -65,7 +62,6 @@ import {
65
62
useHasSentLocalUserMessage ,
66
63
} from "../stores/useChatSessionStore" ;
67
64
import { FederatedOAuthModal } from "@/components/chat/FederatedOAuthModal" ;
68
- import { AssistantIcon } from "@/components/assistants/AssistantIcon" ;
69
65
import { StarterMessageDisplay } from "./starterMessages/StarterMessageDisplay" ;
70
66
import { MessagesDisplay } from "./MessagesDisplay" ;
71
67
import { WelcomeMessage } from "./WelcomeMessage" ;
@@ -75,9 +71,7 @@ interface ChatPageProps {
75
71
firstMessage ?: string ;
76
72
}
77
73
78
- export function ChatPage ( {
79
- firstMessage,
80
- } : ChatPageProps ) {
74
+ export function ChatPage ( { firstMessage } : ChatPageProps ) {
81
75
// Performance tracking
82
76
// Keeping this here in case we need to track down slow renders in the future
83
77
// const renderCount = useRef(0);
@@ -411,7 +405,9 @@ export function ChatPage({
411
405
412
406
// Access chat state directly from the store
413
407
const currentChatState = useCurrentChatState ( ) ;
414
- const chatSessionId = useChatSessionStore ( ( state ) => state . currentSessionId ) ;
408
+ const chatSessionId = useChatSessionStore (
409
+ ( state : any ) => state . currentSessionId
410
+ ) ;
415
411
const submittedMessage = useSubmittedMessage ( ) ;
416
412
const loadingError = useLoadingError ( ) ;
417
413
const uncaughtError = useUncaughtError ( ) ;
@@ -425,13 +421,13 @@ export function ChatPage({
425
421
const documentSidebarVisible = useDocumentSidebarVisible ( ) ;
426
422
const chatSessionSharedStatus = useChatSessionSharedStatus ( ) ;
427
423
const updateHasPerformedInitialScroll = useChatSessionStore (
428
- ( state ) => state . updateHasPerformedInitialScroll
424
+ ( state : any ) => state . updateHasPerformedInitialScroll
429
425
) ;
430
426
const updateCurrentDocumentSidebarVisible = useChatSessionStore (
431
- ( state ) => state . updateCurrentDocumentSidebarVisible
427
+ ( state : any ) => state . updateCurrentDocumentSidebarVisible
432
428
) ;
433
429
const updateCurrentChatSessionSharedStatus = useChatSessionStore (
434
- ( state ) => state . updateCurrentChatSessionSharedStatus
430
+ ( state : any ) => state . updateCurrentChatSessionSharedStatus
435
431
) ;
436
432
437
433
const clientScrollToBottom = useCallback (
@@ -913,12 +909,13 @@ export function ChatPage({
913
909
/>
914
910
</ div >
915
911
916
- < dv
912
+ < div
917
913
ref = { inputRef }
918
- className = { `absolute pointer-events-none z-10 w-full ${ showCenteredInput
914
+ className = { `absolute pointer-events-none z-10 w-full ${
915
+ showCenteredInput
919
916
? "inset-0"
920
917
: "bottom-0 left-0 right-0 translate-y-0"
921
- } `}
918
+ } `}
922
919
>
923
920
{ ! showCenteredInput && aboveHorizon && (
924
921
< div className = "mx-auto w-fit !pointer-events-none flex sticky justify-center" >
@@ -932,10 +929,11 @@ export function ChatPage({
932
929
) }
933
930
934
931
< div
935
- className = { `pointer-events-auto w-[95%] mx-auto relative text-text-600 ${ showCenteredInput
932
+ className = { `pointer-events-auto w-[95%] mx-auto relative text-text-600 ${
933
+ showCenteredInput
936
934
? "h-full grid grid-rows-[0.85fr_auto_1.15fr]"
937
935
: "mb-8"
938
- } `}
936
+ } `}
939
937
>
940
938
{ showCenteredInput && (
941
939
< WelcomeMessage assistant = { liveAssistant } />
@@ -962,9 +960,7 @@ export function ChatPage({
962
960
stopGenerating = { stopGenerating }
963
961
onSubmit = { handleChatInputSubmit }
964
962
chatState = { currentChatState }
965
- selectedAssistant = {
966
- selectedAssistant || liveAssistant
967
- }
963
+ selectedAssistant = { selectedAssistant || liveAssistant }
968
964
handleFileUpload = { handleMessageSpecificFileUpload }
969
965
textAreaRef = { textAreaRef }
970
966
/>
0 commit comments