diff --git a/src/interface/web/app/chat/page.tsx b/src/interface/web/app/chat/page.tsx index 3294adb8..7a508b7d 100644 --- a/src/interface/web/app/chat/page.tsx +++ b/src/interface/web/app/chat/page.tsx @@ -19,7 +19,7 @@ import { Label } from "@/components/ui/label" import { Textarea } from "@/components/ui/textarea" import { Button } from '@/components/ui/button'; -export function TextareaWithLabel() { +function TextareaWithLabel() { return (
{/* */} @@ -36,7 +36,7 @@ const styleClassOptions = ['pink', 'blue', 'green', 'yellow', 'purple']; interface ChatBodyDataProps { chatOptionsData: ChatOptions | null; setTitle: (title: string) => void; - setConversationID?: (conversationId: string) => void; + onConversationIdChange?: (conversationId: string) => void; } @@ -44,9 +44,11 @@ function ChatBodyData(props: ChatBodyDataProps) { const searchParams = useSearchParams(); const conversationId = searchParams.get('conversationId'); - if (conversationId && props.setConversationID) { - props.setConversationID(conversationId); - } + useEffect(() => { + if (conversationId) { + props.onConversationIdChange?.(conversationId); + } + }, [conversationId, props.onConversationIdChange]); if (!conversationId) { return ( @@ -65,9 +67,25 @@ function ChatBodyData(props: ChatBodyDataProps) { } return ( -
- -
+ <> +
+ +
+
+ + + + + {/* handleChatInput(e)} /> */} + {/* */} +
+ ); } @@ -110,6 +128,10 @@ export default function Chat() { })(); }, [conversationId]); + const handleConversationIdChange = (newConversationId: string) => { + setConversationID(newConversationId); + }; + if (isLoading) { return ; @@ -118,42 +140,23 @@ export default function Chat() { return (
-
- -
- Khoj AI - Chat + {title} -
- -
-
- }> - - -
- {/* */} -
- - - - - {/* handleChatInput(e)} /> */} - {/* */} + }> +
+ +
+
+ +
+
-
+
) } diff --git a/src/interface/web/app/components/sidePanel/chatHistorySidePanel.tsx b/src/interface/web/app/components/sidePanel/chatHistorySidePanel.tsx index 3959ce45..5c844738 100644 --- a/src/interface/web/app/components/sidePanel/chatHistorySidePanel.tsx +++ b/src/interface/web/app/components/sidePanel/chatHistorySidePanel.tsx @@ -151,6 +151,9 @@ interface ChatSessionsModalProps { data: GroupedChatHistory | null; } + +// function ConversationList() + function ChatSessionsModal({ data }: ChatSessionsModalProps) { return ( @@ -188,6 +191,49 @@ function ChatSessionsModal({ data }: ChatSessionsModalProps) { ); } +interface UserProfileProps { + userProfile: UserProfile; + webSocketConnected?: boolean; + collapsed: boolean; +} + +function UserProfileComponent(props: UserProfileProps) { + if (props.collapsed) { + return ( +
+ + + + {props.userProfile.username[0]} + + +
+ ); + } + + return ( +
+ + + + {props.userProfile.username[0]} + + +
+

{props.userProfile?.username}

+ {/* Connected Indicator */} +
+
+

+ {props.webSocketConnected ? "Connected" : "Disconnected"} +

+
+
+
+ ); + +} + const fetchChatHistory = async (url: string) => { const response = await fetch(url, { method: 'GET', @@ -303,38 +349,14 @@ export default function SidePanel(props: SidePanelProps) { ) } {userProfile && -
- - - - {userProfile.username[0]} - - -
-

{userProfile?.username}

- {/* Connected Indicator */} -
-
-

- {props.webSocketConnected ? "Connected" : "Disconnected"} -

-
-
-
+ }
:
- {userProfile && -
- - - - {userProfile.username[0]} - - -
+ { userProfile && + }