mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Only open the side bar automatically when there is no chat history && no pending messages.
This commit is contained in:
@@ -142,6 +142,7 @@ export default function ChatHistory(props: ChatHistoryProps) {
|
|||||||
const isMobileWidth = useIsMobileWidth();
|
const isMobileWidth = useIsMobileWidth();
|
||||||
const scrollAreaSelector = "[data-radix-scroll-area-viewport]";
|
const scrollAreaSelector = "[data-radix-scroll-area-viewport]";
|
||||||
const fetchMessageCount = 10;
|
const fetchMessageCount = 10;
|
||||||
|
const hasStartingMessage = localStorage.getItem("message");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const scrollAreaEl = scrollAreaRef.current?.querySelector<HTMLElement>(scrollAreaSelector);
|
const scrollAreaEl = scrollAreaRef.current?.querySelector<HTMLElement>(scrollAreaSelector);
|
||||||
@@ -277,7 +278,9 @@ export default function ChatHistory(props: ChatHistoryProps) {
|
|||||||
props.setAgent(chatData.response.agent);
|
props.setAgent(chatData.response.agent);
|
||||||
setData(chatMetadata);
|
setData(chatMetadata);
|
||||||
if (props.setIsChatSideBarOpen) {
|
if (props.setIsChatSideBarOpen) {
|
||||||
props.setIsChatSideBarOpen(true);
|
if (!hasStartingMessage) {
|
||||||
|
props.setIsChatSideBarOpen(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,7 +472,7 @@ export default function ChatHistory(props: ChatHistoryProps) {
|
|||||||
onDeleteMessage={handleDeleteMessage}
|
onDeleteMessage={handleDeleteMessage}
|
||||||
customClassName="fullHistory"
|
customClassName="fullHistory"
|
||||||
borderLeftColor={`${data?.agent?.color}-500`}
|
borderLeftColor={`${data?.agent?.color}-500`}
|
||||||
isLastMessage={true}
|
isLastMessage={index === (props.incomingMessages!.length - 1)}
|
||||||
/>
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user