mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-10 12:59:59 +02:00
add workspace setting
This commit is contained in:
parent
b9465f5bc4
commit
bf4e7ae6b1
@ -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
|
||||
|
@ -260,6 +260,14 @@ export function SettingsForm() {
|
||||
}
|
||||
/>
|
||||
|
||||
<Checkbox
|
||||
label="Disable Search Page"
|
||||
sublabel="If set, users will not be able to access the search page."
|
||||
checked={settings.search_page_disabled ?? false}
|
||||
onChange={(e) =>
|
||||
handleToggleSettingsField("search_page_disabled", e.target.checked)
|
||||
}
|
||||
/>
|
||||
{NEXT_PUBLIC_CLOUD_ENABLED && settings.anonymous_user_enabled && (
|
||||
<AnonymousUserPath setPopup={setPopup} />
|
||||
)}
|
||||
|
@ -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;
|
||||
|
@ -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 (
|
||||
<FunctionalWrapper
|
||||
content={(sidebarVisible, toggle) => (
|
||||
|
Loading…
x
Reference in New Issue
Block a user