mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-20 04:37:09 +02:00
Enable removal of reranking + navigate back to search settings (#2674)
* k * nit
This commit is contained in:
@@ -79,7 +79,12 @@ const RerankingDetailsForm = forwardRef<
|
||||
>
|
||||
{({ values, setFieldValue, resetForm }) => {
|
||||
const resetRerankingValues = () => {
|
||||
setRerankingDetails(originalRerankingDetails);
|
||||
setRerankingDetails({
|
||||
rerank_api_key: null,
|
||||
rerank_provider_type: null,
|
||||
rerank_model_name: null,
|
||||
rerank_api_url: null,
|
||||
});
|
||||
resetForm();
|
||||
};
|
||||
|
||||
|
@@ -13,7 +13,7 @@ import {
|
||||
} from "@/components/embedding/interfaces";
|
||||
import { errorHandlingFetcher } from "@/lib/fetcher";
|
||||
import { ErrorCallout } from "@/components/ErrorCallout";
|
||||
import useSWR, { mutate } from "swr";
|
||||
import useSWR from "swr";
|
||||
import { ThreeDotsLoader } from "@/components/Loading";
|
||||
import AdvancedEmbeddingFormPage from "./AdvancedEmbeddingFormPage";
|
||||
import {
|
||||
@@ -173,10 +173,9 @@ export default function EmbeddingForm() {
|
||||
const response = await updateSearchSettings(values);
|
||||
if (response.ok) {
|
||||
setPopup({
|
||||
message: "Updated search settings succesffuly",
|
||||
message: "Updated search settings successfully",
|
||||
type: "success",
|
||||
});
|
||||
mutate("/api/search-settings/get-current-search-settings");
|
||||
return true;
|
||||
} else {
|
||||
setPopup({ message: "Failed to update search settings", type: "error" });
|
||||
@@ -184,6 +183,17 @@ export default function EmbeddingForm() {
|
||||
}
|
||||
};
|
||||
|
||||
const navigateToEmbeddingPage = (changedResource: string) => {
|
||||
setPopup({
|
||||
message: `Changed ${changedResource} successfully. Redirecting to embedding page`,
|
||||
type: "success",
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
window.open("/admin/configuration/search", "_self");
|
||||
}, 2000);
|
||||
};
|
||||
|
||||
const onConfirm = async () => {
|
||||
if (!selectedProvider) {
|
||||
return;
|
||||
@@ -227,14 +237,7 @@ export default function EmbeddingForm() {
|
||||
);
|
||||
|
||||
if (response.ok) {
|
||||
setPopup({
|
||||
message: "Changed provider successfully. Redirecting to embedding page",
|
||||
type: "success",
|
||||
});
|
||||
mutate("/api/search-settings/get-secondary-search-settings");
|
||||
setTimeout(() => {
|
||||
window.open("/admin/configuration/search", "_self");
|
||||
}, 2000);
|
||||
navigateToEmbeddingPage("embedding model");
|
||||
} else {
|
||||
setPopup({ message: "Failed to update embedding model", type: "error" });
|
||||
|
||||
@@ -286,6 +289,7 @@ export default function EmbeddingForm() {
|
||||
className="enabled:cursor-pointer ml-auto disabled:bg-accent/50 disabled:cursor-not-allowed bg-accent flex mx-auto gap-x-1 items-center text-white py-2.5 px-3.5 text-sm font-regular rounded-sm"
|
||||
onClick={async () => {
|
||||
updateSearch();
|
||||
navigateToEmbeddingPage("search settings");
|
||||
}}
|
||||
>
|
||||
Update Search
|
||||
@@ -405,7 +409,6 @@ export default function EmbeddingForm() {
|
||||
<div className="flex w-full justify-end">
|
||||
<button
|
||||
className={`enabled:cursor-pointer enabled:hover:underline disabled:cursor-not-allowed mt-auto enabled:text-text-600 disabled:text-text-400 ml-auto flex gap-x-1 items-center py-2.5 px-3.5 text-sm font-regular rounded-sm`}
|
||||
// disabled={!isFormValid}
|
||||
onClick={() => {
|
||||
nextFormStep();
|
||||
}}
|
||||
|
Reference in New Issue
Block a user