Update search tool selection (#2223)

* update search tool selection

* squash
This commit is contained in:
pablodanswer 2024-08-23 09:58:39 -07:00 committed by GitHub
parent 2e0222d1c1
commit e749fa0f28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 13 deletions

View File

@ -84,6 +84,7 @@ import { SetDefaultModelModal } from "./modal/SetDefaultModelModal";
import { DeleteChatModal } from "./modal/DeleteChatModal";
import { MinimalMarkdown } from "@/components/chat_search/MinimalMarkdown";
import ExceptionTraceModal from "@/components/modals/ExceptionTraceModal";
import { SEARCH_TOOL_NAME } from "./tools/constants";
const TEMP_USER_MESSAGE_ID = -1;
const TEMP_ASSISTANT_MESSAGE_ID = -2;
@ -985,7 +986,6 @@ export function ChatPage({
answer += (packet as AnswerPiecePacket).answer_piece;
} else if (Object.hasOwn(packet, "top_documents")) {
documents = (packet as DocumentsResponse).top_documents;
query = (packet as DocumentsResponse).rephrased_query;
retrievalType = RetrievalType.Search;
if (documents && documents.length > 0) {
// point to the latest message (we don't know the messageId yet, which is why
@ -1008,6 +1008,12 @@ export function ChatPage({
} else {
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")) {
aiMessageImages = (packet as ImageGenerationDisplay).file_ids.map(
(fileId) => {
@ -1733,8 +1739,7 @@ export function ChatPage({
}
isComplete={
i !== messageHistory.length - 1 ||
(chatState != "streaming" &&
chatState != "toolBuilding")
chatState == "input"
}
hasDocs={
(message.documents &&
@ -2018,7 +2023,7 @@ export function ChatPage({
<div className="mx-auto h-full flex">
<div
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]"}`}
/>
<div className="my-auto">

View File

@ -286,7 +286,6 @@ export const AIMessage = ({
<>
{query !== undefined &&
handleShowRetrieved !== undefined &&
isCurrentlyShowingRetrieved !== undefined &&
!retrievalDisabled && (
<div className="mb-1">
<SearchSummary
@ -294,9 +293,6 @@ export const AIMessage = ({
finished={toolCall?.tool_result != undefined}
hasDocs={hasDocs || false}
messageId={messageId}
isCurrentlyShowingRetrieved={
isCurrentlyShowingRetrieved
}
handleShowRetrieved={handleShowRetrieved}
handleSearchQueryEdit={handleSearchQueryEdit}
/>

View File

@ -40,7 +40,6 @@ export function SearchSummary({
hasDocs,
finished,
messageId,
isCurrentlyShowingRetrieved,
handleShowRetrieved,
handleSearchQueryEdit,
}: {
@ -48,7 +47,6 @@ export function SearchSummary({
query: string;
hasDocs: boolean;
messageId: number | null;
isCurrentlyShowingRetrieved: boolean;
handleShowRetrieved: (messageId: number | null) => void;
handleSearchQueryEdit?: (query: string) => void;
}) {

View File

@ -204,9 +204,7 @@ export function ClientLayout({
name: (
<div className="flex">
<SearchIcon />
<CustomTooltip content="Navigate here to update your search settings">
<div className="ml-1">Search Settings</div>
</CustomTooltip>
<div className="ml-1">Search Settings</div>
</div>
),
link: "/admin/configuration/search",