mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-29 13:25:50 +02:00
Tenant provisioning in the dataplane (#2694)
* add tenant provisioning to data plane * minor typing update * ensure tenant router included * proper auth check * update disabling logic * validated basic provisioning * use new kv store
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
ValidQuestionResponse,
|
||||
Relevance,
|
||||
SearchDanswerDocument,
|
||||
SourceMetadata,
|
||||
} from "@/lib/search/interfaces";
|
||||
import { searchRequestStreamed } from "@/lib/search/streamingQa";
|
||||
import { CancellationToken, cancellable } from "@/lib/search/cancellable";
|
||||
@@ -40,6 +41,9 @@ import { ApiKeyModal } from "../llm/ApiKeyModal";
|
||||
import { useSearchContext } from "../context/SearchContext";
|
||||
import { useUser } from "../user/UserProvider";
|
||||
import UnconfiguredProviderText from "../chat_search/UnconfiguredProviderText";
|
||||
import { DateRangePickerValue } from "@tremor/react";
|
||||
import { Tag } from "@/lib/types";
|
||||
import { isEqual } from "lodash";
|
||||
|
||||
export type searchState =
|
||||
| "input"
|
||||
@@ -370,8 +374,36 @@ export const SearchSection = ({
|
||||
setSearchAnswerExpanded(false);
|
||||
};
|
||||
|
||||
const [previousSearch, setPreviousSearch] = useState<string>("");
|
||||
interface SearchDetails {
|
||||
query: string;
|
||||
sources: SourceMetadata[];
|
||||
agentic: boolean;
|
||||
documentSets: string[];
|
||||
timeRange: DateRangePickerValue | null;
|
||||
tags: Tag[];
|
||||
persona: Persona;
|
||||
}
|
||||
|
||||
const [previousSearch, setPreviousSearch] = useState<null | SearchDetails>(
|
||||
null
|
||||
);
|
||||
const [agenticResults, setAgenticResults] = useState<boolean | null>(null);
|
||||
const currentSearch = (overrideMessage?: string): SearchDetails => {
|
||||
return {
|
||||
query: overrideMessage || query,
|
||||
sources: filterManager.selectedSources,
|
||||
agentic: agentic!,
|
||||
documentSets: filterManager.selectedDocumentSets,
|
||||
timeRange: filterManager.timeRange,
|
||||
tags: filterManager.selectedTags,
|
||||
persona: assistants.find(
|
||||
(assistant) => assistant.id === selectedPersona
|
||||
) as Persona,
|
||||
};
|
||||
};
|
||||
const isSearchChanged = () => {
|
||||
return !isEqual(currentSearch(), previousSearch);
|
||||
};
|
||||
|
||||
let lastSearchCancellationToken = useRef<CancellationToken | null>(null);
|
||||
const onSearch = async ({
|
||||
@@ -394,7 +426,9 @@ export const SearchSection = ({
|
||||
|
||||
setIsFetching(true);
|
||||
setSearchResponse(initialSearchResponse);
|
||||
setPreviousSearch(overrideMessage || query);
|
||||
|
||||
setPreviousSearch(currentSearch(overrideMessage));
|
||||
|
||||
const searchFnArgs = {
|
||||
query: overrideMessage || query,
|
||||
sources: filterManager.selectedSources,
|
||||
@@ -761,7 +795,7 @@ export const SearchSection = ({
|
||||
/>
|
||||
|
||||
<FullSearchBar
|
||||
disabled={previousSearch === query}
|
||||
disabled={!isSearchChanged()}
|
||||
toggleAgentic={
|
||||
disabledAgentic ? undefined : toggleAgentic
|
||||
}
|
||||
|
Reference in New Issue
Block a user