mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-06 21:19:54 +02:00
Update search tool selection (#2223)
* update search tool selection * squash
This commit is contained in:
parent
2e0222d1c1
commit
e749fa0f28
@ -84,6 +84,7 @@ import { SetDefaultModelModal } from "./modal/SetDefaultModelModal";
|
|||||||
import { DeleteChatModal } from "./modal/DeleteChatModal";
|
import { DeleteChatModal } from "./modal/DeleteChatModal";
|
||||||
import { MinimalMarkdown } from "@/components/chat_search/MinimalMarkdown";
|
import { MinimalMarkdown } from "@/components/chat_search/MinimalMarkdown";
|
||||||
import ExceptionTraceModal from "@/components/modals/ExceptionTraceModal";
|
import ExceptionTraceModal from "@/components/modals/ExceptionTraceModal";
|
||||||
|
import { SEARCH_TOOL_NAME } from "./tools/constants";
|
||||||
|
|
||||||
const TEMP_USER_MESSAGE_ID = -1;
|
const TEMP_USER_MESSAGE_ID = -1;
|
||||||
const TEMP_ASSISTANT_MESSAGE_ID = -2;
|
const TEMP_ASSISTANT_MESSAGE_ID = -2;
|
||||||
@ -985,7 +986,6 @@ export function ChatPage({
|
|||||||
answer += (packet as AnswerPiecePacket).answer_piece;
|
answer += (packet as AnswerPiecePacket).answer_piece;
|
||||||
} else if (Object.hasOwn(packet, "top_documents")) {
|
} else if (Object.hasOwn(packet, "top_documents")) {
|
||||||
documents = (packet as DocumentsResponse).top_documents;
|
documents = (packet as DocumentsResponse).top_documents;
|
||||||
query = (packet as DocumentsResponse).rephrased_query;
|
|
||||||
retrievalType = RetrievalType.Search;
|
retrievalType = RetrievalType.Search;
|
||||||
if (documents && documents.length > 0) {
|
if (documents && documents.length > 0) {
|
||||||
// point to the latest message (we don't know the messageId yet, which is why
|
// point to the latest message (we don't know the messageId yet, which is why
|
||||||
@ -1008,6 +1008,12 @@ export function ChatPage({
|
|||||||
} else {
|
} else {
|
||||||
setChatState("streaming");
|
setChatState("streaming");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This will be consolidated in upcoming tool calls udpate,
|
||||||
|
// but for now, we need to set query as early as possible
|
||||||
|
if (toolCalls[0].tool_name == SEARCH_TOOL_NAME) {
|
||||||
|
query = toolCalls[0].tool_args["query"];
|
||||||
|
}
|
||||||
} else if (Object.hasOwn(packet, "file_ids")) {
|
} else if (Object.hasOwn(packet, "file_ids")) {
|
||||||
aiMessageImages = (packet as ImageGenerationDisplay).file_ids.map(
|
aiMessageImages = (packet as ImageGenerationDisplay).file_ids.map(
|
||||||
(fileId) => {
|
(fileId) => {
|
||||||
@ -1733,8 +1739,7 @@ export function ChatPage({
|
|||||||
}
|
}
|
||||||
isComplete={
|
isComplete={
|
||||||
i !== messageHistory.length - 1 ||
|
i !== messageHistory.length - 1 ||
|
||||||
(chatState != "streaming" &&
|
chatState == "input"
|
||||||
chatState != "toolBuilding")
|
|
||||||
}
|
}
|
||||||
hasDocs={
|
hasDocs={
|
||||||
(message.documents &&
|
(message.documents &&
|
||||||
@ -2018,7 +2023,7 @@ export function ChatPage({
|
|||||||
<div className="mx-auto h-full flex">
|
<div className="mx-auto h-full flex">
|
||||||
<div
|
<div
|
||||||
style={{ transition: "width 0.30s ease-out" }}
|
style={{ transition: "width 0.30s ease-out" }}
|
||||||
className={`flex-none bg-transparent transition-all bg-opacity-80 duration-300 ease-in-out h-full
|
className={`flex-none bg-transparent transition-all bg-opacity-80 duration-300 epase-in-out h-full
|
||||||
${toggledSidebar ? "w-[250px] " : "w-[0px]"}`}
|
${toggledSidebar ? "w-[250px] " : "w-[0px]"}`}
|
||||||
/>
|
/>
|
||||||
<div className="my-auto">
|
<div className="my-auto">
|
||||||
|
@ -286,7 +286,6 @@ export const AIMessage = ({
|
|||||||
<>
|
<>
|
||||||
{query !== undefined &&
|
{query !== undefined &&
|
||||||
handleShowRetrieved !== undefined &&
|
handleShowRetrieved !== undefined &&
|
||||||
isCurrentlyShowingRetrieved !== undefined &&
|
|
||||||
!retrievalDisabled && (
|
!retrievalDisabled && (
|
||||||
<div className="mb-1">
|
<div className="mb-1">
|
||||||
<SearchSummary
|
<SearchSummary
|
||||||
@ -294,9 +293,6 @@ export const AIMessage = ({
|
|||||||
finished={toolCall?.tool_result != undefined}
|
finished={toolCall?.tool_result != undefined}
|
||||||
hasDocs={hasDocs || false}
|
hasDocs={hasDocs || false}
|
||||||
messageId={messageId}
|
messageId={messageId}
|
||||||
isCurrentlyShowingRetrieved={
|
|
||||||
isCurrentlyShowingRetrieved
|
|
||||||
}
|
|
||||||
handleShowRetrieved={handleShowRetrieved}
|
handleShowRetrieved={handleShowRetrieved}
|
||||||
handleSearchQueryEdit={handleSearchQueryEdit}
|
handleSearchQueryEdit={handleSearchQueryEdit}
|
||||||
/>
|
/>
|
||||||
|
@ -40,7 +40,6 @@ export function SearchSummary({
|
|||||||
hasDocs,
|
hasDocs,
|
||||||
finished,
|
finished,
|
||||||
messageId,
|
messageId,
|
||||||
isCurrentlyShowingRetrieved,
|
|
||||||
handleShowRetrieved,
|
handleShowRetrieved,
|
||||||
handleSearchQueryEdit,
|
handleSearchQueryEdit,
|
||||||
}: {
|
}: {
|
||||||
@ -48,7 +47,6 @@ export function SearchSummary({
|
|||||||
query: string;
|
query: string;
|
||||||
hasDocs: boolean;
|
hasDocs: boolean;
|
||||||
messageId: number | null;
|
messageId: number | null;
|
||||||
isCurrentlyShowingRetrieved: boolean;
|
|
||||||
handleShowRetrieved: (messageId: number | null) => void;
|
handleShowRetrieved: (messageId: number | null) => void;
|
||||||
handleSearchQueryEdit?: (query: string) => void;
|
handleSearchQueryEdit?: (query: string) => void;
|
||||||
}) {
|
}) {
|
||||||
|
@ -204,9 +204,7 @@ export function ClientLayout({
|
|||||||
name: (
|
name: (
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<SearchIcon />
|
<SearchIcon />
|
||||||
<CustomTooltip content="Navigate here to update your search settings">
|
|
||||||
<div className="ml-1">Search Settings</div>
|
<div className="ml-1">Search Settings</div>
|
||||||
</CustomTooltip>
|
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
link: "/admin/configuration/search",
|
link: "/admin/configuration/search",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user