diff --git a/backend/onyx/server/settings/models.py b/backend/onyx/server/settings/models.py index f84c59818..80658285d 100644 --- a/backend/onyx/server/settings/models.py +++ b/backend/onyx/server/settings/models.py @@ -48,6 +48,7 @@ class Settings(BaseModel): application_status: ApplicationStatus = ApplicationStatus.ACTIVE anonymous_user_enabled: bool | None = None pro_search_enabled: bool | None = None + search_page_disabled: bool | None = None temperature_override_enabled: bool | None = False auto_scroll: bool | None = False diff --git a/web/src/app/admin/settings/SettingsForm.tsx b/web/src/app/admin/settings/SettingsForm.tsx index a62667caf..557560c6f 100644 --- a/web/src/app/admin/settings/SettingsForm.tsx +++ b/web/src/app/admin/settings/SettingsForm.tsx @@ -260,6 +260,14 @@ export function SettingsForm() { } /> + + handleToggleSettingsField("search_page_disabled", e.target.checked) + } + /> {NEXT_PUBLIC_CLOUD_ENABLED && settings.anonymous_user_enabled && ( )} diff --git a/web/src/app/admin/settings/interfaces.ts b/web/src/app/admin/settings/interfaces.ts index 8715a922d..45ed7a495 100644 --- a/web/src/app/admin/settings/interfaces.ts +++ b/web/src/app/admin/settings/interfaces.ts @@ -11,6 +11,7 @@ export enum QueryHistoryType { } export interface Settings { + search_page_disabled: boolean; anonymous_user_enabled: boolean; anonymous_user_path?: string; maximum_chat_retention_days?: number | null; diff --git a/web/src/app/search/WrappedSearch.tsx b/web/src/app/search/WrappedSearch.tsx index 72047cefa..65ba3b66d 100644 --- a/web/src/app/search/WrappedSearch.tsx +++ b/web/src/app/search/WrappedSearch.tsx @@ -3,6 +3,9 @@ import { useChatContext } from "@/components/context/ChatContext"; import FunctionalWrapper from "../../components/chat/FunctionalWrapper"; import SearchPage from "./SearchPage"; +import { redirect } from "next/navigation"; +import { useContext } from "react"; +import { SettingsContext } from "@/components/settings/SettingsProvider"; export default function WrappedSearch({ defaultSidebarOff, @@ -11,6 +14,11 @@ export default function WrappedSearch({ // we don't want to show the sidebar by default when the user opens the side panel defaultSidebarOff?: boolean; }) { + const combinedSettings = useContext(SettingsContext); + const isSearchPageDisabled = combinedSettings?.settings.search_page_disabled; + if (isSearchPageDisabled) { + redirect("/chat"); + } return ( (