mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-20 04:37:09 +02:00
address pablo's nits (#2368)
This commit is contained in:
@@ -964,6 +964,11 @@ export function ChatPage({
|
|||||||
(message) => message.messageId === messageIdToResend
|
(message) => message.messageId === messageIdToResend
|
||||||
);
|
);
|
||||||
|
|
||||||
|
updateRegenerationState(
|
||||||
|
regenerationRequest
|
||||||
|
? { regenerating: true, finalMessageIndex: messageIdToResend || 0 }
|
||||||
|
: null
|
||||||
|
);
|
||||||
const messageMap = currentMessageMap(completeMessageDetail);
|
const messageMap = currentMessageMap(completeMessageDetail);
|
||||||
const messageToResendParent =
|
const messageToResendParent =
|
||||||
messageToResend?.parentMessageId !== null &&
|
messageToResend?.parentMessageId !== null &&
|
||||||
@@ -991,12 +996,6 @@ export function ChatPage({
|
|||||||
|
|
||||||
setSubmittedMessage(currMessage);
|
setSubmittedMessage(currMessage);
|
||||||
|
|
||||||
updateRegenerationState(
|
|
||||||
regenerationRequest
|
|
||||||
? { regenerating: true, finalMessageIndex: messageIdToResend || 0 }
|
|
||||||
: null
|
|
||||||
);
|
|
||||||
|
|
||||||
updateChatState("loading");
|
updateChatState("loading");
|
||||||
|
|
||||||
const currMessageHistory =
|
const currMessageHistory =
|
||||||
@@ -1811,9 +1810,14 @@ export function ChatPage({
|
|||||||
? messageMap.get(message.parentMessageId)
|
? messageMap.get(message.parentMessageId)
|
||||||
: null;
|
: null;
|
||||||
if (
|
if (
|
||||||
currentSessionRegenerationState?.regenerating &&
|
(currentSessionRegenerationState?.regenerating &&
|
||||||
message.messageId >
|
message.messageId >
|
||||||
currentSessionRegenerationState?.finalMessageIndex!
|
currentSessionRegenerationState?.finalMessageIndex!) ||
|
||||||
|
(currentSessionChatState == "loading" &&
|
||||||
|
((i >= messageHistory.length - 2 &&
|
||||||
|
message.type == "user") ||
|
||||||
|
(i >= messageHistory.length - 1 &&
|
||||||
|
!currentSessionRegenerationState?.regenerating)))
|
||||||
) {
|
) {
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
@@ -1890,7 +1894,8 @@ export function ChatPage({
|
|||||||
if (
|
if (
|
||||||
currentSessionRegenerationState?.regenerating &&
|
currentSessionRegenerationState?.regenerating &&
|
||||||
currentSessionChatState == "loading" &&
|
currentSessionChatState == "loading" &&
|
||||||
message.messageId == messageHistory.length - 1
|
(i == messageHistory.length - 1 ||
|
||||||
|
currentSessionRegenerationState?.regenerating)
|
||||||
) {
|
) {
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
@@ -2093,17 +2098,17 @@ export function ChatPage({
|
|||||||
}
|
}
|
||||||
})}
|
})}
|
||||||
|
|
||||||
{currentSessionChatState == "loading" ||
|
{(currentSessionChatState == "loading" ||
|
||||||
(loadingError &&
|
(loadingError &&
|
||||||
!currentSessionRegenerationState?.regenerating &&
|
!currentSessionRegenerationState?.regenerating &&
|
||||||
messageHistory[messageHistory.length - 1]
|
messageHistory[messageHistory.length - 1]
|
||||||
?.type != "user" && (
|
?.type != "user")) && (
|
||||||
<HumanMessage
|
<HumanMessage
|
||||||
key={-2}
|
key={-2}
|
||||||
messageId={-1}
|
messageId={-1}
|
||||||
content={submittedMessage}
|
content={submittedMessage}
|
||||||
/>
|
/>
|
||||||
))}
|
)}
|
||||||
|
|
||||||
{currentSessionChatState == "loading" && (
|
{currentSessionChatState == "loading" && (
|
||||||
<div
|
<div
|
||||||
|
@@ -34,7 +34,6 @@ import { Hoverable } from "@/components/Hoverable";
|
|||||||
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
||||||
import { ChatState } from "../types";
|
import { ChatState } from "../types";
|
||||||
import UnconfiguredProviderText from "@/components/chat_search/UnconfiguredProviderText";
|
import UnconfiguredProviderText from "@/components/chat_search/UnconfiguredProviderText";
|
||||||
import { useSearchContext } from "@/components/context/SearchContext";
|
|
||||||
|
|
||||||
const MAX_INPUT_HEIGHT = 200;
|
const MAX_INPUT_HEIGHT = 200;
|
||||||
|
|
||||||
|
@@ -715,6 +715,7 @@ export const HumanMessage = ({
|
|||||||
// Move the cursor to the end of the text
|
// Move the cursor to the end of the text
|
||||||
textareaRef.current.selectionStart = textareaRef.current.value.length;
|
textareaRef.current.selectionStart = textareaRef.current.value.length;
|
||||||
textareaRef.current.selectionEnd = textareaRef.current.value.length;
|
textareaRef.current.selectionEnd = textareaRef.current.value.length;
|
||||||
|
textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`;
|
||||||
}
|
}
|
||||||
}, [isEditing]);
|
}, [isEditing]);
|
||||||
|
|
||||||
@@ -787,6 +788,7 @@ export const HumanMessage = ({
|
|||||||
style={{ scrollbarWidth: "thin" }}
|
style={{ scrollbarWidth: "thin" }}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setEditedContent(e.target.value);
|
setEditedContent(e.target.value);
|
||||||
|
textareaRef.current!.style.height = "auto";
|
||||||
e.target.style.height = `${e.target.scrollHeight}px`;
|
e.target.style.height = `${e.target.scrollHeight}px`;
|
||||||
}}
|
}}
|
||||||
onKeyDown={(e) => {
|
onKeyDown={(e) => {
|
||||||
|
Reference in New Issue
Block a user