add pro search disable

This commit is contained in:
pablodanswer
2025-02-02 17:54:42 -08:00
committed by Evan Lohn
parent 9a3ce504bc
commit c984c6c7f2
8 changed files with 41 additions and 10 deletions

View File

@@ -228,6 +228,15 @@ export function SettingsForm() {
}
/>
<Checkbox
label="Pro Search Disabled"
sublabel="If set, users will not be able to use Pro Search."
checked={settings.pro_search_disabled}
onChange={(e) =>
handleToggleSettingsField("pro_search_disabled", e.target.checked)
}
/>
{NEXT_PUBLIC_CLOUD_ENABLED && settings.anonymous_user_enabled && (
<AnonymousUserPath setPopup={setPopup} />
)}

View File

@@ -10,6 +10,7 @@ export interface Settings {
notifications: Notification[];
needs_reindexing: boolean;
gpu_enabled: boolean;
pro_search_disabled: boolean;
product_gating: GatingType;
auto_scroll: boolean;
}

View File

@@ -1327,7 +1327,8 @@ export function ChatPage({
systemPromptOverride:
searchParams.get(SEARCH_PARAM_NAMES.SYSTEM_PROMPT) || undefined,
useExistingUserMessage: isSeededChat,
useLanggraph: proSearchEnabled,
useLanggraph:
!settings?.settings.pro_search_disabled && proSearchEnabled,
});
const delay = (ms: number) => {

View File

@@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState } from "react";
import React, { useContext, useEffect, useRef, useState } from "react";
import { FiPlusCircle, FiPlus, FiInfo, FiX, FiFilter } from "react-icons/fi";
import { ChatInputOption } from "./ChatInputOption";
import { Persona } from "@/app/admin/assistants/interfaces";
@@ -35,6 +35,7 @@ import { truncateString } from "@/lib/utils";
import { buildImgUrl } from "../files/images/utils";
import { useUser } from "@/components/user/UserProvider";
import { AgenticToggle } from "./AgenticToggle";
import { SettingsContext } from "@/components/settings/SettingsProvider";
const MAX_INPUT_HEIGHT = 200;
export const SourceChip2 = ({
@@ -225,6 +226,7 @@ export function ChatInputBar({
setProSearchEnabled,
}: ChatInputBarProps) {
const { user } = useUser();
const settings = useContext(SettingsContext);
useEffect(() => {
const textarea = textAreaRef.current;
if (textarea) {
@@ -789,12 +791,13 @@ export function ChatInputBar({
)}
</div>
<div className="flex items-center my-auto">
{retrievalEnabled && (
<AgenticToggle
proSearchEnabled={proSearchEnabled}
setProSearchEnabled={setProSearchEnabled}
/>
)}
{retrievalEnabled &&
!settings?.settings.pro_search_disabled && (
<AgenticToggle
proSearchEnabled={proSearchEnabled}
setProSearchEnabled={setProSearchEnabled}
/>
)}
<button
id="onyx-chat-input-send-button"
className={`cursor-pointer ${

View File

@@ -51,6 +51,7 @@ export async function fetchSettingsSS(): Promise<CombinedSettings | null> {
notifications: [],
needs_reindexing: false,
anonymous_user_enabled: false,
pro_search_disabled: false,
};
} else {
throw new Error(
@@ -62,6 +63,7 @@ export async function fetchSettingsSS(): Promise<CombinedSettings | null> {
} else {
settings = await results[0].json();
}
console.log(JSON.stringify(settings));
let enterpriseSettings: EnterpriseSettings | null = null;
if (tasks.length > 1) {