mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-07 13:23:15 +00:00
automatically open the side bar when a new chat is created with the default agent.
This commit is contained in:
@@ -49,7 +49,7 @@ interface ChatBodyDataProps {
|
|||||||
setImages: (images: string[]) => void;
|
setImages: (images: string[]) => void;
|
||||||
setTriggeredAbort: (triggeredAbort: boolean) => void;
|
setTriggeredAbort: (triggeredAbort: boolean) => void;
|
||||||
isChatSideBarOpen: boolean;
|
isChatSideBarOpen: boolean;
|
||||||
onChatSideBarOpenChange: (open: boolean) => void;
|
setIsChatSideBarOpen: (open: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ChatBodyData(props: ChatBodyDataProps) {
|
function ChatBodyData(props: ChatBodyDataProps) {
|
||||||
@@ -156,6 +156,7 @@ function ChatBodyData(props: ChatBodyDataProps) {
|
|||||||
incomingMessages={props.streamedMessages}
|
incomingMessages={props.streamedMessages}
|
||||||
setIncomingMessages={props.setStreamedMessages}
|
setIncomingMessages={props.setStreamedMessages}
|
||||||
customClassName={chatHistoryCustomClassName}
|
customClassName={chatHistoryCustomClassName}
|
||||||
|
setIsChatSideBarOpen={props.setIsChatSideBarOpen}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -180,7 +181,7 @@ function ChatBodyData(props: ChatBodyDataProps) {
|
|||||||
<ChatSidebar
|
<ChatSidebar
|
||||||
conversationId={conversationId}
|
conversationId={conversationId}
|
||||||
isOpen={props.isChatSideBarOpen}
|
isOpen={props.isChatSideBarOpen}
|
||||||
onOpenChange={props.onChatSideBarOpenChange}
|
onOpenChange={props.setIsChatSideBarOpen}
|
||||||
isMobileWidth={props.isMobileWidth} />
|
isMobileWidth={props.isMobileWidth} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -478,7 +479,7 @@ export default function Chat() {
|
|||||||
setImages={setImages}
|
setImages={setImages}
|
||||||
setTriggeredAbort={setTriggeredAbort}
|
setTriggeredAbort={setTriggeredAbort}
|
||||||
isChatSideBarOpen={isChatSideBarOpen}
|
isChatSideBarOpen={isChatSideBarOpen}
|
||||||
onChatSideBarOpenChange={setIsChatSideBarOpen}
|
setIsChatSideBarOpen={setIsChatSideBarOpen}
|
||||||
/>
|
/>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ interface ChatHistoryProps {
|
|||||||
publicConversationSlug?: string;
|
publicConversationSlug?: string;
|
||||||
setAgent: (agent: AgentData) => void;
|
setAgent: (agent: AgentData) => void;
|
||||||
customClassName?: string;
|
customClassName?: string;
|
||||||
|
setIsChatSideBarOpen?: (isOpen: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface TrainOfThoughtComponentProps {
|
interface TrainOfThoughtComponentProps {
|
||||||
@@ -149,6 +150,7 @@ export default function ChatHistory(props: ChatHistoryProps) {
|
|||||||
latestUserMessageRef.current?.scrollIntoView({ behavior: "auto", block: "start" });
|
latestUserMessageRef.current?.scrollIntoView({ behavior: "auto", block: "start" });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [data, currentPage]);
|
}, [data, currentPage]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -251,6 +253,9 @@ export default function ChatHistory(props: ChatHistoryProps) {
|
|||||||
};
|
};
|
||||||
props.setAgent(chatData.response.agent);
|
props.setAgent(chatData.response.agent);
|
||||||
setData(chatMetadata);
|
setData(chatMetadata);
|
||||||
|
if (props.setIsChatSideBarOpen) {
|
||||||
|
props.setIsChatSideBarOpen(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setHasMoreMessages(false);
|
setHasMoreMessages(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user