Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(setting): add a business switch for the tool channel settings page (#20015)

YuTengjing81bea08ffeef
diff --git a/packages/business/const/src/index.ts b/packages/business/const/src/index.ts
index 2282d422665..7dd9364d131 100644
--- a/packages/business/const/src/index.ts
+++ b/packages/business/const/src/index.ts
@@ -6,6 +6,14 @@ export * from './url';
export const ENABLE_BUSINESS_FEATURES = false;
+/**
+ * Whether Settings → Tools (per-user search provider / crawler ordering) is
+ * exposed. The server still honors preferences already saved; this only
+ * controls the entry. Distributions can turn it off while the feature is not
+ * ready for their users.
+ */
+export const ENABLE_TOOL_CHANNEL_SETTINGS = true;
+
/**
* Master switch for the (now removed) conversational agent-onboarding flow.
*
diff --git a/src/features/Settings/hooks/useCategory.tsx b/src/features/Settings/hooks/useCategory.tsx
index dd9eda70773..75174ed8064 100644
--- a/src/features/Settings/hooks/useCategory.tsx
+++ b/src/features/Settings/hooks/useCategory.tsx
@@ -1,3 +1,4 @@
+import { ENABLE_TOOL_CHANNEL_SETTINGS } from '@lobechat/business-const';
import { isDesktop } from '@lobechat/const';
import { Avatar } from '@lobehub/ui/base-ui';
import { SkillsIcon } from '@lobehub/ui/icons';
@@ -215,7 +216,7 @@ export const useCategory = () => {
key: SettingsTabs.Memory,
label: t('tab.memory'),
},
- {
+ ENABLE_TOOL_CHANNEL_SETTINGS && {
icon: Wrench,
key: SettingsTabs.Tools,
label: t('tab.tools'),
diff --git a/src/features/Settings/tools/index.tsx b/src/features/Settings/tools/index.tsx
index 5e17fede3e2..fb157ebc3db 100644
--- a/src/features/Settings/tools/index.tsx
+++ b/src/features/Settings/tools/index.tsx
@@ -1 +1,15 @@
-export { default } from '@/features/ToolSetting';
+'use client';
+
+import { ENABLE_TOOL_CHANNEL_SETTINGS } from '@lobechat/business-const';
+import { Navigate } from 'react-router';
+
+import ToolSetting from '@/features/ToolSetting';
+
+const Page = () => {
+ // Hidden entries can still be reached by URL; send those visits back.
+ if (!ENABLE_TOOL_CHANNEL_SETTINGS) return <Navigate replace to="/settings" />;
+
+ return <ToolSetting />;
+};
+
+export default Page;
diff --git a/src/routes/(mobile)/me/settings/features/useCategory.tsx b/src/routes/(mobile)/me/settings/features/useCategory.tsx
index 022d5c227c3..00535a3e4f0 100644
--- a/src/routes/(mobile)/me/settings/features/useCategory.tsx
+++ b/src/routes/(mobile)/me/settings/features/useCategory.tsx
@@ -1,3 +1,4 @@
+import { ENABLE_TOOL_CHANNEL_SETTINGS } from '@lobechat/business-const';
import { SkillsIcon } from '@lobehub/ui/icons';
import {
AppWindowIcon,
@@ -120,7 +121,8 @@ export const useCategory = (): CategoryGroup[] => {
makeItem({ icon: TagIcon, key: SettingsTabs.Labels, label: t('setting:tab.labels') }),
makeItem({ icon: Blocks, key: SettingsTabs.Connector, label: t('setting:tab.connector') }),
makeItem({ icon: BrainCircuit, key: SettingsTabs.Memory, label: t('setting:tab.memory') }),
- makeItem({ icon: Wrench, key: SettingsTabs.Tools, label: t('setting:tab.tools') }),
+ ENABLE_TOOL_CHANNEL_SETTINGS &&
+ makeItem({ icon: Wrench, key: SettingsTabs.Tools, label: t('setting:tab.tools') }),
makeItem({ icon: KeyRound, key: SettingsTabs.Creds, label: t('setting:tab.creds') }),
showApiKeyManage &&
makeItem({ icon: KeyIcon, key: SettingsTabs.APIKey, label: t('auth:tab.apikey') }),