mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-29 05:15:12 +02:00
Misc frontend fixes
This commit is contained in:
@@ -78,6 +78,21 @@ export const Chat = ({
|
|||||||
// session they are using
|
// session they are using
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
textareaRef.current?.focus();
|
textareaRef.current?.focus();
|
||||||
|
|
||||||
|
// only clear things if we're going from one chat session to another
|
||||||
|
if (chatSessionId !== null && existingChatSessionId !== chatSessionId) {
|
||||||
|
// de-select documents
|
||||||
|
clearSelectedDocuments();
|
||||||
|
// reset all filters
|
||||||
|
filterManager.setSelectedDocumentSets([]);
|
||||||
|
filterManager.setSelectedSources([]);
|
||||||
|
filterManager.setSelectedTags([]);
|
||||||
|
filterManager.setTimeRange(null);
|
||||||
|
if (isStreaming) {
|
||||||
|
setIsCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setChatSessionId(existingChatSessionId);
|
setChatSessionId(existingChatSessionId);
|
||||||
|
|
||||||
async function initialSessionFetch() {
|
async function initialSessionFetch() {
|
||||||
@@ -405,10 +420,14 @@ export const Chat = ({
|
|||||||
setSelectedMessageForDocDisplay(finalMessage.message_id);
|
setSelectedMessageForDocDisplay(finalMessage.message_id);
|
||||||
}
|
}
|
||||||
await nameChatSession(currChatSessionId, currMessage);
|
await nameChatSession(currChatSessionId, currMessage);
|
||||||
|
|
||||||
|
// NOTE: don't switch pages if the user has navigated away from the chat
|
||||||
|
if (currChatSessionId === chatSessionId) {
|
||||||
router.push(`/chat?chatId=${currChatSessionId}`, {
|
router.push(`/chat?chatId=${currChatSessionId}`, {
|
||||||
scroll: false,
|
scroll: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
finalMessage?.context_docs &&
|
finalMessage?.context_docs &&
|
||||||
finalMessage.context_docs.top_documents.length > 0 &&
|
finalMessage.context_docs.top_documents.length > 0 &&
|
||||||
@@ -464,9 +483,9 @@ export const Chat = ({
|
|||||||
|
|
||||||
{documentSidebarInitialWidth !== undefined ? (
|
{documentSidebarInitialWidth !== undefined ? (
|
||||||
<>
|
<>
|
||||||
<div className="w-full sm:relative">
|
<div className="w-full sm:relative h-screen pb-[140px]">
|
||||||
<div
|
<div
|
||||||
className={`w-full h-screen ${HEADER_PADDING} flex flex-col overflow-y-auto relative`}
|
className={`w-full h-full ${HEADER_PADDING} flex flex-col overflow-y-auto overflow-x-hidden relative`}
|
||||||
ref={scrollableDivRef}
|
ref={scrollableDivRef}
|
||||||
>
|
>
|
||||||
{livePersona && (
|
{livePersona && (
|
||||||
@@ -628,7 +647,7 @@ export const Chat = ({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Some padding at the bottom so the search bar has space at the bottom to not cover the last message*/}
|
{/* Some padding at the bottom so the search bar has space at the bottom to not cover the last message*/}
|
||||||
<div className={`min-h-[200px] w-full`}></div>
|
<div className={`min-h-[30px] w-full`}></div>
|
||||||
|
|
||||||
<div ref={endDivRef} />
|
<div ref={endDivRef} />
|
||||||
</div>
|
</div>
|
||||||
@@ -693,7 +712,8 @@ export const Chat = ({
|
|||||||
if (
|
if (
|
||||||
event.key === "Enter" &&
|
event.key === "Enter" &&
|
||||||
!event.shiftKey &&
|
!event.shiftKey &&
|
||||||
message
|
message &&
|
||||||
|
!isStreaming
|
||||||
) {
|
) {
|
||||||
onSubmit();
|
onSubmit();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@@ -213,7 +213,7 @@ export const SearchSection = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative max-w-[2000px] xl:max-w-[1430px] mx-auto">
|
<div className="relative max-w-[2000px] xl:max-w-[1430px] mx-auto">
|
||||||
<div className="absolute left-0 hidden 2xl:block w-64">
|
<div className="absolute left-0 hidden 2xl:block w-52 3xl:w-64">
|
||||||
{(connectors.length > 0 || documentSets.length > 0) && (
|
{(connectors.length > 0 || documentSets.length > 0) && (
|
||||||
<SourceSelector
|
<SourceSelector
|
||||||
{...filterManager}
|
{...filterManager}
|
||||||
@@ -246,7 +246,7 @@ export const SearchSection = ({
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-[800px] mx-auto">
|
<div className="w-[720px] 3xl:w-[800px] mx-auto">
|
||||||
{personas.length > 0 ? (
|
{personas.length > 0 ? (
|
||||||
<div className="flex mb-2 w-fit">
|
<div className="flex mb-2 w-fit">
|
||||||
<PersonaSelector
|
<PersonaSelector
|
||||||
|
Reference in New Issue
Block a user