mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-08-08 22:12:30 +02:00
k
This commit is contained in:
@@ -287,6 +287,16 @@ export function ChatPage({
|
|||||||
SEARCH_PARAM_NAMES.TEMPERATURE
|
SEARCH_PARAM_NAMES.TEMPERATURE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const defaultTemperature = search_param_temperature
|
||||||
|
? parseFloat(search_param_temperature)
|
||||||
|
: selectedAssistant?.tools.some(
|
||||||
|
(tool) =>
|
||||||
|
tool.in_code_tool_id === SEARCH_TOOL_ID ||
|
||||||
|
tool.in_code_tool_id === INTERNET_SEARCH_TOOL_ID
|
||||||
|
)
|
||||||
|
? 0
|
||||||
|
: 0.7;
|
||||||
|
|
||||||
const setSelectedAssistantFromId = (assistantId: number) => {
|
const setSelectedAssistantFromId = (assistantId: number) => {
|
||||||
// NOTE: also intentionally look through available assistants here, so that
|
// NOTE: also intentionally look through available assistants here, so that
|
||||||
// even if the user has hidden an assistant they can still go back to it
|
// even if the user has hidden an assistant they can still go back to it
|
||||||
@@ -2569,6 +2579,10 @@ export function ChatPage({
|
|||||||
if (parentMessage?.type == "assistant") {
|
if (parentMessage?.type == "assistant") {
|
||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
|
const secondLevelMessage =
|
||||||
|
messageHistory[i + 1]?.type === "assistant"
|
||||||
|
? messageHistory[i + 1]
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const secondLevelAssistantMessage =
|
const secondLevelAssistantMessage =
|
||||||
messageHistory[i + 1]?.type === "assistant"
|
messageHistory[i + 1]?.type === "assistant"
|
||||||
@@ -2631,6 +2645,21 @@ export function ChatPage({
|
|||||||
agenticDocs={
|
agenticDocs={
|
||||||
message.agentic_docs || agenticDocs
|
message.agentic_docs || agenticDocs
|
||||||
}
|
}
|
||||||
|
toggleDocDisplay={(
|
||||||
|
agentic: boolean
|
||||||
|
) => {
|
||||||
|
if (agentic) {
|
||||||
|
setSelectedMessageForDocDisplay(
|
||||||
|
message.messageId
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
setSelectedMessageForDocDisplay(
|
||||||
|
secondLevelMessage
|
||||||
|
? secondLevelMessage.messageId
|
||||||
|
: null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}}
|
||||||
docs={
|
docs={
|
||||||
message?.documents &&
|
message?.documents &&
|
||||||
message?.documents.length > 0
|
message?.documents.length > 0
|
||||||
@@ -2738,6 +2767,39 @@ export function ChatPage({
|
|||||||
message.messageId as number,
|
message.messageId as number,
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
handleSearchQueryEdit={
|
||||||
|
i === messageHistory.length - 1 &&
|
||||||
|
currentSessionChatState == "input"
|
||||||
|
? (newQuery) => {
|
||||||
|
if (!previousMessage) {
|
||||||
|
setPopup({
|
||||||
|
type: "error",
|
||||||
|
message:
|
||||||
|
"Cannot edit query of first message - please refresh the page and try again.",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
previousMessage.messageId ===
|
||||||
|
null
|
||||||
|
) {
|
||||||
|
setPopup({
|
||||||
|
type: "error",
|
||||||
|
message:
|
||||||
|
"Cannot edit query of a pending message - please wait a few seconds and try again.",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
onSubmit({
|
||||||
|
messageIdToResend:
|
||||||
|
previousMessage.messageId,
|
||||||
|
queryOverride: newQuery,
|
||||||
|
alternativeAssistantOverride:
|
||||||
|
currentAlternativeAssistant,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
handleShowRetrieved={(
|
handleShowRetrieved={(
|
||||||
messageNumber
|
messageNumber
|
||||||
) => {
|
) => {
|
||||||
|
@@ -118,6 +118,7 @@ export const AgenticMessage = ({
|
|||||||
secondLevelSubquestions,
|
secondLevelSubquestions,
|
||||||
setStreamingAllowed,
|
setStreamingAllowed,
|
||||||
streamingAllowed,
|
streamingAllowed,
|
||||||
|
toggleDocDisplay,
|
||||||
}: {
|
}: {
|
||||||
secondLevelSubquestions?: SubQuestionDetail[] | null;
|
secondLevelSubquestions?: SubQuestionDetail[] | null;
|
||||||
agenticDocs?: OnyxDocument[] | null;
|
agenticDocs?: OnyxDocument[] | null;
|
||||||
@@ -156,6 +157,7 @@ export const AgenticMessage = ({
|
|||||||
setPresentingDocument?: (document: OnyxDocument) => void;
|
setPresentingDocument?: (document: OnyxDocument) => void;
|
||||||
setStreamingAllowed?: (allowed: boolean) => void;
|
setStreamingAllowed?: (allowed: boolean) => void;
|
||||||
streamingAllowed?: boolean;
|
streamingAllowed?: boolean;
|
||||||
|
toggleDocDisplay?: (agentic: boolean) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const [streamedContent, setStreamedContent] = useState(content as string);
|
const [streamedContent, setStreamedContent] = useState(content as string);
|
||||||
|
|
||||||
@@ -542,6 +544,8 @@ export const AgenticMessage = ({
|
|||||||
const viewInitialAnswer =
|
const viewInitialAnswer =
|
||||||
!isViewingInitialAnswer;
|
!isViewingInitialAnswer;
|
||||||
setIsViewingInitialAnswer(viewInitialAnswer);
|
setIsViewingInitialAnswer(viewInitialAnswer);
|
||||||
|
toggleDocDisplay &&
|
||||||
|
toggleDocDisplay(isViewingInitialAnswer);
|
||||||
if (viewInitialAnswer) {
|
if (viewInitialAnswer) {
|
||||||
setIsViewingInitialAnswer(true);
|
setIsViewingInitialAnswer(true);
|
||||||
}
|
}
|
||||||
|
@@ -637,7 +637,15 @@ const SubQuestionsDisplay: React.FC<SubQuestionsDisplayProps> = ({
|
|||||||
!finishedGenerating ? ToggleState.Todo : ToggleState.Done
|
!finishedGenerating ? ToggleState.Todo : ToggleState.Done
|
||||||
}
|
}
|
||||||
documents={documents}
|
documents={documents}
|
||||||
isLast={false}
|
isLast={
|
||||||
|
!showSummarizing &&
|
||||||
|
memoizedSubQuestions.length > index + 1 &&
|
||||||
|
!(
|
||||||
|
showSecondLevel &&
|
||||||
|
memoizedSecondLevelQuestions &&
|
||||||
|
memoizedSecondLevelQuestions?.length > 0
|
||||||
|
)
|
||||||
|
}
|
||||||
isFirst={index === 0}
|
isFirst={index === 0}
|
||||||
setPresentingDocument={setPresentingDocument}
|
setPresentingDocument={setPresentingDocument}
|
||||||
unToggle={
|
unToggle={
|
||||||
@@ -679,7 +687,10 @@ const SubQuestionsDisplay: React.FC<SubQuestionsDisplayProps> = ({
|
|||||||
key={index}
|
key={index}
|
||||||
subQuestion={subQuestion}
|
subQuestion={subQuestion}
|
||||||
documents={documents}
|
documents={documents}
|
||||||
isLast={false}
|
isLast={
|
||||||
|
!showSummarizing &&
|
||||||
|
memoizedSecondLevelQuestions.length > index + 1
|
||||||
|
}
|
||||||
isFirst={false}
|
isFirst={false}
|
||||||
setPresentingDocument={setPresentingDocument}
|
setPresentingDocument={setPresentingDocument}
|
||||||
unToggle={
|
unToggle={
|
||||||
|
Reference in New Issue
Block a user